diff options
author | Joe Barnett <jbarnett@stanfordalumni.org> | 2012-04-09 10:38:26 -0700 |
---|---|---|
committer | Joe Barnett <jbarnett@stanfordalumni.org> | 2012-04-09 10:38:26 -0700 |
commit | 0de9412e9079b5499fd904d2c7cf528cf3b2880e (patch) | |
tree | 00c34c9e597e73616be480da6d9705b4571c7fe5 |
initial commit
-rw-r--r-- | AUTHORS | 0 | ||||
-rw-r--r-- | COPYING | 166 | ||||
-rw-r--r-- | ChangeLog | 2 | ||||
-rw-r--r-- | INSTALL | 370 | ||||
-rw-r--r-- | Makefile.am | 21 | ||||
-rw-r--r-- | NEWS | 0 | ||||
-rw-r--r-- | README | 0 | ||||
-rwxr-xr-x | autogen.sh | 157 | ||||
-rw-r--r-- | src/Makefile.am | 35 | ||||
-rw-r--r-- | src/Makefile.in | 567 | ||||
-rw-r--r-- | src/kindling-connection-manager.c | 58 | ||||
-rw-r--r-- | src/kindling-connection-manager.h | 58 | ||||
-rw-r--r-- | src/kindling-connection.c | 334 | ||||
-rw-r--r-- | src/kindling-connection.c~ | 330 | ||||
-rw-r--r-- | src/kindling-connection.h | 57 | ||||
-rw-r--r-- | src/kindling-connection.h~ | 58 | ||||
-rw-r--r-- | src/kindling-muc-manager.c | 56 | ||||
-rw-r--r-- | src/kindling-muc-manager.h | 55 | ||||
-rw-r--r-- | src/kindling-protocol.c | 152 | ||||
-rw-r--r-- | src/kindling-protocol.c~ | 152 | ||||
-rw-r--r-- | src/kindling-protocol.h | 58 | ||||
-rw-r--r-- | src/main.c | 37 | ||||
-rw-r--r-- | telepathy_kindling.anjuta | 51 |
23 files changed, 2774 insertions, 0 deletions
@@ -0,0 +1,166 @@ + GNU LESSER GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/> + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + + This version of the GNU Lesser General Public License incorporates +the terms and conditions of version 3 of the GNU General Public +License, supplemented by the additional permissions listed below. + + 0. Additional Definitions. + + As used herein, "this License" refers to version 3 of the GNU Lesser +General Public License, and the "GNU GPL" refers to version 3 of the GNU +General Public License. + + "The Library" refers to a covered work governed by this License, +other than an Application or a Combined Work as defined below. + + An "Application" is any work that makes use of an interface provided +by the Library, but which is not otherwise based on the Library. +Defining a subclass of a class defined by the Library is deemed a mode +of using an interface provided by the Library. + + A "Combined Work" is a work produced by combining or linking an +Application with the Library. The particular version of the Library +with which the Combined Work was made is also called the "Linked +Version". + + The "Minimal Corresponding Source" for a Combined Work means the +Corresponding Source for the Combined Work, excluding any source code +for portions of the Combined Work that, considered in isolation, are +based on the Application, and not on the Linked Version. + + The "Corresponding Application Code" for a Combined Work means the +object code and/or source code for the Application, including any data +and utility programs needed for reproducing the Combined Work from the +Application, but excluding the System Libraries of the Combined Work. + + 1. Exception to Section 3 of the GNU GPL. + + You may convey a covered work under sections 3 and 4 of this License +without being bound by section 3 of the GNU GPL. + + 2. Conveying Modified Versions. + + If you modify a copy of the Library, and, in your modifications, a +facility refers to a function or data to be supplied by an Application +that uses the facility (other than as an argument passed when the +facility is invoked), then you may convey a copy of the modified +version: + + a) under this License, provided that you make a good faith effort to + ensure that, in the event an Application does not supply the + function or data, the facility still operates, and performs + whatever part of its purpose remains meaningful, or + + b) under the GNU GPL, with none of the additional permissions of + this License applicable to that copy. + + 3. Object Code Incorporating Material from Library Header Files. + + The object code form of an Application may incorporate material from +a header file that is part of the Library. You may convey such object +code under terms of your choice, provided that, if the incorporated +material is not limited to numerical parameters, data structure +layouts and accessors, or small macros, inline functions and templates +(ten or fewer lines in length), you do both of the following: + + a) Give prominent notice with each copy of the object code that the + Library is used in it and that the Library and its use are + covered by this License. + + b) Accompany the object code with a copy of the GNU GPL and this license + document. + + 4. Combined Works. + + You may convey a Combined Work under terms of your choice that, +taken together, effectively do not restrict modification of the +portions of the Library contained in the Combined Work and reverse +engineering for debugging such modifications, if you also do each of +the following: + + a) Give prominent notice with each copy of the Combined Work that + the Library is used in it and that the Library and its use are + covered by this License. + + b) Accompany the Combined Work with a copy of the GNU GPL and this license + document. + + c) For a Combined Work that displays copyright notices during + execution, include the copyright notice for the Library among + these notices, as well as a reference directing the user to the + copies of the GNU GPL and this license document. + + d) Do one of the following: + + 0) Convey the Minimal Corresponding Source under the terms of this + License, and the Corresponding Application Code in a form + suitable for, and under terms that permit, the user to + recombine or relink the Application with a modified version of + the Linked Version to produce a modified Combined Work, in the + manner specified by section 6 of the GNU GPL for conveying + Corresponding Source. + + 1) Use a suitable shared library mechanism for linking with the + Library. A suitable mechanism is one that (a) uses at run time + a copy of the Library already present on the user's computer + system, and (b) will operate properly with a modified version + of the Library that is interface-compatible with the Linked + Version. + + e) Provide Installation Information, but only if you would otherwise + be required to provide such information under section 6 of the + GNU GPL, and only to the extent that such information is + necessary to install and execute a modified version of the + Combined Work produced by recombining or relinking the + Application with a modified version of the Linked Version. (If + you use option 4d0, the Installation Information must accompany + the Minimal Corresponding Source and Corresponding Application + Code. If you use option 4d1, you must provide the Installation + Information in the manner specified by section 6 of the GNU GPL + for conveying Corresponding Source.) + + 5. Combined Libraries. + + 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 that are not Applications and are not covered by this +License, and convey such a combined library under terms of your +choice, if you do both of the following: + + a) Accompany the combined library with a copy of the same work based + on the Library, uncombined with any other library facilities, + conveyed under the terms of this License. + + b) Give prominent notice with the combined library that part of it + is a work based on the Library, and explaining where to find the + accompanying uncombined form of the same work. + + 6. Revised Versions of the GNU Lesser General Public License. + + The Free Software Foundation may publish revised and/or new versions +of the GNU 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 as you received it specifies that a certain numbered version +of the GNU Lesser General Public License "or any later version" +applies to it, you have the option of following the terms and +conditions either of that published version or of any later version +published by the Free Software Foundation. If the Library as you +received it does not specify a version number of the GNU Lesser +General Public License, you may choose any version of the GNU Lesser +General Public License ever published by the Free Software Foundation. + + If the Library as you received it specifies that a proxy can decide +whether future versions of the GNU Lesser General Public License shall +apply, that proxy's public statement of acceptance of any version is +permanent authorization for you to choose that version for the +Library. + diff --git a/ChangeLog b/ChangeLog new file mode 100644 index 0000000..139597f --- /dev/null +++ b/ChangeLog @@ -0,0 +1,2 @@ + + @@ -0,0 +1,370 @@ +Installation Instructions +************************* + +Copyright (C) 1994-1996, 1999-2002, 2004-2011 Free Software Foundation, +Inc. + + Copying and distribution of this file, with or without modification, +are permitted in any medium without royalty provided the copyright +notice and this notice are preserved. This file is offered as-is, +without warranty of any kind. + +Basic Installation +================== + + Briefly, the shell commands `./configure; make; make install' should +configure, build, and install this package. The following +more-detailed instructions are generic; see the `README' file for +instructions specific to this package. Some packages provide this +`INSTALL' file but do not implement all of the features documented +below. The lack of an optional feature in a given package is not +necessarily a bug. More recommendations for GNU packages can be found +in *note Makefile Conventions: (standards)Makefile Conventions. + + The `configure' shell script attempts to guess correct values for +various system-dependent variables used during compilation. It uses +those values to create a `Makefile' in each directory of the package. +It may also create one or more `.h' files containing system-dependent +definitions. Finally, it creates a shell script `config.status' that +you can run in the future to recreate the current configuration, and a +file `config.log' containing compiler output (useful mainly for +debugging `configure'). + + It can also use an optional file (typically called `config.cache' +and enabled with `--cache-file=config.cache' or simply `-C') that saves +the results of its tests to speed up reconfiguring. Caching is +disabled by default to prevent problems with accidental use of stale +cache files. + + If you need to do unusual things to compile the package, please try +to figure out how `configure' could check whether to do them, and mail +diffs or instructions to the address given in the `README' so they can +be considered for the next release. If you are using the cache, and at +some point `config.cache' contains results you don't want to keep, you +may remove or edit it. + + The file `configure.ac' (or `configure.in') is used to create +`configure' by a program called `autoconf'. You need `configure.ac' if +you want to change it or regenerate `configure' using a newer version +of `autoconf'. + + The simplest way to compile this package is: + + 1. `cd' to the directory containing the package's source code and type + `./configure' to configure the package for your system. + + Running `configure' might take a while. While running, it prints + some messages telling which features it is checking for. + + 2. Type `make' to compile the package. + + 3. Optionally, type `make check' to run any self-tests that come with + the package, generally using the just-built uninstalled binaries. + + 4. Type `make install' to install the programs and any data files and + documentation. When installing into a prefix owned by root, it is + recommended that the package be configured and built as a regular + user, and only the `make install' phase executed with root + privileges. + + 5. Optionally, type `make installcheck' to repeat any self-tests, but + this time using the binaries in their final installed location. + This target does not install anything. Running this target as a + regular user, particularly if the prior `make install' required + root privileges, verifies that the installation completed + correctly. + + 6. You can remove the program binaries and object files from the + source code directory by typing `make clean'. To also remove the + files that `configure' created (so you can compile the package for + a different kind of computer), type `make distclean'. There is + also a `make maintainer-clean' target, but that is intended mainly + for the package's developers. If you use it, you may have to get + all sorts of other programs in order to regenerate files that came + with the distribution. + + 7. Often, you can also type `make uninstall' to remove the installed + files again. In practice, not all packages have tested that + uninstallation works correctly, even though it is required by the + GNU Coding Standards. + + 8. Some packages, particularly those that use Automake, provide `make + distcheck', which can by used by developers to test that all other + targets like `make install' and `make uninstall' work correctly. + This target is generally not run by end users. + +Compilers and Options +===================== + + Some systems require unusual options for compilation or linking that +the `configure' script does not know about. Run `./configure --help' +for details on some of the pertinent environment variables. + + You can give `configure' initial values for configuration parameters +by setting variables in the command line or in the environment. Here +is an example: + + ./configure CC=c99 CFLAGS=-g LIBS=-lposix + + *Note Defining Variables::, for more details. + +Compiling For Multiple Architectures +==================================== + + You can compile the package for more than one kind of computer at the +same time, by placing the object files for each architecture in their +own directory. To do this, you can use GNU `make'. `cd' to the +directory where you want the object files and executables to go and run +the `configure' script. `configure' automatically checks for the +source code in the directory that `configure' is in and in `..'. This +is known as a "VPATH" build. + + With a non-GNU `make', it is safer to compile the package for one +architecture at a time in the source code directory. After you have +installed the package for one architecture, use `make distclean' before +reconfiguring for another architecture. + + On MacOS X 10.5 and later systems, you can create libraries and +executables that work on multiple system types--known as "fat" or +"universal" binaries--by specifying multiple `-arch' options to the +compiler but only a single `-arch' option to the preprocessor. Like +this: + + ./configure CC="gcc -arch i386 -arch x86_64 -arch ppc -arch ppc64" \ + CXX="g++ -arch i386 -arch x86_64 -arch ppc -arch ppc64" \ + CPP="gcc -E" CXXCPP="g++ -E" + + This is not guaranteed to produce working output in all cases, you +may have to build one architecture at a time and combine the results +using the `lipo' tool if you have problems. + +Installation Names +================== + + By default, `make install' installs the package's commands under +`/usr/local/bin', include files under `/usr/local/include', etc. You +can specify an installation prefix other than `/usr/local' by giving +`configure' the option `--prefix=PREFIX', where PREFIX must be an +absolute file name. + + You can specify separate installation prefixes for +architecture-specific files and architecture-independent files. If you +pass the option `--exec-prefix=PREFIX' to `configure', the package uses +PREFIX as the prefix for installing programs and libraries. +Documentation and other data files still use the regular prefix. + + In addition, if you use an unusual directory layout you can give +options like `--bindir=DIR' to specify different values for particular +kinds of files. Run `configure --help' for a list of the directories +you can set and what kinds of files go in them. In general, the +default for these options is expressed in terms of `${prefix}', so that +specifying just `--prefix' will affect all of the other directory +specifications that were not explicitly provided. + + The most portable way to affect installation locations is to pass the +correct locations to `configure'; however, many packages provide one or +both of the following shortcuts of passing variable assignments to the +`make install' command line to change installation locations without +having to reconfigure or recompile. + + The first method involves providing an override variable for each +affected directory. For example, `make install +prefix=/alternate/directory' will choose an alternate location for all +directory configuration variables that were expressed in terms of +`${prefix}'. Any directories that were specified during `configure', +but not in terms of `${prefix}', must each be overridden at install +time for the entire installation to be relocated. The approach of +makefile variable overrides for each directory variable is required by +the GNU Coding Standards, and ideally causes no recompilation. +However, some platforms have known limitations with the semantics of +shared libraries that end up requiring recompilation when using this +method, particularly noticeable in packages that use GNU Libtool. + + The second method involves providing the `DESTDIR' variable. For +example, `make install DESTDIR=/alternate/directory' will prepend +`/alternate/directory' before all installation names. The approach of +`DESTDIR' overrides is not required by the GNU Coding Standards, and +does not work on platforms that have drive letters. On the other hand, +it does better at avoiding recompilation issues, and works well even +when some directory options were not specified in terms of `${prefix}' +at `configure' time. + +Optional Features +================= + + If the package supports it, you can cause programs to be installed +with an extra prefix or suffix on their names by giving `configure' the +option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'. + + Some packages pay attention to `--enable-FEATURE' options to +`configure', where FEATURE indicates an optional part of the package. +They may also pay attention to `--with-PACKAGE' options, where PACKAGE +is something like `gnu-as' or `x' (for the X Window System). The +`README' should mention any `--enable-' and `--with-' options that the +package recognizes. + + For packages that use the X Window System, `configure' can usually +find the X include and library files automatically, but if it doesn't, +you can use the `configure' options `--x-includes=DIR' and +`--x-libraries=DIR' to specify their locations. + + Some packages offer the ability to configure how verbose the +execution of `make' will be. For these packages, running `./configure +--enable-silent-rules' sets the default to minimal output, which can be +overridden with `make V=1'; while running `./configure +--disable-silent-rules' sets the default to verbose, which can be +overridden with `make V=0'. + +Particular systems +================== + + On HP-UX, the default C compiler is not ANSI C compatible. If GNU +CC is not installed, it is recommended to use the following options in +order to use an ANSI C compiler: + + ./configure CC="cc -Ae -D_XOPEN_SOURCE=500" + +and if that doesn't work, install pre-built binaries of GCC for HP-UX. + + HP-UX `make' updates targets which have the same time stamps as +their prerequisites, which makes it generally unusable when shipped +generated files such as `configure' are involved. Use GNU `make' +instead. + + On OSF/1 a.k.a. Tru64, some versions of the default C compiler cannot +parse its `<wchar.h>' header file. The option `-nodtk' can be used as +a workaround. If GNU CC is not installed, it is therefore recommended +to try + + ./configure CC="cc" + +and if that doesn't work, try + + ./configure CC="cc -nodtk" + + On Solaris, don't put `/usr/ucb' early in your `PATH'. This +directory contains several dysfunctional programs; working variants of +these programs are available in `/usr/bin'. So, if you need `/usr/ucb' +in your `PATH', put it _after_ `/usr/bin'. + + On Haiku, software installed for all users goes in `/boot/common', +not `/usr/local'. It is recommended to use the following options: + + ./configure --prefix=/boot/common + +Specifying the System Type +========================== + + There may be some features `configure' cannot figure out +automatically, but needs to determine by the type of machine the package +will run on. Usually, assuming the package is built to be run on the +_same_ architectures, `configure' can figure that out, but if it prints +a message saying it cannot guess the machine type, give it the +`--build=TYPE' option. TYPE can either be a short name for the system +type, such as `sun4', or a canonical name which has the form: + + CPU-COMPANY-SYSTEM + +where SYSTEM can have one of these forms: + + OS + KERNEL-OS + + See the file `config.sub' for the possible values of each field. If +`config.sub' isn't included in this package, then this package doesn't +need to know the machine type. + + If you are _building_ compiler tools for cross-compiling, you should +use the option `--target=TYPE' to select the type of system they will +produce code for. + + If you want to _use_ a cross compiler, that generates code for a +platform different from the build platform, you should specify the +"host" platform (i.e., that on which the generated programs will +eventually be run) with `--host=TYPE'. + +Sharing Defaults +================ + + If you want to set default values for `configure' scripts to share, +you can create a site shell script called `config.site' that gives +default values for variables like `CC', `cache_file', and `prefix'. +`configure' looks for `PREFIX/share/config.site' if it exists, then +`PREFIX/etc/config.site' if it exists. Or, you can set the +`CONFIG_SITE' environment variable to the location of the site script. +A warning: not all `configure' scripts look for a site script. + +Defining Variables +================== + + Variables not defined in a site shell script can be set in the +environment passed to `configure'. However, some packages may run +configure again during the build, and the customized values of these +variables may be lost. In order to avoid this problem, you should set +them in the `configure' command line, using `VAR=value'. For example: + + ./configure CC=/usr/local2/bin/gcc + +causes the specified `gcc' to be used as the C compiler (unless it is +overridden in the site shell script). + +Unfortunately, this technique does not work for `CONFIG_SHELL' due to +an Autoconf bug. Until the bug is fixed you can use this workaround: + + CONFIG_SHELL=/bin/bash /bin/bash ./configure CONFIG_SHELL=/bin/bash + +`configure' Invocation +====================== + + `configure' recognizes the following options to control how it +operates. + +`--help' +`-h' + Print a summary of all of the options to `configure', and exit. + +`--help=short' +`--help=recursive' + Print a summary of the options unique to this package's + `configure', and exit. The `short' variant lists options used + only in the top level, while the `recursive' variant lists options + also present in any nested packages. + +`--version' +`-V' + Print the version of Autoconf used to generate the `configure' + script, and exit. + +`--cache-file=FILE' + Enable the cache: use and save the results of the tests in FILE, + traditionally `config.cache'. FILE defaults to `/dev/null' to + disable caching. + +`--config-cache' +`-C' + Alias for `--cache-file=config.cache'. + +`--quiet' +`--silent' +`-q' + Do not print messages saying which checks are being made. To + suppress all normal output, redirect it to `/dev/null' (any error + messages will still be shown). + +`--srcdir=DIR' + Look for the package's source code in directory DIR. Usually + `configure' can determine that directory automatically. + +`--prefix=DIR' + Use DIR as the installation prefix. *note Installation Names:: + for more details, including other options available for fine-tuning + the installation locations. + +`--no-create' +`-n' + Run the configure checks, but stop before creating any output + files. + +`configure' also accepts some other, not widely useful, options. Run +`configure --help' for more details. + diff --git a/Makefile.am b/Makefile.am new file mode 100644 index 0000000..b0267ff --- /dev/null +++ b/Makefile.am @@ -0,0 +1,21 @@ +## Process this file with automake to produce Makefile.in +## Created by Anjuta + +SUBDIRS = src + +telepathy_kindlingdocdir = ${prefix}/doc/telepathy_kindling +telepathy_kindlingdoc_DATA = \ + README\ + COPYING\ + AUTHORS\ + ChangeLog\ + INSTALL\ + NEWS + + +EXTRA_DIST = $(telepathy_kindlingdoc_DATA) + + +# Remove doc directory on uninstall +uninstall-local: + -rm -r $(telepathy_kindlingdocdir) diff --git a/autogen.sh b/autogen.sh new file mode 100755 index 0000000..a0ec5ee --- /dev/null +++ b/autogen.sh @@ -0,0 +1,157 @@ +#!/bin/sh +# Run this to generate all the initial makefiles, etc. + +srcdir=`dirname $0` +test -z "$srcdir" && srcdir=. + +DIE=0 + +if [ -n "$GNOME2_DIR" ]; then + ACLOCAL_FLAGS="-I $GNOME2_DIR/share/aclocal $ACLOCAL_FLAGS" + LD_LIBRARY_PATH="$GNOME2_DIR/lib:$LD_LIBRARY_PATH" + PATH="$GNOME2_DIR/bin:$PATH" + export PATH + export LD_LIBRARY_PATH +fi + +(test -f $srcdir/configure.ac) || { + echo -n "**Error**: Directory "\`$srcdir\'" does not look like the" + echo " top-level package directory" + exit 1 +} + +(autoconf --version) < /dev/null > /dev/null 2>&1 || { + echo + echo "**Error**: You must have \`autoconf' installed." + echo "Download the appropriate package for your distribution," + echo "or get the source tarball at ftp://ftp.gnu.org/pub/gnu/" + DIE=1 +} + +(grep "^IT_PROG_INTLTOOL" $srcdir/configure.ac >/dev/null) && { + (intltoolize --version) < /dev/null > /dev/null 2>&1 || { + echo + echo "**Error**: You must have \`intltool' installed." + echo "You can get it from:" + echo " ftp://ftp.gnome.org/pub/GNOME/" + DIE=1 + } +} + +(grep "^AM_PROG_XML_I18N_TOOLS" $srcdir/configure.ac >/dev/null) && { + (xml-i18n-toolize --version) < /dev/null > /dev/null 2>&1 || { + echo + echo "**Error**: You must have \`xml-i18n-toolize' installed." + echo "You can get it from:" + echo " ftp://ftp.gnome.org/pub/GNOME/" + DIE=1 + } +} + +(grep "^LT_INIT" $srcdir/configure.ac >/dev/null) && { + (libtool --version) < /dev/null > /dev/null 2>&1 || { + echo + echo "**Error**: You must have \`libtool' installed." + echo "You can get it from: ftp://ftp.gnu.org/pub/gnu/" + DIE=1 + } +} + +(grep "^AM_GLIB_GNU_GETTEXT" $srcdir/configure.ac >/dev/null) && { + (grep "sed.*POTFILES" $srcdir/configure.ac) > /dev/null || \ + (glib-gettextize --version) < /dev/null > /dev/null 2>&1 || { + echo + echo "**Error**: You must have \`glib' installed." + echo "You can get it from: ftp://ftp.gtk.org/pub/gtk" + DIE=1 + } +} + +(automake --version) < /dev/null > /dev/null 2>&1 || { + echo + echo "**Error**: You must have \`automake' installed." + echo "You can get it from: ftp://ftp.gnu.org/pub/gnu/" + DIE=1 + NO_AUTOMAKE=yes +} + + +# if no automake, don't bother testing for aclocal +test -n "$NO_AUTOMAKE" || (aclocal --version) < /dev/null > /dev/null 2>&1 || { + echo + echo "**Error**: Missing \`aclocal'. The version of \`automake'" + echo "installed doesn't appear recent enough." + echo "You can get automake from ftp://ftp.gnu.org/pub/gnu/" + DIE=1 +} + +if test "$DIE" -eq 1; then + exit 1 +fi + +if test -z "$*"; then + echo "**Warning**: I am going to run \`configure' with no arguments." + echo "If you wish to pass any to it, please specify them on the" + echo \`$0\'" command line." + echo +fi + +case $CC in +xlc ) + am_opt=--include-deps;; +esac + +for coin in `find $srcdir -path $srcdir/CVS -prune -o -name configure.ac -print` +do + dr=`dirname $coin` + if test -f $dr/NO-AUTO-GEN; then + echo skipping $dr -- flagged as no auto-gen + else + echo processing $dr + ( cd $dr + + aclocalinclude="$ACLOCAL_FLAGS" + + if grep "^AM_GLIB_GNU_GETTEXT" configure.ac >/dev/null; then + echo "Creating $dr/aclocal.m4 ..." + test -r $dr/aclocal.m4 || touch $dr/aclocal.m4 + echo "Running glib-gettextize... Ignore non-fatal messages." + echo "no" | glib-gettextize --force --copy + echo "Making $dr/aclocal.m4 writable ..." + test -r $dr/aclocal.m4 && chmod u+w $dr/aclocal.m4 + fi + if grep "^IT_PROG_INTLTOOL" configure.ac >/dev/null; then + echo "Running intltoolize..." + intltoolize --copy --force --automake + fi + if grep "^AM_PROG_XML_I18N_TOOLS" configure.ac >/dev/null; then + echo "Running xml-i18n-toolize..." + xml-i18n-toolize --copy --force --automake + fi + if grep "^LT_INIT" configure.ac >/dev/null; then + if test -z "$NO_LIBTOOLIZE" ; then + echo "Running libtoolize..." + libtoolize --force --copy + fi + fi + echo "Running aclocal $aclocalinclude ..." + aclocal $aclocalinclude + if grep "^A[CM]_CONFIG_HEADER" configure.ac >/dev/null; then + echo "Running autoheader..." + autoheader + fi + echo "Running automake --gnu $am_opt ..." + automake --add-missing --copy --gnu $am_opt + echo "Running autoconf ..." + autoconf + ) + fi +done + +if test x$NOCONFIGURE = x; then + echo Running $srcdir/configure "$@" ... + $srcdir/configure "$@" \ + && echo Now type \`make\' to compile. || exit 1 +else + echo Skipping configure process. +fi diff --git a/src/Makefile.am b/src/Makefile.am new file mode 100644 index 0000000..7d28786 --- /dev/null +++ b/src/Makefile.am @@ -0,0 +1,35 @@ +## Process this file with automake to produce Makefile.in + +## Created by Anjuta + + + +AM_CPPFLAGS = \ + -DPACKAGE_LOCALE_DIR=\""$(localedir)"\" \ + -DPACKAGE_SRC_DIR=\""$(srcdir)"\" \ + -DPACKAGE_DATA_DIR=\""$(pkgdatadir)"\" \ + $(TELEPATHY_KINDLING_CFLAGS) + +AM_CFLAGS =\ + -Wall\ + -g + +bin_PROGRAMS = telepathy_kindling + +telepathy_kindling_SOURCES = \ + main.c \ + kindling-connection-manager.h \ + kindling-connection-manager.c \ + kindling-protocol.c \ + kindling-protocol.h \ + kindling-connection.c \ + kindling-connection.h \ + kindling-muc-manager.c \ + kindling-muc-manager.h + +telepathy_kindling_LDFLAGS = \ + -Wl,--export-dynamic + +telepathy_kindling_LDADD = $(TELEPATHY_KINDLING_LIBS) + + diff --git a/src/Makefile.in b/src/Makefile.in new file mode 100644 index 0000000..ac4e8f2 --- /dev/null +++ b/src/Makefile.in @@ -0,0 +1,567 @@ +# Makefile.in generated by automake 1.11.3 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 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@ + +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@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@ +bin_PROGRAMS = telepathy_kindling$(EXEEXT) +subdir = src +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in +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 = +CONFIG_CLEAN_VPATH_FILES = +am__installdirs = "$(DESTDIR)$(bindir)" +PROGRAMS = $(bin_PROGRAMS) +am_telepathy_kindling_OBJECTS = main.$(OBJEXT) \ + kindling-connection-manager.$(OBJEXT) \ + kindling-protocol.$(OBJEXT) kindling-connection.$(OBJEXT) \ + kindling-muc-manager.$(OBJEXT) +telepathy_kindling_OBJECTS = $(am_telepathy_kindling_OBJECTS) +am__DEPENDENCIES_1 = +telepathy_kindling_DEPENDENCIES = $(am__DEPENDENCIES_1) +AM_V_lt = $(am__v_lt_@AM_V@) +am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) +am__v_lt_0 = --silent +telepathy_kindling_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ + $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ + $(AM_CFLAGS) $(CFLAGS) $(telepathy_kindling_LDFLAGS) \ + $(LDFLAGS) -o $@ +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__depfiles_maybe = depfiles +am__mv = mv -f +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CFLAGS) $(CFLAGS) +AM_V_CC = $(am__v_CC_@AM_V@) +am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) +am__v_CC_0 = @echo " CC " $@; +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +CCLD = $(CC) +LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_CCLD = $(am__v_CCLD_@AM_V@) +am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) +am__v_CCLD_0 = @echo " CCLD " $@; +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +SOURCES = $(telepathy_kindling_SOURCES) +DIST_SOURCES = $(telepathy_kindling_SOURCES) +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AR = @AR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +GREP = @GREP@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ +MKDIR_P = @MKDIR_P@ +NM = @NM@ +NMEDIT = @NMEDIT@ +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@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ +RANLIB = @RANLIB@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +TELEPATHY_KINDLING_CFLAGS = @TELEPATHY_KINDLING_CFLAGS@ +TELEPATHY_KINDLING_LIBS = @TELEPATHY_KINDLING_LIBS@ +VERSION = @VERSION@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +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_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +AM_CPPFLAGS = \ + -DPACKAGE_LOCALE_DIR=\""$(localedir)"\" \ + -DPACKAGE_SRC_DIR=\""$(srcdir)"\" \ + -DPACKAGE_DATA_DIR=\""$(pkgdatadir)"\" \ + $(TELEPATHY_KINDLING_CFLAGS) + +AM_CFLAGS = \ + -Wall\ + -g + +telepathy_kindling_SOURCES = \ + main.c \ + kindling-connection-manager.h \ + kindling-connection-manager.c \ + kindling-protocol.c \ + kindling-protocol.h \ + kindling-connection.c \ + kindling-connection.h \ + kindling-muc-manager.c \ + kindling-muc-manager.h + +telepathy_kindling_LDFLAGS = \ + -Wl,--export-dynamic + +telepathy_kindling_LDADD = $(TELEPATHY_KINDLING_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 ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --gnu src/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 +$(am__aclocal_m4_deps): +install-binPROGRAMS: $(bin_PROGRAMS) + @$(NORMAL_INSTALL) + test -z "$(bindir)" || $(MKDIR_P) "$(DESTDIR)$(bindir)" + @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ + for p in $$list; do echo "$$p $$p"; done | \ + sed 's/$(EXEEXT)$$//' | \ + while read p p1; do if test -f $$p || test -f $$p1; \ + then echo "$$p"; echo "$$p"; else :; fi; \ + done | \ + sed -e 'p;s,.*/,,;n;h' -e 's|.*|.|' \ + -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \ + sed 'N;N;N;s,\n, ,g' | \ + $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \ + { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \ + if ($$2 == $$4) files[d] = files[d] " " $$1; \ + else { print "f", $$3 "/" $$4, $$1; } } \ + END { for (d in files) print "f", d, files[d] }' | \ + while read type dir files; do \ + if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \ + test -z "$$files" || { \ + echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(bindir)$$dir'"; \ + $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \ + } \ + ; done + +uninstall-binPROGRAMS: + @$(NORMAL_UNINSTALL) + @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ + files=`for p in $$list; do echo "$$p"; done | \ + sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \ + -e 's/$$/$(EXEEXT)/' `; \ + test -n "$$list" || exit 0; \ + echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \ + cd "$(DESTDIR)$(bindir)" && rm -f $$files + +clean-binPROGRAMS: + @list='$(bin_PROGRAMS)'; test -n "$$list" || exit 0; \ + echo " rm -f" $$list; \ + rm -f $$list || exit $$?; \ + test -n "$(EXEEXT)" || exit 0; \ + list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ + echo " rm -f" $$list; \ + rm -f $$list +telepathy_kindling$(EXEEXT): $(telepathy_kindling_OBJECTS) $(telepathy_kindling_DEPENDENCIES) $(EXTRA_telepathy_kindling_DEPENDENCIES) + @rm -f telepathy_kindling$(EXEEXT) + $(AM_V_CCLD)$(telepathy_kindling_LINK) $(telepathy_kindling_OBJECTS) $(telepathy_kindling_LDADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/kindling-connection-manager.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/kindling-connection.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/kindling-muc-manager.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/kindling-protocol.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/main.Po@am__quote@ + +.c.o: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c $< + +.c.obj: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c `$(CYGPATH_W) '$<'` + +.c.lo: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +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; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + set x; \ + 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; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + 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)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__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 "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$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: + for dir in "$(DESTDIR)$(bindir)"; 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: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_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-binPROGRAMS clean-generic clean-libtool mostlyclean-am + +distclean: distclean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: install-binPROGRAMS + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +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-binPROGRAMS + +.MAKE: install-am install-strip + +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \ + clean-generic clean-libtool ctags distclean distclean-compile \ + distclean-generic distclean-libtool distclean-tags distdir dvi \ + dvi-am html html-am info info-am install install-am \ + install-binPROGRAMS 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-man \ + install-pdf install-pdf-am install-ps install-ps-am \ + 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-binPROGRAMS + + +# 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 --git a/src/kindling-connection-manager.c b/src/kindling-connection-manager.c new file mode 100644 index 0000000..605f4ec --- /dev/null +++ b/src/kindling-connection-manager.c @@ -0,0 +1,58 @@ +/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */ +/* + * telepathy-kindling + * Copyright (C) Joe Barnett 2012 <jbarnett@taplop> + * +telepathy-kindling 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 3 of the License, or + * (at your option) any later version. + * + * telepathy-kindling is distributed in the hope that 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, see <http://www.gnu.org/licenses/>."; + */ +#include "kindling-connection-manager.h" +#include "kindling-protocol.h" +#include <glib-object.h> + +G_DEFINE_TYPE(KindlingConnectionManager, kindling_connection_manager, TP_TYPE_BASE_CONNECTION_MANAGER) + +static void kindling_connection_manager_init(KindlingConnectionManager *obj) { + g_printf("inited kindling cm\n"); +} + +static void kindling_connection_manager_finalize (GObject *object) { + g_printf("finalized kindling cm object\n"); + G_OBJECT_CLASS (kindling_connection_manager_parent_class)->finalize (object); +} + +static void kindling_connection_manager_constructed (GObject *object) { + g_printf("constructed kindling cm object\n"); + TpBaseConnectionManager *base = (TpBaseConnectionManager *) object; + TpBaseProtocol *p; + void (*constructed) (GObject *) = ((GObjectClass *) kindling_connection_manager_parent_class)->constructed; + + if (constructed != NULL) + constructed (object); + + p = g_object_new(KINDLING_TYPE_PROTOCOL, "name", "campfire", NULL); + tp_base_connection_manager_add_protocol (base, p); + g_object_unref (p); + +} + +static void kindling_connection_manager_class_init(KindlingConnectionManagerClass *klass) { + GObjectClass *object_class = G_OBJECT_CLASS (klass); + TpBaseConnectionManagerClass *parent_class = TP_BASE_CONNECTION_MANAGER_CLASS(klass); + + parent_class->cm_dbus_name = "kindling"; + + object_class->finalize = kindling_connection_manager_finalize; + object_class->constructed = kindling_connection_manager_constructed; + g_printf("inited kindling cm class\n"); +} diff --git a/src/kindling-connection-manager.h b/src/kindling-connection-manager.h new file mode 100644 index 0000000..0229693 --- /dev/null +++ b/src/kindling-connection-manager.h @@ -0,0 +1,58 @@ +/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */ +/* + * telepathy-kindling + * Copyright (C) Joe Barnett 2012 <jbarnett@taplop> + * +telepathy-kindling 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 3 of the License, or + * (at your option) any later version. + * + * telepathy-kindling is distributed in the hope that 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, see <http://www.gnu.org/licenses/>."; + */ +#ifndef __KINDLING_CONNECTION_MANAGER_H__ +#define __KINDLING_CONNECTION_MANAGER_H__ + +#include <glib-object.h> +#include <telepathy-glib/base-connection-manager.h> + +G_BEGIN_DECLS + +typedef struct _KindlingConnectionManager KindlingConnectionManager; +typedef struct _KindlingConnectionManagerClass KindlingConnectionManagerClass; + +struct _KindlingConnectionManagerClass { + TpBaseConnectionManagerClass parent_class; +}; + +struct _KindlingConnectionManager { + TpBaseConnection parent; +}; + +GType kindling_connection_manager_get_type(void); + +#define KINDLING_TYPE_CONNECTION_MANAGER \ + (kindling_connection_manager_get_type()) +#define KINDLING_CONNECTION_MANAGER(obj) \ + (G_TYPE_CHECK_INSTANCE_CAST((obj), KINDLING_TYPE_CONNECTION_MANAGER, KindlingConnectionManager)) +#define KINDLING_CONNECTION_MANAGER_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_CAST((klass), KINDLING_TYPE_CONNECTION_MANAGER, KindlingConnectionManagerClass)) +#define KINDLING_IS_CONNECTION_MANAGER(obj) \ + (G_TYPE_CHECK_INSTANCE_TYPE((obj), KINDLING_TYPE_CONNECTION_MANAGER)) +#define KINDLING_IS_CONNECTION_MANAGER_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_TYPE((klass), KINDLING_TYPE_CONNECTION_MANAGER)) +#define KINDLING_CONNECTION_MANAGER_GET_CLASS(obj) \ + (G_TYPE_INSTANCE_GET_CLASS((obj), KINDLING_TYPE_CONNECTION_MANAGER, KindlingConnectionManagerClass)) + + + + +G_END_DECLS + +#endif
\ No newline at end of file diff --git a/src/kindling-connection.c b/src/kindling-connection.c new file mode 100644 index 0000000..51f7e06 --- /dev/null +++ b/src/kindling-connection.c @@ -0,0 +1,334 @@ +/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */ +/* + * telepathy-kindling + * Copyright (C) Joe Barnett 2012 <jbarnett@taplop> + * +telepathy-kindling 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 3 of the License, or + * (at your option) any later version. + * + * telepathy-kindling is distributed in the hope that 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, see <http://www.gnu.org/licenses/>."; + */ +#include "kindling-connection.h" +#include "kindling-muc-manager.h" +#include <telepathy-glib/interfaces.h> +#include <telepathy-glib/handle-repo-dynamic.h> +#include <telepathy-glib/simple-password-manager.h> +#include <telepathy-glib/telepathy-glib.h> +#include <libsoup/soup.h> +#include <json-glib/json-glib.h> + +G_DEFINE_TYPE (KindlingConnection, kindling_connection, TP_TYPE_BASE_CONNECTION); + +static const gchar * interfaces_always_present[] = { + TP_IFACE_CONNECTION_INTERFACE_ALIASING, + TP_IFACE_CONNECTION_INTERFACE_CONTACT_INFO, + TP_IFACE_CONNECTION_INTERFACE_REQUESTS, + TP_IFACE_CONNECTION_INTERFACE_CONTACTS, + NULL}; + +const gchar * const *kindling_connection_get_implemented_interfaces (void) { + /* we don't have any conditionally-implemented interfaces yet */ + return interfaces_always_present; +} + +enum { + PROP_SERVER = 1, + PROP_USERNAME, + PROP_PASSWORD, + LAST_PROPERTY_ENUM +}; + +typedef struct _KindlingConnectionPrivate KindlingConnectionPrivate; +struct _KindlingConnectionPrivate { + char *server; + char *username; + char *password; + char *api_token; + + //for actual auth + TpSimplePasswordManager *password_manager; + SoupSession *soup_session; + gulong soup_auth_cb_handle; +}; + +#define KINDLING_CONNECTION_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE((o), KINDLING_TYPE_CONNECTION, KindlingConnectionPrivate)) + +static void kindling_connection_set_property(GObject *obj, guint prop_id, const GValue *value, GParamSpec *pspec) { + g_printf("connection set prop %d\n", prop_id); + KindlingConnectionPrivate *priv = KINDLING_CONNECTION_GET_PRIVATE(obj); + switch (prop_id) { + case PROP_SERVER: + g_free(priv->server); + priv->server = g_value_dup_string(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; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID(obj, prop_id, pspec); + break; + } +} + +static void kindling_connection_get_property(GObject *obj, guint prop_id, GValue *value, GParamSpec *pspec) { + g_printf("connection get prop %d\n", prop_id); + KindlingConnectionPrivate *priv = KINDLING_CONNECTION_GET_PRIVATE(obj); + switch (prop_id) { + case PROP_SERVER: + g_value_set_string(value, priv->server); + break; + case PROP_USERNAME: + g_value_set_string(value, priv->username); + break; + case PROP_PASSWORD: + g_value_set_string(value, priv->password); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID(obj, prop_id, pspec); + break; + } + +} + +static void +kindling_connection_init (KindlingConnection *kindling_connection) { + g_printf("connection init\n"); +} + +static void _soup_authenticate_cb(SoupSession *session, + SoupMessage *msg, + SoupAuth *auth, + gboolean retrying, + gpointer user_data) { + g_printf("soup authenitcate\n"); + KindlingConnectionPrivate *priv = KINDLING_CONNECTION_GET_PRIVATE(user_data); + if (!retrying) { + soup_auth_authenticate(auth, priv->username, priv->password); + } + +} + +static void kindling_connection_constructed (GObject *object) { + g_printf("connection constructed\n"); + KindlingConnectionPrivate *priv = KINDLING_CONNECTION_GET_PRIVATE(object); + priv->soup_session = soup_session_async_new(); + + priv->soup_auth_cb_handle = g_signal_connect(priv->soup_session, + "authenticate", + _soup_authenticate_cb, + object); + /* TODO: Add initialization code here */ +} + +static void +kindling_connection_finalize (GObject *object) { + /* TODO: Add deinitalization code here */ + KindlingConnectionPrivate *priv = KINDLING_CONNECTION_GET_PRIVATE(object); + g_free(priv->server); + g_free(priv->username); + g_free(priv->password); + g_free(priv->api_token); + + g_signal_handler_disconnect(priv->soup_session, priv->soup_auth_cb_handle); + g_object_unref(priv->soup_session); + g_printf("finalize kindling connection object\n"); + G_OBJECT_CLASS (kindling_connection_parent_class)->finalize (object); +} +static void +kindling_connection_dispose (GObject *object) { + g_printf("disposing connection\n"); +} + + +static void _iface_create_handle_repos(TpBaseConnection *self, TpHandleRepoIface **repos) { + g_printf("connection create handle repos\n"); + int i; + for (i = 0; i < NUM_TP_HANDLE_TYPES; i++) { + repos[i] = NULL; + } + repos[TP_HANDLE_TYPE_CONTACT] = (TpHandleRepoIface *) g_object_new(TP_TYPE_DYNAMIC_HANDLE_REPO, + "handle-type", TP_HANDLE_TYPE_CONTACT, + NULL); + repos[TP_HANDLE_TYPE_ROOM] = (TpHandleRepoIface *) g_object_new(TP_TYPE_DYNAMIC_HANDLE_REPO, + "handle-type", TP_HANDLE_TYPE_ROOM, + NULL); +} + +static GPtrArray *_iface_create_channel_managers(TpBaseConnection *self) { + g_printf("connection create chan manager\n"); + KindlingConnectionPrivate *priv = KINDLING_CONNECTION_GET_PRIVATE(self); + GPtrArray *managers = g_ptr_array_sized_new (1); + g_ptr_array_add (managers, g_object_new (KINDLING_TYPE_MUC_MANAGER, + // "connection", self, + NULL)); + priv->password_manager = tp_simple_password_manager_new(self); + g_ptr_array_add(managers, priv->password_manager); + return managers; +} + +static void _connection_disconnect_with_gerror(KindlingConnection *conn, TpConnectionStatusReason reason, const gchar *key, const GError *error) { + g_printf("disconnect w/ error\n"); + GHashTable *details = tp_asv_new(key, G_TYPE_STRING, error->message, NULL); + + tp_base_connection_disconnect_with_dbus_error(TP_BASE_CONNECTION(conn), + tp_error_get_dbus_name(error->code), + details, + reason); + g_hash_table_unref(details); +} +static void +_soup_get_user_cb (SoupSession *session, SoupMessage *msg, gpointer user_data) { + g_printf("got user req soup callback %d : %s\n", msg->status_code , msg->response_body->data); + KindlingConnection *conn = KINDLING_CONNECTION(user_data); + TpBaseConnection *base_conn = TP_BASE_CONNECTION(conn); + KindlingConnectionPrivate *priv = KINDLING_CONNECTION_GET_PRIVATE(conn); + JsonParser *parser = json_parser_new(); + GError *error = NULL; + json_parser_load_from_data(parser, msg->response_body->data, -1, &error); + if (error != NULL) { + g_printf("error %s", error->message); + if (base_conn->status != TP_CONNECTION_STATUS_DISCONNECTED) { + _connection_disconnect_with_gerror(conn, + TP_CONNECTION_STATUS_REASON_AUTHENTICATION_FAILED, + "debug-message", + error); + } + g_error_free(error); + g_object_unref (parser); + return; + } + JsonReader *reader = json_reader_new(json_parser_get_root (parser)); + json_reader_read_member (reader, "user"); + json_reader_read_member (reader, "api_auth_token"); + g_free(priv->api_token); + priv->api_token = g_strdup(json_reader_get_string_value(reader)); + g_object_unref (reader); + g_object_unref (parser); + + if (priv->api_token == NULL) { + if (base_conn->status != TP_CONNECTION_STATUS_DISCONNECTED) { + GError *error = g_error_new_literal(TP_ERRORS, 1, "no api token"); + + _connection_disconnect_with_gerror(conn, + TP_CONNECTION_STATUS_REASON_AUTHENTICATION_FAILED, + "debug-message", + error); + g_error_free(error); + + } + } + + tp_base_connection_change_status (base_conn, TP_CONNECTION_STATUS_CONNECTED, TP_CONNECTION_STATUS_REASON_REQUESTED); +} + +static void _start_connecting_continue(KindlingConnection *self) { + KindlingConnectionPrivate *priv = KINDLING_CONNECTION_GET_PRIVATE(self); + g_printf("continue connecting to %s with user name %s\n", priv->server, priv->username); + + + gchar *message = g_strdup_printf("https://%s.campfirenow.com/users/me.json", priv->server); + g_printf("continue connecting to %s\n", message); + SoupMessage *msg = soup_message_new("GET", message); + g_free(message); + //tp_base_connection_change_status (TP_BASE_CONNECTION(self), TP_CONNECTION_STATUS_CONNECTED, TP_CONNECTION_STATUS_REASON_REQUESTED); + soup_session_queue_message(priv->soup_session, msg, _soup_get_user_cb, self); +} + +static void _password_prompt_cb (GObject *source, GAsyncResult *result, gpointer user_data) { + g_printf("prompt cb\n"); + KindlingConnection *conn = KINDLING_CONNECTION(user_data); + TpBaseConnection *base_conn = TP_BASE_CONNECTION(conn); + KindlingConnectionPrivate *priv = KINDLING_CONNECTION_GET_PRIVATE(conn); + const GString *password; + GError *error = NULL; + + password = tp_simple_password_manager_prompt_finish (TP_SIMPLE_PASSWORD_MANAGER(source), + result, &error); + if (error != NULL) { + g_printf("error %s", error->message); + if (base_conn->status != TP_CONNECTION_STATUS_DISCONNECTED) { + _connection_disconnect_with_gerror(conn, + TP_CONNECTION_STATUS_REASON_AUTHENTICATION_FAILED, + "debug-message", + error); + } + g_error_free(error); + return; + } + + g_free(priv->password); + priv->password = g_strdup(password->str); + + _start_connecting_continue(conn); +} + +static gboolean _iface_start_connecting(TpBaseConnection *self, GError **error) { + g_printf("connection connect \n"); + KindlingConnectionPrivate *priv = KINDLING_CONNECTION_GET_PRIVATE(self); + TpHandleRepoIface *contact_handles = tp_base_connection_get_handles (self, TP_HANDLE_TYPE_CONTACT); + self->self_handle = tp_handle_ensure(contact_handles, priv->username, NULL, error); + if (!self->self_handle) { + return FALSE; + } + tp_base_connection_change_status(self, TP_CONNECTION_STATUS_CONNECTING, + TP_CONNECTION_STATUS_REASON_REQUESTED); + + + tp_simple_password_manager_prompt_async (priv->password_manager, + _password_prompt_cb, self); + return TRUE; +} + +static void _iface_shut_down(TpBaseConnection *self) { + g_printf("connection shut down\n"); +} + +static void _print_status_cb (TpBaseConnection *self) { + g_printf("Status is : %d\n", self->status); +} + +static void +kindling_connection_class_init (KindlingConnectionClass *klass) +{ + GParamSpec *param_spec; + g_printf("inited kindling connection class\n"); + GObjectClass* object_class = G_OBJECT_CLASS (klass); + TpBaseConnectionClass* parent_class = TP_BASE_CONNECTION_CLASS (klass); + + g_type_class_add_private (klass, sizeof(KindlingConnectionPrivate)); + object_class->set_property = kindling_connection_set_property; + object_class->get_property = kindling_connection_get_property; + object_class->constructed = kindling_connection_constructed; + object_class->finalize = kindling_connection_finalize; + object_class->dispose = kindling_connection_dispose; + + parent_class->create_handle_repos = _iface_create_handle_repos; + parent_class->create_channel_managers = _iface_create_channel_managers; + parent_class->start_connecting = _iface_start_connecting; + parent_class->shut_down = _iface_shut_down; + parent_class->interfaces_always_present = interfaces_always_present; + parent_class->connecting = _print_status_cb; + parent_class->connected = _print_status_cb; + parent_class->disconnected = _print_status_cb; + + param_spec = g_param_spec_string ("server", "server", "campfire server to connect to",NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS); + g_object_class_install_property (object_class, PROP_SERVER, param_spec); + param_spec = g_param_spec_string ("username", "username", "campfire user to auth with",NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS); + g_object_class_install_property (object_class, PROP_USERNAME, param_spec); + param_spec = g_param_spec_string ("password", "password", "campfire password to auth with",NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS); + g_object_class_install_property (object_class, PROP_PASSWORD, param_spec); +} + diff --git a/src/kindling-connection.c~ b/src/kindling-connection.c~ new file mode 100644 index 0000000..00d4f73 --- /dev/null +++ b/src/kindling-connection.c~ @@ -0,0 +1,330 @@ +/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */ +/* + * telepathy-kindling + * Copyright (C) Joe Barnett 2012 <jbarnett@taplop> + * +telepathy-kindling 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 3 of the License, or + * (at your option) any later version. + * + * telepathy-kindling is distributed in the hope that 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, see <http://www.gnu.org/licenses/>."; + */ +#include "kindling-connection.h" +#include "kindling-muc-manager.h" +#include <telepathy-glib/interfaces.h> +#include <telepathy-glib/handle-repo-dynamic.h> +#include <telepathy-glib/simple-password-manager.h> +#include <telepathy-glib/telepathy-glib.h> +#include <libsoup/soup.h> +#include <json-glib/json-glib.h> + +G_DEFINE_TYPE (KindlingConnection, kindling_connection, TP_TYPE_BASE_CONNECTION); + +static const gchar * interfaces_always_present[] = { + TP_IFACE_CONNECTION_INTERFACE_ALIASING, + TP_IFACE_CONNECTION_INTERFACE_CONTACT_INFO, + TP_IFACE_CONNECTION_INTERFACE_REQUESTS, + TP_IFACE_CONNECTION_INTERFACE_CONTACTS, + NULL}; + +const gchar * const *kindling_connection_get_implemented_interfaces (void) { + /* we don't have any conditionally-implemented interfaces yet */ + return interfaces_always_present; +} + +enum { + PROP_SERVER = 1, + PROP_USERNAME, + PROP_PASSWORD, + LAST_PROPERTY_ENUM +}; + +typedef struct _KindlingConnectionPrivate KindlingConnectionPrivate; +struct _KindlingConnectionPrivate { + char *server; + char *username; + char *password; + char *api_token; + + //for actual auth + TpSimplePasswordManager *password_manager; + SoupSession *soup_session; + gulong soup_auth_cb_handle; +}; + +#define KINDLING_CONNECTION_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE((o), KINDLING_TYPE_CONNECTION, KindlingConnectionPrivate)) + +static void kindling_connection_set_property(GObject *obj, guint prop_id, const GValue *value, GParamSpec *pspec) { + g_printf("connection set prop %d\n", prop_id); + KindlingConnectionPrivate *priv = KINDLING_CONNECTION_GET_PRIVATE(obj); + switch (prop_id) { + case PROP_SERVER: + g_free(priv->server); + priv->server = g_value_dup_string(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; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID(obj, prop_id, pspec); + break; + } +} + +static void kindling_connection_get_property(GObject *obj, guint prop_id, GValue *value, GParamSpec *pspec) { + g_printf("connection get prop %d\n", prop_id); + KindlingConnectionPrivate *priv = KINDLING_CONNECTION_GET_PRIVATE(obj); + switch (prop_id) { + case PROP_SERVER: + g_value_set_string(value, priv->server); + break; + case PROP_USERNAME: + g_value_set_string(value, priv->username); + break; + case PROP_PASSWORD: + g_value_set_string(value, priv->password); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID(obj, prop_id, pspec); + break; + } + +} + +static void +kindling_connection_init (KindlingConnection *kindling_connection) { + g_printf("connection init\n"); +} + +static void _soup_authenticate_cb(SoupSession *session, + SoupMessage *msg, + SoupAuth *auth, + gboolean retrying, + gpointer user_data) { + g_printf("soup authenitcate\n"); + KindlingConnectionPrivate *priv = KINDLING_CONNECTION_GET_PRIVATE(user_data); + if (!retrying) { + soup_auth_authenticate(auth, priv->username, priv->password); + } + +} + +static void kindling_connection_constructed (GObject *object) { + g_printf("connection constructed\n"); + KindlingConnectionPrivate *priv = KINDLING_CONNECTION_GET_PRIVATE(object); + priv->soup_session = soup_session_async_new(); + + priv->soup_auth_cb_handle = g_signal_connect(priv->soup_session, + "authenticate", + _soup_authenticate_cb, + object); + /* TODO: Add initialization code here */ +} + +static void +kindling_connection_finalize (GObject *object) { + /* TODO: Add deinitalization code here */ + KindlingConnectionPrivate *priv = KINDLING_CONNECTION_GET_PRIVATE(object); + g_free(priv->server); + g_free(priv->username); + g_free(priv->password); + g_free(priv->api_token); + + g_signal_handler_disconnect(priv->soup_session, priv->soup_auth_cb_handle); + g_object_unref(priv->soup_session); + g_printf("finalize kindling connection object\n"); + G_OBJECT_CLASS (kindling_connection_parent_class)->finalize (object); +} + + +static void _iface_create_handle_repos(TpBaseConnection *self, TpHandleRepoIface **repos) { + g_printf("connection create handle repos\n"); + int i; + for (i = 0; i < NUM_TP_HANDLE_TYPES; i++) { + repos[i] = NULL; + } + repos[TP_HANDLE_TYPE_CONTACT] = (TpHandleRepoIface *) g_object_new(TP_TYPE_DYNAMIC_HANDLE_REPO, + "handle-type", TP_HANDLE_TYPE_CONTACT, + NULL); + repos[TP_HANDLE_TYPE_ROOM] = (TpHandleRepoIface *) g_object_new(TP_TYPE_DYNAMIC_HANDLE_REPO, + "handle-type", TP_HANDLE_TYPE_ROOM, + NULL); +} + +static GPtrArray *_iface_create_channel_managers(TpBaseConnection *self) { + g_printf("connection create chan manager\n"); + KindlingConnectionPrivate *priv = KINDLING_CONNECTION_GET_PRIVATE(self); + GPtrArray *managers = g_ptr_array_sized_new (1); + g_ptr_array_add (managers, g_object_new (KINDLING_TYPE_MUC_MANAGER, + // "connection", self, + NULL)); + priv->password_manager = tp_simple_password_manager_new(self); + g_ptr_array_add(managers, priv->password_manager); + return managers; +} + +static void _connection_disconnect_with_gerror(KindlingConnection *conn, TpConnectionStatusReason reason, const gchar *key, const GError *error) { + g_printf("disconnect w/ error\n"); + GHashTable *details = tp_asv_new(key, G_TYPE_STRING, error->message, NULL); + + tp_base_connection_disconnect_with_dbus_error(TP_BASE_CONNECTION(conn), + tp_error_get_dbus_name(error->code), + details, + reason); + g_hash_table_unref(details); +} +static void +_soup_get_user_cb (SoupSession *session, SoupMessage *msg, gpointer user_data) { + g_printf("got user req soup callback %d : %s\n", msg->status_code , msg->response_body->data); + KindlingConnection *conn = KINDLING_CONNECTION(user_data); + TpBaseConnection *base_conn = TP_BASE_CONNECTION(conn); + KindlingConnectionPrivate *priv = KINDLING_CONNECTION_GET_PRIVATE(conn); + JsonParser *parser = json_parser_new(); + GError *error = NULL; + json_parser_load_from_data(parser, msg->response_body->data, -1, &error); + if (error != NULL) { + g_printf("error %s", error->message); + if (base_conn->status != TP_CONNECTION_STATUS_DISCONNECTED) { + _connection_disconnect_with_gerror(conn, + TP_CONNECTION_STATUS_REASON_AUTHENTICATION_FAILED, + "debug-message", + error); + } + g_error_free(error); + g_object_unref (parser); + return; + } + JsonReader *reader = json_reader_new(json_parser_get_root (parser)); + json_reader_read_member (reader, "user"); + json_reader_read_member (reader, "api_auth_token"); + g_free(priv->api_token); + priv->api_token = g_strdup(json_reader_get_string_value(reader)); + g_object_unref (reader); + g_object_unref (parser); + + if (priv->api_token == NULL) { + if (base_conn->status != TP_CONNECTION_STATUS_DISCONNECTED) { + GError *error = g_error_new_literal(TP_ERRORS, 1, "no api token"); + + _connection_disconnect_with_gerror(conn, + TP_CONNECTION_STATUS_REASON_AUTHENTICATION_FAILED, + "debug-message", + error); + g_error_free(error); + + } + } + + tp_base_connection_change_status (base_conn, TP_CONNECTION_STATUS_CONNECTED, TP_CONNECTION_STATUS_REASON_REQUESTED); +} + +static void _start_connecting_continue(KindlingConnection *self) { + KindlingConnectionPrivate *priv = KINDLING_CONNECTION_GET_PRIVATE(self); + g_printf("continue connecting to %s with user name %s\n", priv->server, priv->username); + + + gchar *message = g_strdup_printf("https://%s.campfirenow.com/users/me.json", priv->server); + g_printf("continue connecting to %s\n", message); + SoupMessage *msg = soup_message_new("GET", message); + g_free(message); + //tp_base_connection_change_status (TP_BASE_CONNECTION(self), TP_CONNECTION_STATUS_CONNECTED, TP_CONNECTION_STATUS_REASON_REQUESTED); + soup_session_queue_message(priv->soup_session, msg, _soup_get_user_cb, self); +} + +static void _password_prompt_cb (GObject *source, GAsyncResult *result, gpointer user_data) { + g_printf("prompt cb\n"); + KindlingConnection *conn = KINDLING_CONNECTION(user_data); + TpBaseConnection *base_conn = TP_BASE_CONNECTION(conn); + KindlingConnectionPrivate *priv = KINDLING_CONNECTION_GET_PRIVATE(conn); + const GString *password; + GError *error = NULL; + + password = tp_simple_password_manager_prompt_finish (TP_SIMPLE_PASSWORD_MANAGER(source), + result, &error); + if (error != NULL) { + g_printf("error %s", error->message); + if (base_conn->status != TP_CONNECTION_STATUS_DISCONNECTED) { + _connection_disconnect_with_gerror(conn, + TP_CONNECTION_STATUS_REASON_AUTHENTICATION_FAILED, + "debug-message", + error); + } + g_error_free(error); + return; + } + + g_free(priv->password); + priv->password = g_strdup(password->str); + + _start_connecting_continue(conn); +} + +static gboolean _iface_start_connecting(TpBaseConnection *self, GError **error) { + g_printf("connection connect \n"); + KindlingConnectionPrivate *priv = KINDLING_CONNECTION_GET_PRIVATE(self); + TpHandleRepoIface *contact_handles = tp_base_connection_get_handles (self, TP_HANDLE_TYPE_CONTACT); + self->self_handle = tp_handle_ensure(contact_handles, priv->username, NULL, error); + if (!self->self_handle) { + return FALSE; + } + tp_base_connection_change_status(self, TP_CONNECTION_STATUS_CONNECTING, + TP_CONNECTION_STATUS_REASON_REQUESTED); + + + tp_simple_password_manager_prompt_async (priv->password_manager, + _password_prompt_cb, self); + return TRUE; +} + +static void _iface_shut_down(TpBaseConnection *self) { + g_printf("connection shut down\n"); +} + +static void _print_status_cb (TpBaseConnection *self) { + g_printf("Status is : %d\n", self->status); +} + +static void +kindling_connection_class_init (KindlingConnectionClass *klass) +{ + GParamSpec *param_spec; + g_printf("inited kindling connection class\n"); + GObjectClass* object_class = G_OBJECT_CLASS (klass); + TpBaseConnectionClass* parent_class = TP_BASE_CONNECTION_CLASS (klass); + + g_type_class_add_private (klass, sizeof(KindlingConnectionPrivate)); + object_class->set_property = kindling_connection_set_property; + object_class->get_property = kindling_connection_get_property; + object_class->constructed = kindling_connection_constructed; + object_class->finalize = kindling_connection_finalize; + object_class->dispose = kindling_connection_dispose; + + parent_class->create_handle_repos = _iface_create_handle_repos; + parent_class->create_channel_managers = _iface_create_channel_managers; + parent_class->start_connecting = _iface_start_connecting; + parent_class->shut_down = _iface_shut_down; + parent_class->interfaces_always_present = interfaces_always_present; + parent_class->connecting = _print_status_cb; + parent_class->connected = _print_status_cb; + parent_class->disconnected = _print_status_cb; + + param_spec = g_param_spec_string ("server", "server", "campfire server to connect to",NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS); + g_object_class_install_property (object_class, PROP_SERVER, param_spec); + param_spec = g_param_spec_string ("username", "username", "campfire user to auth with",NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS); + g_object_class_install_property (object_class, PROP_USERNAME, param_spec); + param_spec = g_param_spec_string ("password", "password", "campfire password to auth with",NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS); + g_object_class_install_property (object_class, PROP_PASSWORD, param_spec); +} + diff --git a/src/kindling-connection.h b/src/kindling-connection.h new file mode 100644 index 0000000..263d172 --- /dev/null +++ b/src/kindling-connection.h @@ -0,0 +1,57 @@ +/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */ +/* + * telepathy-kindling + * Copyright (C) Joe Barnett 2012 <jbarnett@taplop> + * +telepathy-kindling 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 3 of the License, or + * (at your option) any later version. + * + * telepathy-kindling is distributed in the hope that 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, see <http://www.gnu.org/licenses/>."; + */ + +#ifndef _KINDLING_CONNECTION_H_ +#define _KINDLING_CONNECTION_H_ + +#include <glib-object.h> +#include <telepathy-glib/base-protocol.h> + +G_BEGIN_DECLS + +#define KINDLING_TYPE_CONNECTION (kindling_connection_get_type ()) +#define KINDLING_CONNECTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), KINDLING_TYPE_CONNECTION, KindlingConnection)) +#define KINDLING_CONNECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), KINDLING_TYPE_CONNECTION, KindlingConnectionClass)) +#define KINDLING_IS_CONNECTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), KINDLING_TYPE_CONNECTION)) +#define KINDLING_IS_CONNECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), KINDLING_TYPE_CONNECTION)) +#define KINDLING_CONNECTION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), KINDLING_TYPE_CONNECTION, KindlingConnectionClass)) + +typedef struct _KindlingConnectionClass KindlingConnectionClass; +typedef struct _KindlingConnection KindlingConnection; + + + +struct _KindlingConnectionClass +{ + TpBaseConnectionClass parent_class; +}; + +struct _KindlingConnection +{ + TpBaseConnection parent_instance; + + +}; + +GType kindling_connection_get_type (void) G_GNUC_CONST; +const gchar * const *kindling_connection_get_implemented_interfaces (void); + +G_END_DECLS + +#endif /* _KINDLING_CONNECTION_H_ */ diff --git a/src/kindling-connection.h~ b/src/kindling-connection.h~ new file mode 100644 index 0000000..3331211 --- /dev/null +++ b/src/kindling-connection.h~ @@ -0,0 +1,58 @@ +/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */ +/* + * telepathy-kindling + * Copyright (C) Joe Barnett 2012 <jbarnett@taplop> + * +telepathy-kindling 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 3 of the License, or + * (at your option) any later version. + * + * telepathy-kindling is distributed in the hope that 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, see <http://www.gnu.org/licenses/>."; + */ + +#ifndef _KINDLING_CONNECTION_H_ +#define _KINDLING_CONNECTION_H_ + +#include <glib-object.h> +#include <telepathy-glib/base-protocol.h> +#include <libsoup/soup.h> + +G_BEGIN_DECLS + +#define KINDLING_TYPE_CONNECTION (kindling_connection_get_type ()) +#define KINDLING_CONNECTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), KINDLING_TYPE_CONNECTION, KindlingConnection)) +#define KINDLING_CONNECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), KINDLING_TYPE_CONNECTION, KindlingConnectionClass)) +#define KINDLING_IS_CONNECTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), KINDLING_TYPE_CONNECTION)) +#define KINDLING_IS_CONNECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), KINDLING_TYPE_CONNECTION)) +#define KINDLING_CONNECTION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), KINDLING_TYPE_CONNECTION, KindlingConnectionClass)) + +typedef struct _KindlingConnectionClass KindlingConnectionClass; +typedef struct _KindlingConnection KindlingConnection; + + + +struct _KindlingConnectionClass +{ + TpBaseConnectionClass parent_class; +}; + +struct _KindlingConnection +{ + TpBaseConnection parent_instance; + + +}; + +GType kindling_connection_get_type (void) G_GNUC_CONST; +const gchar * const *kindling_connection_get_implemented_interfaces (void); + +G_END_DECLS + +#endif /* _KINDLING_CONNECTION_H_ */ diff --git a/src/kindling-muc-manager.c b/src/kindling-muc-manager.c new file mode 100644 index 0000000..eb7be5f --- /dev/null +++ b/src/kindling-muc-manager.c @@ -0,0 +1,56 @@ +/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */ +/* + * telepathy-kindling + * Copyright (C) Joe Barnett 2012 <jbarnett@taplop> + * +telepathy-kindling 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 3 of the License, or + * (at your option) any later version. + * + * telepathy-kindling is distributed in the hope that 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, see <http://www.gnu.org/licenses/>."; + */ + +#include "kindling-muc-manager.h" +#include <telepathy-glib/channel-manager.h> + +static void _muc_manager_iface_init(gpointer, gpointer); + + +G_DEFINE_TYPE_WITH_CODE (KindlingMUCManager, kindling_muc_manager, G_TYPE_OBJECT, + G_IMPLEMENT_INTERFACE(TP_TYPE_CHANNEL_MANAGER, _muc_manager_iface_init)); + +static void +kindling_muc_manager_init (KindlingMUCManager *kindling_muc_manager) +{ + + + /* TODO: Add initialization code here */ +} + +static void +kindling_muc_manager_finalize (GObject *object) +{ + /* TODO: Add deinitalization code here */ + + G_OBJECT_CLASS (kindling_muc_manager_parent_class)->finalize (object); +} + +static void +kindling_muc_manager_class_init (KindlingMUCManagerClass *klass) +{ + GObjectClass* object_class = G_OBJECT_CLASS (klass); + GObjectClass* parent_class = G_OBJECT_CLASS (klass); + + object_class->finalize = kindling_muc_manager_finalize; +} + +static void _muc_manager_iface_init(gpointer g_iface, gpointer iface_data) { + TpChannelManagerIface *iface = g_iface; +} diff --git a/src/kindling-muc-manager.h b/src/kindling-muc-manager.h new file mode 100644 index 0000000..5a9d357 --- /dev/null +++ b/src/kindling-muc-manager.h @@ -0,0 +1,55 @@ +/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */ +/* + * telepathy-kindling + * Copyright (C) Joe Barnett 2012 <jbarnett@taplop> + * +telepathy-kindling 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 3 of the License, or + * (at your option) any later version. + * + * telepathy-kindling is distributed in the hope that 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, see <http://www.gnu.org/licenses/>."; + */ + +#ifndef _KINDLING_MUC_MANAGER_H_ +#define _KINDLING_MUC_MANAGER_H_ + +#include <glib-object.h> + +G_BEGIN_DECLS + +#define KINDLING_TYPE_MUC_MANAGER (kindling_muc_manager_get_type ()) +#define KINDLING_MUC_MANAGER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), KINDLING_TYPE_MUC_MANAGER, KindlingMUCManager)) +#define KINDLING_MUC_MANAGER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), KINDLING_TYPE_MUC_MANAGER, KindlingMUCManagerClass)) +#define KINDLING_IS_MUC_MANAGER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), KINDLING_TYPE_MUC_MANAGER)) +#define KINDLING_IS_MUC_MANAGER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), KINDLING_TYPE_MUC_MANAGER)) +#define KINDLING_MUC_MANAGER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), KINDLING_TYPE_MUC_MANAGER, KindlingMUCManagerClass)) + +typedef struct _KindlingMUCManagerClass KindlingMUCManagerClass; +typedef struct _KindlingMUCManager KindlingMUCManager; + + + +struct _KindlingMUCManagerClass +{ + GObjectClass parent_class; +}; + +struct _KindlingMUCManager +{ + GObject parent_instance; + + +}; + +GType kindling_muc_manager_get_type (void) G_GNUC_CONST; + +G_END_DECLS + +#endif /* _KINDLING_MUC_MANAGER_H_ */ diff --git a/src/kindling-protocol.c b/src/kindling-protocol.c new file mode 100644 index 0000000..e252828 --- /dev/null +++ b/src/kindling-protocol.c @@ -0,0 +1,152 @@ +/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */ +/* + * telepathy-kindling + * Copyright (C) Joe Barnett 2012 <jbarnett@taplop> + * +telepathy-kindling 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 3 of the License, or + * (at your option) any later version. + * + * telepathy-kindling is distributed in the hope that 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, see <http://www.gnu.org/licenses/>."; + */ +#include "kindling-protocol.h" +#include "kindling-connection.h" +#include "kindling-muc-manager.h" + + +#include <dbus/dbus-glib.h> +#include <dbus/dbus-protocol.h> +#include <telepathy-glib/base-connection-manager.h> +#include <telepathy-glib/telepathy-glib.h> + +#define ICON_NAME "im-irc" +#define ENGLISH_NAME "Campfire" +#define VCARD_FIELD_NAME "x-" CAMPFIRE_PROTOCOL_NAME + + +G_DEFINE_TYPE (KindlingProtocol, kindling_protocol, TP_TYPE_BASE_PROTOCOL); + +static void +kindling_protocol_init (KindlingProtocol *kindling_protocol) +{ + + g_printf("inited kindling protocol\n"); + + /* TODO: Add initialization code here */ +} + +static void +kindling_protocol_finalize (GObject *object) +{ + /* TODO: Add deinitalization code here */ + g_printf("finalize kindling protocol object\n"); + + G_OBJECT_CLASS (kindling_protocol_parent_class)->finalize (object); +} + +static const TpCMParamSpec kindling_params[] = { + {"server", DBUS_TYPE_STRING_AS_STRING, G_TYPE_STRING, TP_CONN_MGR_PARAM_FLAG_REQUIRED, NULL, 0, NULL, NULL, (gpointer)"server", NULL}, + {"username", DBUS_TYPE_STRING_AS_STRING, G_TYPE_STRING, TP_CONN_MGR_PARAM_FLAG_REQUIRED, NULL, 0, NULL, NULL, (gpointer)"username", NULL}, + {"password", DBUS_TYPE_STRING_AS_STRING, G_TYPE_STRING, TP_CONN_MGR_PARAM_FLAG_SECRET, NULL, 0, NULL, NULL, (gpointer)"password", NULL}, + {NULL,NULL,0,0,NULL,0, NULL, NULL,NULL,NULL} +}; + +static const TpCMParamSpec * get_parameters(TpBaseProtocol *self) { + g_printf("protocol get parameters\n"); + return kindling_params; +} + +static TpBaseConnection * +new_connection (TpBaseProtocol *protocol, GHashTable *params, GError **error) { + g_printf("protocol get new connection %s\n", tp_asv_get_string(params, "abc")); + return g_object_new (KINDLING_TYPE_CONNECTION, + "protocol", CAMPFIRE_PROTOCOL_NAME, + "server", tp_asv_get_string(params, "server"), + "username", tp_asv_get_string(params, "username"), + "password", tp_asv_get_string(params, "password"), + NULL); +} + +static void get_connection_details(TpBaseProtocol *self, + GStrv *connection_interfaces, + GType **channel_managers, + gchar **icon_name, + char **english_name, + gchar **vcard_field) { + g_printf("called get details\n"); + if (connection_interfaces != NULL) { + *connection_interfaces = g_strdupv((GStrv) kindling_connection_get_implemented_interfaces()); + } + if (channel_managers != NULL) { + GType types[] = { + KINDLING_TYPE_MUC_MANAGER, + G_TYPE_INVALID }; + *channel_managers = g_memdup(types, sizeof(types)); + } + if (icon_name != NULL) { + *icon_name = g_strdup (ICON_NAME); + } + if (vcard_field != NULL) { + *vcard_field = g_strdup (VCARD_FIELD_NAME); + } + if (english_name != NULL) { + *english_name = g_strdup (ENGLISH_NAME); + } + +} + +static GStrv +dup_authentication_types (TpBaseProtocol *base) { + g_printf("duping auth types\n"); + const gchar * const types [] = { + TP_IFACE_CHANNEL_INTERFACE_SASL_AUTHENTICATION, NULL, }; + return g_strdupv((GStrv)types); +} + +static gchar *normalize_contact(TpBaseProtocol *self, const gchar *contact, GError **error) { + g_printf("normalizing contact\n"); + return g_strdupv(contact); +} + +static char *identify_account(TpBaseProtocol *self, GHashTable *asv, GError **error) { + g_printf("identing account\n"); + gchar *nick = g_strdupv(tp_asv_get_string(asv, "username")); + gchar *server = g_strdupv(tp_asv_get_string(asv, "server")); + gchar *nick_at_server = g_strdup_printf("%s@%s", nick, server); + g_free(server); + g_free(nick); + return nick_at_server; +} + +static GStrv +get_interfaces (TpBaseProtocol *self) +{ + g_printf("get interfaces\n"); + return g_new0 (gchar *, 1); +} + + +static void +kindling_protocol_class_init (KindlingProtocolClass *klass) +{ + g_printf("inited kindling protocol class\n"); + GObjectClass* object_class = G_OBJECT_CLASS (klass); + TpBaseProtocolClass* parent_class = TP_BASE_PROTOCOL_CLASS (klass); + parent_class->new_connection = new_connection; + parent_class->get_parameters = get_parameters; + parent_class->get_connection_details = get_connection_details; + parent_class->normalize_contact = normalize_contact; + parent_class->identify_account = identify_account; + parent_class->dup_authentication_types = dup_authentication_types; + parent_class->get_interfaces = get_interfaces; + + object_class->finalize = kindling_protocol_finalize; +} + diff --git a/src/kindling-protocol.c~ b/src/kindling-protocol.c~ new file mode 100644 index 0000000..d495c09 --- /dev/null +++ b/src/kindling-protocol.c~ @@ -0,0 +1,152 @@ +/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */ +/* + * telepathy-kindling + * Copyright (C) Joe Barnett 2012 <jbarnett@taplop> + * +telepathy-kindling 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 3 of the License, or + * (at your option) any later version. + * + * telepathy-kindling is distributed in the hope that 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, see <http://www.gnu.org/licenses/>."; + */ +#include "kindling-protocol.h" +#include "kindling-connection.h" +#include "kindling-muc-manager.h" + + +#include <dbus/dbus-glib.h> +#include <dbus/dbus-protocol.h> +#include <telepathy-glib/base-connection-manager.h> +#include <telepathy-glib/telepathy-glib.h> + +#define ICON_NAME "im-irc" +#define ENGLISH_NAME "Campfire" +#define VCARD_FIELD_NAME "x-" CAMPFIRE_PROTOCOL_NAME + + +G_DEFINE_TYPE (KindlingProtocol, kindling_protocol, TP_TYPE_BASE_PROTOCOL); + +static void +kindling_protocol_init (KindlingProtocol *kindling_protocol) +{ + + g_printf("inited kindling protocol\n"); + + /* TODO: Add initialization code here */ +} + +static void +kindling_protocol_finalize (GObject *object) +{ + /* TODO: Add deinitalization code here */ + g_printf("finalize kindling protocol object\n"); + + G_OBJECT_CLASS (kindling_protocol_parent_class)->finalize (object); +} + +static const TpCMParamSpec kindling_params[] = { + {"server", DBUS_TYPE_STRING_AS_STRING, G_TYPE_STRING, TP_CONN_MGR_PARAM_FLAG_REQUIRED, NULL, 0, NULL, NULL, (gpointer)"server", NULL}, + {"username", DBUS_TYPE_STRING_AS_STRING, G_TYPE_STRING, TP_CONN_MGR_PARAM_FLAG_REQUIRED, NULL, 0, NULL, NULL, (gpointer)"username", NULL}, + {"password", DBUS_TYPE_STRING_AS_STRING, G_TYPE_STRING, TP_CONN_MGR_PARAM_FLAG_SECRET, NULL, 0, NULL, NULL, (gpointer)"password", NULL}, + {NULL,NULL,0,0,NULL,0} +}; + +static const TpCMParamSpec * get_parameters(TpBaseProtocol *self) { + g_printf("protocol get parameters\n"); + return kindling_params; +} + +static TpBaseConnection * +new_connection (TpBaseProtocol *protocol, GHashTable *params, GError **error) { + g_printf("protocol get new connection %s\n", tp_asv_get_string(params, "abc")); + return g_object_new (KINDLING_TYPE_CONNECTION, + "protocol", CAMPFIRE_PROTOCOL_NAME, + "server", tp_asv_get_string(params, "server"), + "username", tp_asv_get_string(params, "username"), + "password", tp_asv_get_string(params, "password"), + NULL); +} + +static void get_connection_details(TpBaseProtocol *self, + GStrv *connection_interfaces, + GType **channel_managers, + gchar **icon_name, + char **english_name, + gchar **vcard_field) { + g_printf("called get details\n"); + if (connection_interfaces != NULL) { + *connection_interfaces = g_strdupv((GStrv) kindling_connection_get_implemented_interfaces()); + } + if (channel_managers != NULL) { + GType types[] = { + KINDLING_TYPE_MUC_MANAGER, + G_TYPE_INVALID }; + *channel_managers = g_memdup(types, sizeof(types)); + } + if (icon_name != NULL) { + *icon_name = g_strdup (ICON_NAME); + } + if (vcard_field != NULL) { + *vcard_field = g_strdup (VCARD_FIELD_NAME); + } + if (english_name != NULL) { + *english_name = g_strdup (ENGLISH_NAME); + } + +} + +static GStrv +dup_authentication_types (TpBaseProtocol *base) { + g_printf("duping auth types\n"); + const gchar * const types [] = { + TP_IFACE_CHANNEL_INTERFACE_SASL_AUTHENTICATION, NULL, }; + return g_strdupv((GStrv)types); +} + +static gchar *normalize_contact(TpBaseProtocol *self, const gchar *contact, GError **error) { + g_printf("normalizing contact\n"); + return g_strdupv(contact); +} + +static char *identify_account(TpBaseProtocol *self, GHashTable *asv, GError **error) { + g_printf("identing account\n"); + gchar *nick = g_strdupv(tp_asv_get_string(asv, "username")); + gchar *server = g_strdupv(tp_asv_get_string(asv, "server")); + gchar *nick_at_server = g_strdup_printf("%s@%s", nick, server); + g_free(server); + g_free(nick); + return nick_at_server; +} + +static GStrv +get_interfaces (TpBaseProtocol *self) +{ + g_printf("get interfaces\n"); + return g_new0 (gchar *, 1); +} + + +static void +kindling_protocol_class_init (KindlingProtocolClass *klass) +{ + g_printf("inited kindling protocol class\n"); + GObjectClass* object_class = G_OBJECT_CLASS (klass); + TpBaseProtocolClass* parent_class = TP_BASE_PROTOCOL_CLASS (klass); + parent_class->new_connection = new_connection; + parent_class->get_parameters = get_parameters; + parent_class->get_connection_details = get_connection_details; + parent_class->normalize_contact = normalize_contact; + parent_class->identify_account = identify_account; + parent_class->dup_authentication_types = dup_authentication_types; + parent_class->get_interfaces = get_interfaces; + + object_class->finalize = kindling_protocol_finalize; +} + diff --git a/src/kindling-protocol.h b/src/kindling-protocol.h new file mode 100644 index 0000000..eb5cdd3 --- /dev/null +++ b/src/kindling-protocol.h @@ -0,0 +1,58 @@ +/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */ +/* + * telepathy-kindling + * Copyright (C) Joe Barnett 2012 <jbarnett@taplop> + * +telepathy-kindling 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 3 of the License, or + * (at your option) any later version. + * + * telepathy-kindling is distributed in the hope that 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, see <http://www.gnu.org/licenses/>."; + */ + +#ifndef _KINDLING_PROTOCOL_H_ +#define _KINDLING_PROTOCOL_H_ + +#include <glib-object.h> +#include <telepathy-glib/base-protocol.h> + +#define CAMPFIRE_PROTOCOL_NAME "campfire" + +G_BEGIN_DECLS + +#define KINDLING_TYPE_PROTOCOL (kindling_protocol_get_type ()) +#define KINDLING_PROTOCOL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), KINDLING_TYPE_PROTOCOL, KindlingProtocol)) +#define KINDLING_PROTOCOL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), KINDLING_TYPE_PROTOCOL, KindlingProtocolClass)) +#define KINDLING_IS_PROTOCOL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), KINDLING_TYPE_PROTOCOL)) +#define KINDLING_IS_PROTOCOL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), KINDLING_TYPE_PROTOCOL)) +#define KINDLING_PROTOCOL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), KINDLING_TYPE_PROTOCOL, KindlingProtocolClass)) + +typedef struct _KindlingProtocolClass KindlingProtocolClass; +typedef struct _KindlingProtocol KindlingProtocol; + + + +struct _KindlingProtocolClass +{ + TpBaseProtocolClass parent_class; +}; + +struct _KindlingProtocol +{ + TpBaseProtocol parent_instance; + + +}; + +GType kindling_protocol_get_type (void) G_GNUC_CONST; + +G_END_DECLS + +#endif /* _KINDLING_PROTOCOL_H_ */ diff --git a/src/main.c b/src/main.c new file mode 100644 index 0000000..0018257 --- /dev/null +++ b/src/main.c @@ -0,0 +1,37 @@ +/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */ +/* + * telepathy-kindling + * Copyright (C) Joe Barnett 2012 <jbarnett@taplop> + * +telepathy-kindling 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 3 of the License, or + * (at your option) any later version. + * + * telepathy-kindling is distributed in the hope that 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, see <http://www.gnu.org/licenses/>."; + */ +#include <config.h> +#include <telepathy-glib/run.h> + +#include "kindling-connection-manager.h" + +static TpBaseConnectionManager *_construct_cm() { + TpBaseConnectionManager *base_cm = TP_BASE_CONNECTION_MANAGER(g_object_new(KINDLING_TYPE_CONNECTION_MANAGER, NULL)); + return base_cm; +} + + +int +main (int argc, char *argv[]) +{ + int result; + g_type_init(); + result = tp_run_connection_manager("telepathy-kindling", VERSION, _construct_cm, argc, argv); + return result; +} diff --git a/telepathy_kindling.anjuta b/telepathy_kindling.anjuta new file mode 100644 index 0000000..68c60e6 --- /dev/null +++ b/telepathy_kindling.anjuta @@ -0,0 +1,51 @@ +<?xml version="1.0"?> +<anjuta> + <plugin name="GBF Project Manager" + url="http://anjuta.org/plugins/" + mandatory="yes"> + <require group="Anjuta Plugin" + attribute="Interfaces" + value="IAnjutaProjectManager"/> + </plugin> + <plugin name="AutoTools Project Backend" + url="http://anjuta.org/plugins/" + mandatory="yes"> + <require group="Anjuta Plugin" + attribute="Interfaces" + value="IAnjutaProjectBackend"/> + <require group="Project" + attribute="Supported-Project-Types" + value="automake"/> + </plugin> + <plugin name="Symbol Browser" + url="http://anjuta.org/plugins/" + mandatory="yes"> + <require group="Anjuta Plugin" + attribute="Interfaces" + value="IAnjutaSymbolManager"/> + </plugin> + <plugin name="Make Build System" + url="http://anjuta.org/plugins/" + mandatory="yes"> + <require group="Anjuta Plugin" + attribute="Interfaces" + value="IAnjutaBuildable"/> + <require group="Build" + attribute="Supported-Build-Types" + value="make"/> + </plugin> + <plugin name="Task Manager" + url="http://anjuta.org/plugins/" + mandatory="no"> + <require group="Anjuta Plugin" + attribute="Interfaces" + value="IAnjutaTodo"/> + </plugin> + <plugin name="Debug Manager" + url="http://anjuta.org/plugins/" + mandatory="no"> + <require group="Anjuta Plugin" + attribute="Interfaces" + value="IAnjutaDebugManager"/> + </plugin> +</anjuta> |