diff -urNad telepathy-sharp-0.0.svn.20060831/aclocal.m4 telepathy-sharp-0.0.svn.20070221/aclocal.m4 --- telepathy-sharp-0.0.svn.20060831/aclocal.m4 2006-09-25 20:34:14.000000000 +0200 +++ telepathy-sharp-0.0.svn.20070221/aclocal.m4 2007-02-21 21:16:00.000000000 +0100 @@ -11,6 +11,164 @@ # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. +# pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*- +# +# Copyright © 2004 Scott James Remnant . +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +# PKG_PROG_PKG_CONFIG([MIN-VERSION]) +# ---------------------------------- +AC_DEFUN([PKG_PROG_PKG_CONFIG], +[m4_pattern_forbid([^_?PKG_[A-Z_]+$]) +m4_pattern_allow([^PKG_CONFIG(_PATH)?$]) +AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])dnl +if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then + AC_PATH_TOOL([PKG_CONFIG], [pkg-config]) +fi +if test -n "$PKG_CONFIG"; then + _pkg_min_version=m4_default([$1], [0.9.0]) + AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version]) + if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then + AC_MSG_RESULT([yes]) + else + AC_MSG_RESULT([no]) + PKG_CONFIG="" + fi + +fi[]dnl +])# PKG_PROG_PKG_CONFIG + +# PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) +# +# Check to see whether a particular set of modules exists. Similar +# to PKG_CHECK_MODULES(), but does not set variables or print errors. +# +# +# Similar to PKG_CHECK_MODULES, make sure that the first instance of +# this or PKG_CHECK_MODULES is called, or make sure to call +# PKG_CHECK_EXISTS manually +# -------------------------------------------------------------- +AC_DEFUN([PKG_CHECK_EXISTS], +[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl +if test -n "$PKG_CONFIG" && \ + AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then + m4_ifval([$2], [$2], [:]) +m4_ifvaln([$3], [else + $3])dnl +fi]) + + +# _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES]) +# --------------------------------------------- +m4_define([_PKG_CONFIG], +[if test -n "$PKG_CONFIG"; then + if test -n "$$1"; then + pkg_cv_[]$1="$$1" + else + PKG_CHECK_EXISTS([$3], + [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`], + [pkg_failed=yes]) + fi +else + pkg_failed=untried +fi[]dnl +])# _PKG_CONFIG + +# _PKG_SHORT_ERRORS_SUPPORTED +# ----------------------------- +AC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED], +[AC_REQUIRE([PKG_PROG_PKG_CONFIG]) +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then + _pkg_short_errors_supported=yes +else + _pkg_short_errors_supported=no +fi[]dnl +])# _PKG_SHORT_ERRORS_SUPPORTED + + +# PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND], +# [ACTION-IF-NOT-FOUND]) +# +# +# Note that if there is a possibility the first call to +# PKG_CHECK_MODULES might not happen, you should be sure to include an +# explicit call to PKG_PROG_PKG_CONFIG in your configure.ac +# +# +# -------------------------------------------------------------- +AC_DEFUN([PKG_CHECK_MODULES], +[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl +AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl +AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl + +pkg_failed=no +AC_MSG_CHECKING([for $1]) + +_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2]) +_PKG_CONFIG([$1][_LIBS], [libs], [$2]) + +m4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS +and $1[]_LIBS to avoid the need to call pkg-config. +See the pkg-config man page for more details.]) + +if test $pkg_failed = yes; then + _PKG_SHORT_ERRORS_SUPPORTED + if test $_pkg_short_errors_supported = yes; then + $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --errors-to-stdout --print-errors "$2"` + else + $1[]_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "$2"` + fi + # Put the nasty error message in config.log where it belongs + echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD + + ifelse([$4], , [AC_MSG_ERROR(dnl +[Package requirements ($2) were not met: + +$$1_PKG_ERRORS + +Consider adjusting the PKG_CONFIG_PATH environment variable if you +installed software in a non-standard prefix. + +_PKG_TEXT +])], + [AC_MSG_RESULT([no]) + $4]) +elif test $pkg_failed = untried; then + ifelse([$4], , [AC_MSG_FAILURE(dnl +[The pkg-config script could not be found or is too old. Make sure it +is in your PATH or set the PKG_CONFIG environment variable to the full +path to pkg-config. + +_PKG_TEXT + +To get pkg-config, see .])], + [$4]) +else + $1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS + $1[]_LIBS=$pkg_cv_[]$1[]_LIBS + AC_MSG_RESULT([yes]) + ifelse([$3], , :, [$3]) +fi[]dnl +])# PKG_CHECK_MODULES + # Copyright (C) 2002, 2003, 2005 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation diff -urNad telepathy-sharp-0.0.svn.20060831/config.sub telepathy-sharp-0.0.svn.20070221/config.sub --- telepathy-sharp-0.0.svn.20060831/config.sub 2006-09-25 20:34:15.000000000 +0200 +++ telepathy-sharp-0.0.svn.20070221/config.sub 2007-02-21 21:16:21.000000000 +0100 @@ -4,7 +4,7 @@ # 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, # Inc. -timestamp='2006-07-02' +timestamp='2006-09-20' # This file is (in principle) common to ALL GNU software. # The presence of a machine in this file suggests that SOME GNU software @@ -276,6 +276,7 @@ | pdp10 | pdp11 | pj | pjl \ | powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \ | pyramid \ + | score \ | sh | sh[1234] | sh[24]a | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \ | sh64 | sh64le \ | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \ @@ -284,7 +285,7 @@ | tahoe | thumb | tic4x | tic80 | tron \ | v850 | v850e \ | we32k \ - | x86 | xscale | xscalee[bl] | xstormy16 | xtensa \ + | x86 | xc16x | xscale | xscalee[bl] | xstormy16 | xtensa \ | z8k) basic_machine=$basic_machine-unknown ;; @@ -367,7 +368,7 @@ | tron-* \ | v850-* | v850e-* | vax-* \ | we32k-* \ - | x86-* | x86_64-* | xps100-* | xscale-* | xscalee[bl]-* \ + | x86-* | x86_64-* | xc16x-* | xps100-* | xscale-* | xscalee[bl]-* \ | xstormy16-* | xtensa-* \ | ymp-* \ | z8k-*) @@ -909,6 +910,10 @@ sb1el) basic_machine=mipsisa64sb1el-unknown ;; + sde) + basic_machine=mipsisa32-sde + os=-elf + ;; sei) basic_machine=mips-sei os=-seiux @@ -1366,6 +1371,9 @@ # system, and we'll never get to this point. case $basic_machine in + score-*) + os=-elf + ;; spu-*) os=-elf ;; diff -urNad telepathy-sharp-0.0.svn.20060831/configure telepathy-sharp-0.0.svn.20070221/configure --- telepathy-sharp-0.0.svn.20060831/configure 2006-09-25 20:34:14.000000000 +0200 +++ telepathy-sharp-0.0.svn.20070221/configure 2007-02-21 21:16:07.000000000 +0100 @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.60a. +# Generated by GNU Autoconf 2.61. # # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, # 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. @@ -10,7 +10,8 @@ ## M4sh Initialization. ## ## --------------------- ## -# Be Bourne compatible +# Be more Bourne compatible +DUALCASE=1; export DUALCASE # for MKS sh if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: @@ -19,10 +20,13 @@ alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else - case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac + case `(set -o) 2>/dev/null` in + *posix*) set -o posix ;; +esac + fi -BIN_SH=xpg4; export BIN_SH # for Tru64 -DUALCASE=1; export DUALCASE # for MKS sh + + # PATH needs CR @@ -215,7 +219,7 @@ else as_candidate_shells= as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in /usr/bin/posix$PATH_SEPARATOR/bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH +for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. @@ -233,7 +237,6 @@ # Try only shells that exist, to save several forks. if { test -f "$as_shell" || test -f "$as_shell.exe"; } && { ("$as_shell") 2> /dev/null <<\_ASEOF -# Be Bourne compatible if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: @@ -242,10 +245,12 @@ alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else - case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac + case `(set -o) 2>/dev/null` in + *posix*) set -o posix ;; +esac + fi -BIN_SH=xpg4; export BIN_SH # for Tru64 -DUALCASE=1; export DUALCASE # for MKS sh + : _ASEOF @@ -253,7 +258,6 @@ CONFIG_SHELL=$as_shell as_have_required=yes if { "$as_shell" 2> /dev/null <<\_ASEOF -# Be Bourne compatible if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: @@ -262,10 +266,12 @@ alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else - case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac + case `(set -o) 2>/dev/null` in + *posix*) set -o posix ;; +esac + fi -BIN_SH=xpg4; export BIN_SH # for Tru64 -DUALCASE=1; export DUALCASE # for MKS sh + : (as_func_return () { @@ -512,19 +518,28 @@ as_mkdir_p=false fi -# Find out whether ``test -x'' works. Don't use a zero-byte file, as -# systems may use methods other than mode bits to determine executability. -cat >conf$$.file <<_ASEOF -#! /bin/sh -exit 0 -_ASEOF -chmod +x conf$$.file -if test -x conf$$.file >/dev/null 2>&1; then - as_executable_p="test -x" +if test -x / >/dev/null 2>&1; then + as_test_x='test -x' else - as_executable_p=: + if ls -dL / >/dev/null 2>&1; then + as_ls_L_option=L + else + as_ls_L_option= + fi + as_test_x=' + eval sh -c '\'' + if test -d "$1"; then + test -d "$1/."; + else + case $1 in + -*)set "./$1";; + esac; + case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in + ???[sx]*):;;*)false;;esac;fi + '\'' sh + ' fi -rm -f conf$$.file +as_executable_p=$as_test_x # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" @@ -637,14 +652,19 @@ MAINTAINER_MODE_FALSE MAINT PKG_CONFIG -MONO -MCS +MONO_DEPENDENCY_CFLAGS +MONO_DEPENDENCY_LIBS +RUNTIME +CSC LIBOBJS LTLIBOBJS' ac_subst_files='' ac_precious_vars='build_alias host_alias -target_alias' +target_alias +PKG_CONFIG +MONO_DEPENDENCY_CFLAGS +MONO_DEPENDENCY_LIBS' # Initialize some variables set by options. @@ -750,10 +770,10 @@ -disable-* | --disable-*) ac_feature=`expr "x$ac_option" : 'x-*disable-\(.*\)'` # Reject names that are not valid shell variable names. - expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null && + expr "x$ac_feature" : ".*[^-._$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid feature name: $ac_feature" >&2 { (exit 1); exit 1; }; } - ac_feature=`echo $ac_feature | sed 's/-/_/g'` + ac_feature=`echo $ac_feature | sed 's/[-.]/_/g'` eval enable_$ac_feature=no ;; -docdir | --docdir | --docdi | --doc | --do) @@ -769,10 +789,10 @@ -enable-* | --enable-*) ac_feature=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` # Reject names that are not valid shell variable names. - expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null && + expr "x$ac_feature" : ".*[^-._$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid feature name: $ac_feature" >&2 { (exit 1); exit 1; }; } - ac_feature=`echo $ac_feature | sed 's/-/_/g'` + ac_feature=`echo $ac_feature | sed 's/[-.]/_/g'` eval enable_$ac_feature=\$ac_optarg ;; -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ @@ -966,19 +986,19 @@ -with-* | --with-*) ac_package=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` # Reject names that are not valid shell variable names. - expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null && + expr "x$ac_package" : ".*[^-._$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid package name: $ac_package" >&2 { (exit 1); exit 1; }; } - ac_package=`echo $ac_package| sed 's/-/_/g'` + ac_package=`echo $ac_package | sed 's/[-.]/_/g'` eval with_$ac_package=\$ac_optarg ;; -without-* | --without-*) ac_package=`expr "x$ac_option" : 'x-*without-\(.*\)'` # Reject names that are not valid shell variable names. - expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null && + expr "x$ac_package" : ".*[^-._$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid package name: $ac_package" >&2 { (exit 1); exit 1; }; } - ac_package=`echo $ac_package | sed 's/-/_/g'` + ac_package=`echo $ac_package | sed 's/[-.]/_/g'` eval with_$ac_package=no ;; --x) @@ -1226,6 +1246,16 @@ --enable-maintainer-mode enable make rules and dependencies not useful (and sometimes confusing) to the casual installer +Some influential environment variables: + PKG_CONFIG path to pkg-config utility + MONO_DEPENDENCY_CFLAGS + C compiler flags for MONO_DEPENDENCY, overriding pkg-config + MONO_DEPENDENCY_LIBS + linker flags for MONO_DEPENDENCY, overriding pkg-config + +Use these variables to override the choices made by `configure' or to help +it to find libraries and programs with nonstandard names/locations. + _ACEOF ac_status=$? fi @@ -1287,7 +1317,7 @@ if $ac_init_version; then cat <<\_ACEOF configure -generated by GNU Autoconf 2.60a +generated by GNU Autoconf 2.61 Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. @@ -1301,7 +1331,7 @@ running configure, to aid debugging if configure makes a mistake. It was created by $as_me, which was -generated by GNU Autoconf 2.60a. Invocation command line was +generated by GNU Autoconf 2.61. Invocation command line was $ $0 $@ @@ -1803,7 +1833,7 @@ NONENONEs,x,x, && program_prefix=${target_alias}- -VERSION=0.1.0 +VERSION=0.13.2 ASM_VERSION="$VERSION.*" am__api_version="1.9" @@ -1843,7 +1873,7 @@ # by default. for ac_prog in ginstall scoinst install; do for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_executable_p "$as_dir/$ac_prog$ac_exec_ext"; }; then + if { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; }; then if test $ac_prog = install && grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # AIX install. It has an incompatible calling convention. @@ -2009,7 +2039,7 @@ IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_AWK="$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -2144,7 +2174,7 @@ IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_STRIP="${ac_tool_prefix}strip" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -2184,7 +2214,7 @@ IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_STRIP="strip" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -2284,7 +2314,7 @@ IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -2314,19 +2344,21 @@ fi +MONO_REQUIRED_VERSION=1.1.17 - -# Extract the first word of "mono", so it can be a program name with args. -set dummy mono; ac_word=$2 +if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}pkg-config", so it can be a program name with args. +set dummy ${ac_tool_prefix}pkg-config; ac_word=$2 { echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } -if test "${ac_cv_path_MONO+set}" = set; then +if test "${ac_cv_path_PKG_CONFIG+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - case $MONO in + case $PKG_CONFIG in [\\/]* | ?:[\\/]*) - ac_cv_path_MONO="$MONO" # Let the user override the test with a path. + ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR @@ -2335,8 +2367,8 @@ IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_path_MONO="$as_dir/$ac_word$ac_exec_ext" + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi @@ -2347,26 +2379,29 @@ ;; esac fi -MONO=$ac_cv_path_MONO -if test -n "$MONO"; then - { echo "$as_me:$LINENO: result: $MONO" >&5 -echo "${ECHO_T}$MONO" >&6; } +PKG_CONFIG=$ac_cv_path_PKG_CONFIG +if test -n "$PKG_CONFIG"; then + { echo "$as_me:$LINENO: result: $PKG_CONFIG" >&5 +echo "${ECHO_T}$PKG_CONFIG" >&6; } else { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } fi -# Extract the first word of "mcs", so it can be a program name with args. -set dummy mcs; ac_word=$2 +fi +if test -z "$ac_cv_path_PKG_CONFIG"; then + ac_pt_PKG_CONFIG=$PKG_CONFIG + # Extract the first word of "pkg-config", so it can be a program name with args. +set dummy pkg-config; ac_word=$2 { echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } -if test "${ac_cv_path_MCS+set}" = set; then +if test "${ac_cv_path_ac_pt_PKG_CONFIG+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - case $MCS in + case $ac_pt_PKG_CONFIG in [\\/]* | ?:[\\/]*) - ac_cv_path_MCS="$MCS" # Let the user override the test with a path. + ac_cv_path_ac_pt_PKG_CONFIG="$ac_pt_PKG_CONFIG" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR @@ -2375,8 +2410,8 @@ IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_path_MCS="$as_dir/$ac_word$ac_exec_ext" + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_path_ac_pt_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi @@ -2387,48 +2422,218 @@ ;; esac fi -MCS=$ac_cv_path_MCS -if test -n "$MCS"; then - { echo "$as_me:$LINENO: result: $MCS" >&5 -echo "${ECHO_T}$MCS" >&6; } +ac_pt_PKG_CONFIG=$ac_cv_path_ac_pt_PKG_CONFIG +if test -n "$ac_pt_PKG_CONFIG"; then + { echo "$as_me:$LINENO: result: $ac_pt_PKG_CONFIG" >&5 +echo "${ECHO_T}$ac_pt_PKG_CONFIG" >&6; } else { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } fi + if test "x$ac_pt_PKG_CONFIG" = x; then + PKG_CONFIG="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools +whose name does not start with the host triplet. If you think this +configuration is useful to you, please write to autoconf@gnu.org." >&5 +echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools +whose name does not start with the host triplet. If you think this +configuration is useful to you, please write to autoconf@gnu.org." >&2;} +ac_tool_warned=yes ;; +esac + PKG_CONFIG=$ac_pt_PKG_CONFIG + fi +else + PKG_CONFIG="$ac_cv_path_PKG_CONFIG" +fi + +fi +if test -n "$PKG_CONFIG"; then + _pkg_min_version=0.9.0 + { echo "$as_me:$LINENO: checking pkg-config is at least version $_pkg_min_version" >&5 +echo $ECHO_N "checking pkg-config is at least version $_pkg_min_version... $ECHO_C" >&6; } + if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then + { echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; } + else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } + PKG_CONFIG="" + fi +fi +pkg_failed=no +{ echo "$as_me:$LINENO: checking for MONO_DEPENDENCY" >&5 +echo $ECHO_N "checking for MONO_DEPENDENCY... $ECHO_C" >&6; } -{ echo "$as_me:$LINENO: checking for mono.pc" >&5 -echo $ECHO_N "checking for mono.pc... $ECHO_C" >&6; } -if test -z `$PKG_CONFIG --variable=prefix mono`; then - { { echo "$as_me:$LINENO: error: missing the mono.pc file, usually found in the mono-devel package" >&5 -echo "$as_me: error: missing the mono.pc file, usually found in the mono-devel package" >&2;} - { (exit 1); exit 1; }; } +if test -n "$PKG_CONFIG"; then + if test -n "$MONO_DEPENDENCY_CFLAGS"; then + pkg_cv_MONO_DEPENDENCY_CFLAGS="$MONO_DEPENDENCY_CFLAGS" + else + if test -n "$PKG_CONFIG" && \ + { (echo "$as_me:$LINENO: \$PKG_CONFIG --exists --print-errors \"mono >= \$MONO_REQUIRED_VERSION\"") >&5 + ($PKG_CONFIG --exists --print-errors "mono >= $MONO_REQUIRED_VERSION") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + pkg_cv_MONO_DEPENDENCY_CFLAGS=`$PKG_CONFIG --cflags "mono >= $MONO_REQUIRED_VERSION" 2>/dev/null` else - { echo "$as_me:$LINENO: result: found" >&5 -echo "${ECHO_T}found" >&6; } + pkg_failed=yes +fi + fi +else + pkg_failed=untried +fi +if test -n "$PKG_CONFIG"; then + if test -n "$MONO_DEPENDENCY_LIBS"; then + pkg_cv_MONO_DEPENDENCY_LIBS="$MONO_DEPENDENCY_LIBS" + else + if test -n "$PKG_CONFIG" && \ + { (echo "$as_me:$LINENO: \$PKG_CONFIG --exists --print-errors \"mono >= \$MONO_REQUIRED_VERSION\"") >&5 + ($PKG_CONFIG --exists --print-errors "mono >= $MONO_REQUIRED_VERSION") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + pkg_cv_MONO_DEPENDENCY_LIBS=`$PKG_CONFIG --libs "mono >= $MONO_REQUIRED_VERSION" 2>/dev/null` +else + pkg_failed=yes +fi + fi +else + pkg_failed=untried fi -needed_dlls="Mono.Posix" -for i in $needed_dlls; do - { echo "$as_me:$LINENO: checking for $i.dll" >&5 -echo $ECHO_N "checking for $i.dll... $ECHO_C" >&6; } - if test ! -e `$PKG_CONFIG --variable=prefix mono`/lib/mono/1.0/$i.dll; then - { { echo "$as_me:$LINENO: error: missing required mono DLL: $i.dll" >&5 -echo "$as_me: error: missing required mono DLL: $i.dll" >&2;} - { (exit 1); exit 1; }; } - else - { echo "$as_me:$LINENO: result: found" >&5 -echo "${ECHO_T}found" >&6; } + +if test $pkg_failed = yes; then + +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then + _pkg_short_errors_supported=yes +else + _pkg_short_errors_supported=no +fi + if test $_pkg_short_errors_supported = yes; then + MONO_DEPENDENCY_PKG_ERRORS=`$PKG_CONFIG --short-errors --errors-to-stdout --print-errors "mono >= $MONO_REQUIRED_VERSION"` + else + MONO_DEPENDENCY_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "mono >= $MONO_REQUIRED_VERSION"` + fi + # Put the nasty error message in config.log where it belongs + echo "$MONO_DEPENDENCY_PKG_ERRORS" >&5 + + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } + has_mono=false +elif test $pkg_failed = untried; then + has_mono=false +else + MONO_DEPENDENCY_CFLAGS=$pkg_cv_MONO_DEPENDENCY_CFLAGS + MONO_DEPENDENCY_LIBS=$pkg_cv_MONO_DEPENDENCY_LIBS + { echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; } + has_mono=true +fi + +if test "x$has_mono" = "xtrue"; then +# Extract the first word of "mono", so it can be a program name with args. +set dummy mono; ac_word=$2 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_path_RUNTIME+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + case $RUNTIME in + [\\/]* | ?:[\\/]*) + ac_cv_path_RUNTIME="$RUNTIME" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_path_RUNTIME="$as_dir/$ac_word$ac_exec_ext" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 fi done +done +IFS=$as_save_IFS + test -z "$ac_cv_path_RUNTIME" && ac_cv_path_RUNTIME="no" + ;; +esac +fi +RUNTIME=$ac_cv_path_RUNTIME +if test -n "$RUNTIME"; then + { echo "$as_me:$LINENO: result: $RUNTIME" >&5 +echo "${ECHO_T}$RUNTIME" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi -MONO_REQUIRED=1.1.17 -ac_config_files="$ac_config_files telepathy-sharp.pc Makefile telepathy/Makefile telepathy/AssemblyInfo.cs test/Makefile" +# Extract the first word of "gmcs", so it can be a program name with args. +set dummy gmcs; ac_word=$2 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_path_CSC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + case $CSC in + [\\/]* | ?:[\\/]*) + ac_cv_path_CSC="$CSC" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_path_CSC="$as_dir/$ac_word$ac_exec_ext" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + + test -z "$ac_cv_path_CSC" && ac_cv_path_CSC="no" + ;; +esac +fi +CSC=$ac_cv_path_CSC +if test -n "$CSC"; then + { echo "$as_me:$LINENO: result: $CSC" >&5 +echo "${ECHO_T}$CSC" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + + +if test `uname -s` = "Darwin"; then + LIB_PREFIX= + LIB_SUFFIX=.dylib +else + LIB_PREFIX=.so + LIB_SUFFIX= +fi +else + { { echo "$as_me:$LINENO: error: You need to install libmono-devel package" >&5 +echo "$as_me: error: You need to install libmono-devel package" >&2;} + { (exit 1); exit 1; }; } +fi + +ac_config_files="$ac_config_files telepathy-sharp.pc Makefile dbus-sharp/Makefile telepathy/Makefile telepathy/AssemblyInfo.cs test/Makefile" cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure @@ -2587,7 +2792,8 @@ ## M4sh Initialization. ## ## --------------------- ## -# Be Bourne compatible +# Be more Bourne compatible +DUALCASE=1; export DUALCASE # for MKS sh if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: @@ -2596,10 +2802,13 @@ alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else - case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac + case `(set -o) 2>/dev/null` in + *posix*) set -o posix ;; +esac + fi -BIN_SH=xpg4; export BIN_SH # for Tru64 -DUALCASE=1; export DUALCASE # for MKS sh + + # PATH needs CR @@ -2823,19 +3032,28 @@ as_mkdir_p=false fi -# Find out whether ``test -x'' works. Don't use a zero-byte file, as -# systems may use methods other than mode bits to determine executability. -cat >conf$$.file <<_ASEOF -#! /bin/sh -exit 0 -_ASEOF -chmod +x conf$$.file -if test -x conf$$.file >/dev/null 2>&1; then - as_executable_p="test -x" +if test -x / >/dev/null 2>&1; then + as_test_x='test -x' else - as_executable_p=: + if ls -dL / >/dev/null 2>&1; then + as_ls_L_option=L + else + as_ls_L_option= + fi + as_test_x=' + eval sh -c '\'' + if test -d "$1"; then + test -d "$1/."; + else + case $1 in + -*)set "./$1";; + esac; + case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in + ???[sx]*):;;*)false;;esac;fi + '\'' sh + ' fi -rm -f conf$$.file +as_executable_p=$as_test_x # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" @@ -2851,7 +3069,7 @@ # values after options handling. ac_log=" This file was extended by $as_me, which was -generated by GNU Autoconf 2.60a. Invocation command line was +generated by GNU Autoconf 2.61. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS @@ -2894,7 +3112,7 @@ cat >>$CONFIG_STATUS <<_ACEOF ac_cs_version="\\ config.status -configured by $0, generated by GNU Autoconf 2.60a, +configured by $0, generated by GNU Autoconf 2.61, with options \\"`echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\" Copyright (C) 2006 Free Software Foundation, Inc. @@ -2994,6 +3212,7 @@ case $ac_config_target in "telepathy-sharp.pc") CONFIG_FILES="$CONFIG_FILES telepathy-sharp.pc" ;; "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; + "dbus-sharp/Makefile") CONFIG_FILES="$CONFIG_FILES dbus-sharp/Makefile" ;; "telepathy/Makefile") CONFIG_FILES="$CONFIG_FILES telepathy/Makefile" ;; "telepathy/AssemblyInfo.cs") CONFIG_FILES="$CONFIG_FILES telepathy/AssemblyInfo.cs" ;; "test/Makefile") CONFIG_FILES="$CONFIG_FILES test/Makefile" ;; @@ -3132,13 +3351,15 @@ MAINTAINER_MODE_FALSE!$MAINTAINER_MODE_FALSE$ac_delim MAINT!$MAINT$ac_delim PKG_CONFIG!$PKG_CONFIG$ac_delim -MONO!$MONO$ac_delim -MCS!$MCS$ac_delim +MONO_DEPENDENCY_CFLAGS!$MONO_DEPENDENCY_CFLAGS$ac_delim +MONO_DEPENDENCY_LIBS!$MONO_DEPENDENCY_LIBS$ac_delim +RUNTIME!$RUNTIME$ac_delim +CSC!$CSC$ac_delim LIBOBJS!$LIBOBJS$ac_delim LTLIBOBJS!$LTLIBOBJS$ac_delim _ACEOF - if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 79; then + if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 81; then break elif $ac_last_try; then { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5 diff -urNad telepathy-sharp-0.0.svn.20060831/configure.ac telepathy-sharp-0.0.svn.20070221/configure.ac --- telepathy-sharp-0.0.svn.20060831/configure.ac 2006-09-25 19:42:09.000000000 +0200 +++ telepathy-sharp-0.0.svn.20070221/configure.ac 2007-02-21 19:41:44.000000000 +0100 @@ -1,7 +1,7 @@ AC_INIT(README) AC_CANONICAL_SYSTEM -VERSION=0.1.0 +VERSION=0.13.2 ASM_VERSION="$VERSION.*" AM_INIT_AUTOMAKE(telepathy-sharp, $VERSION) @@ -16,50 +16,29 @@ AC_MSG_ERROR([You need to install pkg-config]) fi -dnl -- Check for Global Assembly Cache support - -dnl -- AC_PATH_PROG(GACUTIL, gacutil, no) -dnl -- if test "x$GACUTIL" = "xno" ; then -dnl -- AC_MSG_ERROR([No gacutil tool found. You need to install either the mono or .Net SDK.]) -dnl -- fi -dnl -- GACUTIL_FLAGS='/package $(PACKAGE_VERSION) /gacdir $(DESTDIR)$(prefix)/lib' -dnl -- AC_SUBST(GACUTIL) -dnl -- AC_SUBST(GACUTIL_FLAGS) - - -dnl -- Check for mono and mcs - -AC_PATH_PROG(MONO, mono) -AC_PATH_PROG(MCS, mcs) +dnl -- Check for mono and gmcs -dnl -- Check for mono pc file +MONO_REQUIRED_VERSION=1.1.17 +PKG_CHECK_MODULES(MONO_DEPENDENCY, mono >= $MONO_REQUIRED_VERSION, has_mono=true, has_mono=false) -AC_MSG_CHECKING([for mono.pc]) -if test -z `$PKG_CONFIG --variable=prefix mono`; then - AC_MSG_ERROR([missing the mono.pc file, usually found in the mono-devel package]) +if test "x$has_mono" = "xtrue"; then +AC_PATH_PROG(RUNTIME, mono, no) +AC_PATH_PROG(CSC, gmcs, no) +if test `uname -s` = "Darwin"; then + LIB_PREFIX= + LIB_SUFFIX=.dylib else - AC_MSG_RESULT([found]) + LIB_PREFIX=.so + LIB_SUFFIX= +fi +else + AC_MSG_ERROR([You need to install libmono-devel package]) fi - -dnl -- check for various mono DLLs that we need. - -needed_dlls="Mono.Posix" -for i in $needed_dlls; do - AC_MSG_CHECKING([for $i.dll]) - if test ! -e `$PKG_CONFIG --variable=prefix mono`/lib/mono/1.0/$i.dll; then - AC_MSG_ERROR([missing required mono DLL: $i.dll]) - else - AC_MSG_RESULT([found]) - fi -done - -dnl --- Required libraries - -MONO_REQUIRED=1.1.17 AC_OUTPUT([ telepathy-sharp.pc Makefile +dbus-sharp/Makefile telepathy/Makefile telepathy/AssemblyInfo.cs test/Makefile diff -urNad telepathy-sharp-0.0.svn.20060831/COPYING telepathy-sharp-0.0.svn.20070221/COPYING --- telepathy-sharp-0.0.svn.20060831/COPYING 2006-09-25 19:41:10.000000000 +0200 +++ telepathy-sharp-0.0.svn.20070221/COPYING 2007-02-21 19:10:38.000000000 +0100 @@ -0,0 +1,20 @@ +Copyright 2006 INdT + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff -urNad telepathy-sharp-0.0.svn.20060831/dbus-sharp/Address.cs telepathy-sharp-0.0.svn.20070221/dbus-sharp/Address.cs --- telepathy-sharp-0.0.svn.20060831/dbus-sharp/Address.cs 1970-01-01 01:00:00.000000000 +0100 +++ telepathy-sharp-0.0.svn.20070221/dbus-sharp/Address.cs 2007-02-21 19:10:38.000000000 +0100 @@ -0,0 +1,78 @@ +// Copyright 2006 Alp Toker +// This software is made available under the MIT License +// See COPYING for details + +using System; + +namespace NDesk.DBus +{ + public class Address + { + //this method is not pretty + //not worth improving until there is a spec for this format + //TODO: confirm that return value represents parse errors + public static bool Parse (string addr, out string path, out bool abstr) + { + //(unix:(path|abstract)=.*,guid=.*|tcp:host=.*(,port=.*)?);? ... + path = null; + abstr = false; + + if (String.IsNullOrEmpty (addr)) + return false; + + string[] parts; + + parts = addr.Split (':'); + if (parts[0] == "unix") { + parts = parts[1].Split (','); + parts = parts[0].Split ('='); + if (parts[0] == "path") + abstr = false; + else if (parts[0] == "abstract") + abstr = true; + else + return false; + + path = parts[1]; + } else { + return false; + } + + return true; + } + + const string SYSTEM_BUS_ADDRESS = "unix:path=/var/run/dbus/system_bus_socket"; + public static string System + { + get { + string addr = Environment.GetEnvironmentVariable ("DBUS_SYSTEM_BUS_ADDRESS"); + + if (String.IsNullOrEmpty (addr)) + addr = SYSTEM_BUS_ADDRESS; + + return addr; + } + } + + public static string Session + { + get { + return Environment.GetEnvironmentVariable ("DBUS_SESSION_BUS_ADDRESS"); + } + } + + public static string Starter + { + get { + return Environment.GetEnvironmentVariable ("DBUS_STARTER_ADDRESS"); + } + } + + public static string StarterBusType + { + get { + return Environment.GetEnvironmentVariable ("DBUS_STARTER_BUS_TYPE"); + } + } + } +} diff -urNad telepathy-sharp-0.0.svn.20060831/dbus-sharp/AssemblyInfo.cs telepathy-sharp-0.0.svn.20070221/dbus-sharp/AssemblyInfo.cs --- telepathy-sharp-0.0.svn.20060831/dbus-sharp/AssemblyInfo.cs 1970-01-01 01:00:00.000000000 +0100 +++ telepathy-sharp-0.0.svn.20070221/dbus-sharp/AssemblyInfo.cs 2007-02-21 19:10:38.000000000 +0100 @@ -0,0 +1,12 @@ +// Copyright 2006 Alp Toker +// This software is made available under the MIT License +// See COPYING for details + +using System.Reflection; +using System.Runtime.CompilerServices; + +//[assembly: AssemblyVersion("0.0.0.*")] +[assembly: AssemblyTitle ("NDesk.DBus")] +[assembly: AssemblyDescription ("D-Bus IPC protocol library and CLR binding")] +[assembly: AssemblyCopyright ("Copyright (C) Alp Toker")] +[assembly: AssemblyCompany ("NDesk")] diff -urNad telepathy-sharp-0.0.svn.20060831/dbus-sharp/Authentication.cs telepathy-sharp-0.0.svn.20070221/dbus-sharp/Authentication.cs --- telepathy-sharp-0.0.svn.20060831/dbus-sharp/Authentication.cs 1970-01-01 01:00:00.000000000 +0100 +++ telepathy-sharp-0.0.svn.20070221/dbus-sharp/Authentication.cs 2007-02-21 19:10:38.000000000 +0100 @@ -0,0 +1,145 @@ +// Copyright 2006 Alp Toker +// This software is made available under the MIT License +// See COPYING for details + +using System; +using System.Diagnostics; +using System.Collections.Generic; +using System.IO; + +using System.Text; +using System.Globalization; + +namespace NDesk.DBus.Authentication +{ + public enum ClientState + { + WaitingForData, + WaitingForOK, + WaitingForReject, + } + + public enum ServerState + { + WaitingForAuth, + WaitingForData, + WaitingForBegin, + } + + public class SaslClient + { + protected Connection conn; + + protected SaslClient () + { + } + + public SaslClient (Connection conn) + { + this.conn = conn; + } + + public void Run () + { + //NetworkStream ns = new NetworkStream (sock); + //UnixStream ns = new UnixStream ((int)sock.Handle); + StreamReader sr = new StreamReader (conn.ns, Encoding.ASCII); + StreamWriter sw = new StreamWriter (conn.ns, Encoding.ASCII); + + sw.NewLine = "\r\n"; + //sw.AutoFlush = true; + + //send peer credentials null byte. note that this might not be portable + //there are also selinux, BSD etc. considerations + sw.Write ('\0'); + + string str = conn.Transport.AuthString (); + byte[] bs = Encoding.ASCII.GetBytes (str); + + string authStr = ToHex (bs); + + sw.WriteLine ("AUTH EXTERNAL {0}", authStr); + sw.Flush (); + + string ok_rep = sr.ReadLine (); + + string[] parts; + parts = ok_rep.Split (' '); + + if (parts.Length < 1 || parts[0] != "OK") + throw new Exception ("Authentication error: AUTH EXTERNAL was not OK"); + + /* + string guid = parts[1]; + byte[] guidData = FromHex (guid); + uint unixTime = BitConverter.ToUInt32 (guidData, 0); + Console.Error.WriteLine ("guid: " + guid + ", " + "unixTime: " + unixTime + " (" + UnixToDateTime (unixTime) + ")"); + */ + + sw.WriteLine ("BEGIN"); + sw.Flush (); + } + + //From Mono.Unix.Native.NativeConvert + //should these methods use long or (u)int? + public static DateTime UnixToDateTime (long time) + { + DateTime LocalUnixEpoch = new DateTime (1970, 1, 1); + TimeSpan LocalUtcOffset = TimeZone.CurrentTimeZone.GetUtcOffset (DateTime.UtcNow); + return LocalUnixEpoch.AddSeconds ((double) time + LocalUtcOffset.TotalSeconds); + } + + public static long DateTimeToUnix (DateTime time) + { + DateTime LocalUnixEpoch = new DateTime (1970, 1, 1); + TimeSpan LocalUtcOffset = TimeZone.CurrentTimeZone.GetUtcOffset (DateTime.UtcNow); + TimeSpan unixTime = time.Subtract (LocalUnixEpoch) - LocalUtcOffset; + + return (long) unixTime.TotalSeconds; + } + + //From Mono.Security.Cryptography + //Modified to output lowercase hex + static public string ToHex (byte[] input) + { + if (input == null) + return null; + + StringBuilder sb = new StringBuilder (input.Length * 2); + foreach (byte b in input) { + sb.Append (b.ToString ("x2", CultureInfo.InvariantCulture)); + } + return sb.ToString (); + } + + //From Mono.Security.Cryptography + static private byte FromHexChar (char c) + { + if ((c >= 'a') && (c <= 'f')) + return (byte) (c - 'a' + 10); + if ((c >= 'A') && (c <= 'F')) + return (byte) (c - 'A' + 10); + if ((c >= '0') && (c <= '9')) + return (byte) (c - '0'); + throw new ArgumentException ("Invalid hex char"); + } + + //From Mono.Security.Cryptography + static public byte[] FromHex (string hex) + { + if (hex == null) + return null; + if ((hex.Length & 0x1) == 0x1) + throw new ArgumentException ("Length must be a multiple of 2"); + + byte[] result = new byte [hex.Length >> 1]; + int n = 0; + int i = 0; + while (n < result.Length) { + result [n] = (byte) (FromHexChar (hex [i++]) << 4); + result [n++] += FromHexChar (hex [i++]); + } + return result; + } + } +} diff -urNad telepathy-sharp-0.0.svn.20060831/dbus-sharp/Bus.cs telepathy-sharp-0.0.svn.20070221/dbus-sharp/Bus.cs --- telepathy-sharp-0.0.svn.20060831/dbus-sharp/Bus.cs 1970-01-01 01:00:00.000000000 +0100 +++ telepathy-sharp-0.0.svn.20070221/dbus-sharp/Bus.cs 2007-02-21 19:10:38.000000000 +0100 @@ -0,0 +1,219 @@ +// Copyright 2006 Alp Toker +// This software is made available under the MIT License +// See COPYING for details + +using System; +using System.Collections.Generic; +using org.freedesktop.DBus; + +namespace NDesk.DBus +{ + public class Bus : Connection + { + protected static Bus systemBus = null; + public static Bus System + { + get { + if (systemBus == null) { + try { + systemBus = Bus.Open (Address.System); + } catch (Exception e) { + throw new Exception ("Unable to open the system message bus.", e); + } + } + + return systemBus; + } + } + + protected static Bus sessionBus = null; + public static Bus Session + { + get { + if (sessionBus == null) { + try { + sessionBus = Bus.Open (Address.Session); + } catch (Exception e) { + throw new Exception ("Unable to open the session message bus.", e); + } + } + + return sessionBus; + } + } + + //TODO: parsing of starter bus type, or maybe do this another way + protected static Bus starterBus = null; + public static Bus Starter + { + get { + if (starterBus == null) { + try { + starterBus = Bus.Open (Address.Starter); + } catch (Exception e) { + throw new Exception ("Unable to open the starter message bus.", e); + } + } + + return starterBus; + } + } + + //public static readonly Bus Session = null; + + //TODO: use the guid, not the whole address string + //TODO: consider what happens when a connection has been closed + protected static Dictionary buses = new Dictionary (); + + //public static Connection Open (string address) + public static new Bus Open (string address) + { + if (buses.ContainsKey (address)) + return buses[address]; + + Bus bus = new Bus (address); + buses[address] = bus; + + return bus; + } + + //protected IBus bus; + private BusObject bus; + + static readonly string DBusName = "org.freedesktop.DBus"; + static readonly ObjectPath DBusPath = new ObjectPath ("/org/freedesktop/DBus"); + + public Bus (string address) : base (address) + { + //bus = GetObject (DBusName, DBusPath); + bus = new BusObject (this, DBusName, DBusPath); + + /* + bus.NameAcquired += delegate (string acquired_name) { + Console.WriteLine ("NameAcquired: " + acquired_name); + }; + */ + Register (); + //handle the signal -- might not work properly in all cases, needs testing + Iterate (); + } + + /* + protected void Register () + { + unique_name = bus.Hello (); + } + + public override string UniqueName + { + get { + return unique_name; + } + } + + public ulong GetUnixUser (string name) + { + return bus.GetConnectionUnixUser (name); + } + + public NameReply RequestName (string name) + { + return RequestName (name, NameFlag.None); + } + + public NameReply RequestName (string name, NameFlag flags) + { + return bus.RequestName (name, flags); + } + + public ReleaseNameReply ReleaseName (string name) + { + return bus.ReleaseName (name); + } + + public bool NameHasOwner (string name) + { + return bus.NameHasOwner (name); + } + + public StartReply StartServiceByName (string name) + { + return StartServiceByName (name, 0); + } + + public StartReply StartServiceByName (string name, uint flags) + { + return bus.StartServiceByName (name, flags); + } + + public override void AddMatch (string rule) + { + bus.AddMatch (rule); + //Iterate (); + } + + public override void RemoveMatch (string rule) + { + bus.RemoveMatch (rule); + //Iterate (); + } + */ + + protected void Register () + { + unique_name = (string)bus.InvokeMethod (typeof (IBus).GetMethod ("Hello")); + } + + public override string UniqueName + { + get { + return unique_name; + } + } + + public ulong GetUnixUser (string name) + { + return (ulong)bus.InvokeMethod (typeof (IBus).GetMethod ("GetConnectionUnixUser"), name); + } + + public NameReply RequestName (string name) + { + return RequestName (name, NameFlag.None); + } + + public NameReply RequestName (string name, NameFlag flags) + { + return (NameReply)bus.InvokeMethod (typeof (IBus).GetMethod ("RequestName"), name, flags); + } + + public ReleaseNameReply ReleaseName (string name) + { + return (ReleaseNameReply)bus.InvokeMethod (typeof (IBus).GetMethod ("ReleaseName"), name); + } + + public bool NameHasOwner (string name) + { + return (bool)bus.InvokeMethod (typeof (IBus).GetMethod ("NameHasOwner"), name); + } + + public StartReply StartServiceByName (string name) + { + return StartServiceByName (name, 0); + } + + public StartReply StartServiceByName (string name, uint flags) + { + return (StartReply)bus.InvokeMethod (typeof (IBus).GetMethod ("StartServiceByName"), name, flags); + } + + public override void AddMatch (string rule) + { + bus.InvokeMethod (typeof (IBus).GetMethod ("AddMatch"), rule); + } + + public override void RemoveMatch (string rule) + { + bus.InvokeMethod (typeof (IBus).GetMethod ("RemoveMatch"), rule); + } + } +} diff -urNad telepathy-sharp-0.0.svn.20060831/dbus-sharp/BusObject.cs telepathy-sharp-0.0.svn.20070221/dbus-sharp/BusObject.cs --- telepathy-sharp-0.0.svn.20060831/dbus-sharp/BusObject.cs 1970-01-01 01:00:00.000000000 +0100 +++ telepathy-sharp-0.0.svn.20070221/dbus-sharp/BusObject.cs 2007-02-21 19:10:38.000000000 +0100 @@ -0,0 +1,391 @@ +// Copyright 2006 Alp Toker +// This software is made available under the MIT License +// See COPYING for details + +using System; +using System.Reflection; +using System.Reflection.Emit; + +namespace NDesk.DBus +{ + //marked internal because this isn't ready for public use yet + //it probably needs to be made into a base and import/export subclasses + internal class BusObject + { + Connection conn; + string bus_name; + ObjectPath object_path; + + //protected BusObject () + public BusObject () + { + } + + public BusObject (Connection conn, string bus_name, ObjectPath object_path) + { + this.conn = conn; + this.bus_name = bus_name; + this.object_path = object_path; + } + + public Connection Connection + { + get { + return conn; + } + } + + public string BusName + { + get { + return bus_name; + } + } + + public ObjectPath Path + { + get { + return object_path; + } + } + + //convenience method + public object InvokeMethod (MethodInfo methodInfo, params object[] inArgs) + { + //TODO: this ignores outArgs, doesn't wrap the exception etc. + + object[] outArgs; + object retVal; + Exception exception; + + Invoke (methodInfo, methodInfo.Name, inArgs, out outArgs, out retVal, out exception); + + if (exception != null) + throw exception; + + return retVal; + } + + //this method is kept simple while IL generation support is worked on + public object SendMethodCall (MethodInfo methodInfo, string @interface, string member, object[] inArgs) + { + //TODO: don't ignore retVal, exception etc. + + object[] outArgs; + object retVal; + Exception exception; + Invoke (methodInfo, methodInfo.Name, inArgs, out outArgs, out retVal, out exception); + + if (exception != null) + throw exception; + + return retVal; + } + + public void Invoke (MethodBase methodBase, string methodName, object[] inArgs, out object[] outArgs, out object retVal, out Exception exception) + { + outArgs = new object[0]; + retVal = null; + exception = null; + + MethodInfo mi = methodBase as MethodInfo; + + if (mi != null && mi.IsSpecialName && (methodName.StartsWith ("add_") || methodName.StartsWith ("remove_"))) { + string[] parts = methodName.Split (new char[]{'_'}, 2); + string ename = parts[1]; + Delegate dlg = (Delegate)inArgs[0]; + string matchRule = MessageFilter.CreateMatchRule (MessageType.Signal, object_path, Mapper.GetInterfaceName (mi), ename); + + if (parts[0] == "add") { + if (conn.Handlers.ContainsKey (matchRule)) + conn.Handlers[matchRule] = Delegate.Combine (conn.Handlers[matchRule], dlg); + else { + conn.Handlers[matchRule] = dlg; + conn.AddMatch (matchRule); + } + } else if (parts[0] == "remove") { + conn.Handlers[matchRule] = Delegate.Remove (conn.Handlers[matchRule], dlg); + if (conn.Handlers[matchRule] == null) { + conn.RemoveMatch (matchRule); + conn.Handlers.Remove (matchRule); + } + } + return; + } + + Type[] inTypes = Mapper.GetTypes (ArgDirection.In, mi.GetParameters ()); + Signature inSig = Signature.GetSig (inTypes); + + MethodCall method_call; + Message callMsg; + + //build the outbound method call message + { + //this bit is error-prone (no null checking) and will need rewriting when DProxy is replaced + string iface = null; + if (mi != null) + iface = Mapper.GetInterfaceName (mi); + + //map property accessors + //TODO: this needs to be done properly, not with simple String.Replace + //note that IsSpecialName is also for event accessors, but we already handled those and returned + if (mi != null && mi.IsSpecialName) { + methodName = methodName.Replace ("get_", "Get"); + methodName = methodName.Replace ("set_", "Set"); + } + + method_call = new MethodCall (object_path, iface, methodName, bus_name, inSig); + + callMsg = method_call.message; + + if (inArgs != null && inArgs.Length != 0) { + MessageWriter writer = new MessageWriter (); + + for (int i = 0 ; i != inTypes.Length ; i++) + writer.Write (inTypes[i], inArgs[i]); + + callMsg.Body = writer.ToArray (); + } + } + + //TODO: complete out parameter support + Type[] outParmTypes = Mapper.GetTypes (ArgDirection.Out, mi.GetParameters ()); + Signature outParmSig = Signature.GetSig (outParmTypes); + + if (outParmSig != Signature.Empty) + throw new Exception ("Out parameters not yet supported: out_signature='" + outParmSig.Value + "'"); + + Type[] outTypes = new Type[1]; + outTypes[0] = mi.ReturnType; + + //we default to always requiring replies for now, even though unnecessary + //this is to make sure errors are handled synchronously + //TODO: don't hard code this + bool needsReply = true; + + //if (mi.ReturnType == typeof (void)) + // needsReply = false; + + callMsg.ReplyExpected = needsReply; + callMsg.Signature = inSig; + + if (!needsReply) { + conn.Send (callMsg); + return; + } + +#if PROTO_REPLY_SIGNATURE + if (needsReply) { + Signature outSig = Signature.GetSig (outTypes); + callMsg.Header.Fields[FieldCode.ReplySignature] = outSig; + } +#endif + + Message retMsg = conn.SendWithReplyAndBlock (callMsg); + + //handle the reply message + switch (retMsg.Header.MessageType) { + case MessageType.MethodReturn: + object[] retVals = MessageHelper.GetDynamicValues (retMsg, outTypes); + if (retVals.Length != 0) + retVal = retVals[retVals.Length - 1]; + break; + case MessageType.Error: + //TODO: typed exceptions + Error error = new Error (retMsg); + string errMsg = ""; + if (retMsg.Signature.Value.StartsWith ("s")) { + MessageReader reader = new MessageReader (retMsg); + reader.GetValue (out errMsg); + } + exception = new Exception (error.ErrorName + ": " + errMsg); + break; + default: + throw new Exception ("Got unexpected message of type " + retMsg.Header.MessageType + " while waiting for a MethodReturn or Error"); + } + + return; + } + + static AssemblyBuilder asmB; + static ModuleBuilder modB; + + static void InitHack () + { + if (asmB != null) + return; + + asmB = AppDomain.CurrentDomain.DefineDynamicAssembly (new AssemblyName ("ProxyAssembly"), AssemblyBuilderAccess.Run); + modB = asmB.DefineDynamicModule ("ProxyModule"); + } + + static System.Collections.Generic.Dictionary map = new System.Collections.Generic.Dictionary (); + + public static Type DefineType (Type declType) + { + if (map.ContainsKey (declType)) + return map[declType]; + + InitHack (); + + TypeBuilder typeB = modB.DefineType (declType.Name, TypeAttributes.Class | TypeAttributes.Public, typeof (BusObject)); + + Implement (typeB, declType); + + foreach (Type iface in declType.GetInterfaces ()) { + Implement (typeB, iface); + //typeB.DefineMethodOverride (body, declMethod); + } + + Type retT = typeB.CreateType (); + + map[declType] = retT; + //return typeB.CreateType (); + return retT; + } + + public static void Implement (TypeBuilder typeB, Type iface) + { + typeB.AddInterfaceImplementation (iface); + + foreach (MethodInfo declMethod in iface.GetMethods ()) { + + MethodBuilder method_builder = typeB.DefineMethod (declMethod.Name, MethodAttributes.Public | MethodAttributes.Virtual, declMethod.ReturnType, Mapper.GetTypes (ArgDirection.In, declMethod.GetParameters ())); + ILGenerator ilg = method_builder.GetILGenerator (); + + //Mapper.GetTypes (ArgDirection.In, declMethod.GetParameters ()) + + ParameterInfo[] delegateParms = declMethod.GetParameters (); + Type[] hookupParms = new Type[delegateParms.Length+1]; + hookupParms[0] = typeof (BusObject); + for (int i = 0; i < delegateParms.Length ; i++) + hookupParms[i+1] = delegateParms[i].ParameterType; + + GenHookupMethod (ilg, declMethod, sendMethodCallMethod, Mapper.GetInterfaceName (iface), declMethod.Name, hookupParms); + } + } + + public static object GetObject (Connection conn, string bus_name, ObjectPath object_path, Type declType) + { + Type proxyType = DefineType (declType); + + BusObject inst = (BusObject)Activator.CreateInstance (proxyType); + inst.conn = conn; + inst.bus_name = bus_name; + inst.object_path = object_path; + + return inst; + } + + static MethodInfo sendMethodCallMethod = typeof (BusObject).GetMethod ("SendMethodCall"); + static MethodInfo sendSignalMethod = typeof (BusObject).GetMethod ("SendSignal"); + + public Delegate GetHookupDelegate (EventInfo ei) + { + if (ei.EventHandlerType.IsAssignableFrom (typeof (System.EventHandler))) + Console.Error.WriteLine ("Warning: Cannot yet fully marshal EventHandler and its subclasses: " + ei.EventHandlerType); + + MethodInfo declMethod = ei.EventHandlerType.GetMethod ("Invoke"); + + DynamicMethod hookupMethod = GetHookupMethod (declMethod, sendSignalMethod, Mapper.GetInterfaceName (ei), ei.Name); + + Delegate d = hookupMethod.CreateDelegate (ei.EventHandlerType, this); + + return d; + } + + public static DynamicMethod GetHookupMethod (MethodInfo declMethod, MethodInfo invokeMethod, string @interface, string member) + { + ParameterInfo[] delegateParms = declMethod.GetParameters (); + Type[] hookupParms = new Type[delegateParms.Length+1]; + hookupParms[0] = typeof (BusObject); + for (int i = 0; i < delegateParms.Length ; i++) + hookupParms[i+1] = delegateParms[i].ParameterType; + + DynamicMethod hookupMethod = new DynamicMethod ("Handle" + member, declMethod.ReturnType, hookupParms, typeof (object)); + + ILGenerator ilg = hookupMethod.GetILGenerator (); + + GenHookupMethod (ilg, declMethod, invokeMethod, @interface, member, hookupParms); + + return hookupMethod; + } + + public static void GenHookupMethod (ILGenerator ilg, MethodInfo declMethod, MethodInfo invokeMethod, string @interface, string member, Type[] hookupParms) + { + Type retType = declMethod.ReturnType; + + //the BusObject instance + ilg.Emit (OpCodes.Ldarg_0); + + //MethodInfo + ilg.Emit (OpCodes.Ldtoken, declMethod); + ilg.Emit (OpCodes.Call, typeof (MethodBase).GetMethod ("GetMethodFromHandle")); + + //interface + ilg.Emit (OpCodes.Ldstr, @interface); + + //member + ilg.Emit (OpCodes.Ldstr, member); + + LocalBuilder local = ilg.DeclareLocal (typeof (object[])); + ilg.Emit (OpCodes.Ldc_I4, hookupParms.Length - 1); + ilg.Emit (OpCodes.Newarr, typeof (object)); + ilg.Emit (OpCodes.Stloc, local); + + //offset by one because arg0 is the instance of the delegate + for (int i = 1 ; i < hookupParms.Length ; i++) + { + Type t = hookupParms[i]; + + ilg.Emit (OpCodes.Ldloc, local); + //the instance parameter requires the -1 offset here + ilg.Emit (OpCodes.Ldc_I4, i-1); + ilg.Emit (OpCodes.Ldarg, i); + + if (t.IsValueType) + ilg.Emit (OpCodes.Box, t); + + ilg.Emit (OpCodes.Stelem_Ref); + } + + ilg.Emit (OpCodes.Ldloc, local); + ilg.Emit (OpCodes.Call, invokeMethod); + + if (retType == typeof (void)) { + //we aren't expecting a return value, so throw away the (hopefully) null return + if (invokeMethod.ReturnType != typeof (void)) + ilg.Emit (OpCodes.Pop); + } else { + if (retType.IsValueType) + ilg.Emit (OpCodes.Unbox_Any, retType); + else + ilg.Emit (OpCodes.Castclass, retType); + } + + ilg.Emit (OpCodes.Ret); + } + + public void SendSignal (MethodInfo mi, string @interface, string member, object[] outValues) + { + //TODO: make use of bus_name? + + Type[] outTypes = Mapper.GetTypes (ArgDirection.In, mi.GetParameters ()); + Signature outSig = Signature.GetSig (outTypes); + + Signal signal = new Signal (object_path, @interface, member); + signal.message.Signature = outSig; + + if (outValues != null && outValues.Length != 0) { + MessageWriter writer = new MessageWriter (); + + for (int i = 0 ; i != outTypes.Length ; i++) + writer.Write (outTypes[i], outValues[i]); + + signal.message.Body = writer.ToArray (); + } + + conn.Send (signal.message); + } + } +} diff -urNad telepathy-sharp-0.0.svn.20060831/dbus-sharp/Connection.cs telepathy-sharp-0.0.svn.20070221/dbus-sharp/Connection.cs --- telepathy-sharp-0.0.svn.20060831/dbus-sharp/Connection.cs 1970-01-01 01:00:00.000000000 +0100 +++ telepathy-sharp-0.0.svn.20070221/dbus-sharp/Connection.cs 2007-02-21 19:10:38.000000000 +0100 @@ -0,0 +1,625 @@ +// Copyright 2006 Alp Toker +// This software is made available under the MIT License +// See COPYING for details + +using System; +using System.Diagnostics; +using System.Collections.Generic; +using System.IO; + +using System.Threading; + +using System.Reflection; + +//using Console = System.Diagnostics.Trace; + +namespace NDesk.DBus +{ + using Authentication; + using Transports; + + public class Connection + { + //TODO: reduce/correct visibility of these when appropriate + public Stream ns = null; + public long SocketHandle; + + protected Transport transport; + public Transport Transport { + get { + return transport; + } set { + transport = value; + } + } + + //TODO: reduce visibility when test-server no longer needs this + //protected Connection () + public Connection () + { + } + + public Connection (string address) + { + OpenPrivate (address); + Authenticate (); + } + + protected bool isConnected = false; + public bool IsConnected + { + get { + return isConnected; + } + } + + public static Connection Open (string address) + { + Connection conn = new Connection (); + conn.OpenPrivate (address); + conn.Authenticate (); + + return conn; + } + + //TODO: reduce visibility when test-server no longer needs this + //protected void OpenPrivate (string address) + public void OpenPrivate (string address) + { + string path; + bool abstr; + + if (address == null) + throw new ArgumentNullException ("address"); + + if (!Address.Parse (address, out path, out abstr)) + throw new ArgumentException ("Invalid D-Bus address: '" + address + "'", "address"); + + Open (path, abstr); + + isConnected = true; + } + + void Open (string path, bool abstr) + { + //transport = new UnixMonoTransport (path, abstr); + transport = new UnixNativeTransport (path, abstr); + ns = transport.Stream; + SocketHandle = transport.SocketHandle; + } + + public void Authenticate () + { + SaslClient auth = new SaslClient (this); + auth.Run (); + isAuthenticated = true; + } + + protected bool isAuthenticated = false; + public bool IsAuthenticated + { + get { + return isAuthenticated; + } + } + + protected string unique_name = null; + public virtual string UniqueName + { + get { + return unique_name; + } set { + if (unique_name != null) + throw new Exception ("Unique name of a Connection can only be set once"); + unique_name = value; + } + } + + //Interlocked.Increment() handles the overflow condition for uint correctly, so it's ok to store the value as an int but cast it to uint + protected int serial = 0; + protected uint GenerateSerial () + { + //return ++serial; + return (uint)Interlocked.Increment (ref serial); + } + + + + + public Message SendWithReplyAndBlock (Message msg) + { + uint id = SendWithReply (msg); + + Message retMsg = WaitForReplyTo (id); + DispatchSignals (); + + return retMsg; + } + + public uint SendWithReply (Message msg) + { + msg.ReplyExpected = true; + return Send (msg); + } + + public uint Send (Message msg) + { + msg.Header.Serial = GenerateSerial (); + + msg.WriteHeader (); + + WriteMessage (msg); + + //Outbound.Enqueue (msg); + //temporary + //Flush (); + + return msg.Header.Serial; + } + + //could be cleaner + protected void WriteMessage (Message msg) + { + //Monitor.Enter (ns); + + //ns.Write (msg.HeaderData, 0, msg.HeaderSize); + //Console.WriteLine ("headerSize: " + msg.HeaderSize); + //Console.WriteLine ("headerLength: " + msg.HeaderData.Length); + //Console.WriteLine (); + ns.Write (msg.HeaderData, 0, msg.HeaderData.Length); + if (msg.Body != null) { + ns.Write (msg.Body, 0, msg.Body.Length); + //msg.Body.WriteTo (ns); + } + + //Monitor.Exit (ns); + } + + protected Queue Inbound = new Queue (); + /* + protected Queue Outbound = new Queue (); + + public void Flush () + { + //should just iterate the enumerator here + while (Outbound.Count != 0) { + Message msg = Outbound.Dequeue (); + WriteMessage (msg); + } + } + + public bool ReadWrite (int timeout_milliseconds) + { + //TODO + + return true; + } + + public bool ReadWrite () + { + return ReadWrite (-1); + } + + public bool Dispatch () + { + //TODO + Message msg = Inbound.Dequeue (); + //HandleMessage (msg); + + return true; + } + + public bool ReadWriteDispatch (int timeout_milliseconds) + { + //TODO + return Dispatch (); + } + + public bool ReadWriteDispatch () + { + return ReadWriteDispatch (-1); + } + */ + + public Message ReadMessage () + { + //Monitor.Enter (ns); + + //FIXME: fix reading algorithm to work in one step + //this code is a bit silly and inefficient + //hopefully it's at least correct and avoids polls for now + + int read; + + byte[] buf = new byte[16]; + read = ns.Read (buf, 0, 16); + + if (read != 16) + throw new Exception ("Header read length mismatch: " + read + " of expected " + "16"); + + MemoryStream ms = new MemoryStream (); + + ms.Write (buf, 0, 16); + + EndianFlag endianness = (EndianFlag)buf[0]; + MessageReader reader = new MessageReader (endianness, buf); + + //discard the endian byte as we've already read it + byte tmp; + reader.GetValue (out tmp); + + //discard message type and flags, which we don't care about here + reader.GetValue (out tmp); + reader.GetValue (out tmp); + + byte version; + reader.GetValue (out version); + + if (version < Protocol.MinVersion || version > Protocol.MaxVersion) + throw new NotSupportedException ("Protocol version '" + version.ToString () + "' is not supported"); + + if (Protocol.Verbose) + if (version != Protocol.Version) + Console.Error.WriteLine ("Warning: Protocol version '" + version.ToString () + "' is not explicitly supported but may be compatible"); + + uint bodyLength, serial, headerLength; + reader.GetValue (out bodyLength); + reader.GetValue (out serial); + reader.GetValue (out headerLength); + + //TODO: remove this limitation + if (bodyLength > Int32.MaxValue || headerLength > Int32.MaxValue) + throw new NotImplementedException ("Long messages are not yet supported"); + + int bodyLen = (int)bodyLength; + int toRead = (int)headerLength; + + toRead = Protocol.Padded ((int)toRead, 8); + + buf = new byte[toRead]; + + read = ns.Read (buf, 0, toRead); + + if (read != toRead) + throw new Exception ("Read length mismatch: " + read + " of expected " + toRead); + + ms.Write (buf, 0, buf.Length); + + Message msg = new Message (); + msg.HeaderData = ms.ToArray (); + + //read the body + if (bodyLen != 0) { + //FIXME + //msg.Body = new byte[(int)msg.Header->Length]; + byte[] body = new byte[bodyLen]; + + //int len = ns.Read (msg.Body, 0, msg.Body.Length); + int len = ns.Read (body, 0, bodyLen); + + //if (len != msg.Body.Length) + if (len != bodyLen) + throw new Exception ("Message body size mismatch"); + + //msg.Body = new MemoryStream (body); + msg.Body = body; + } + + //Monitor.Exit (ns); + + //this needn't be done here + msg.ParseHeader (); + + return msg; + } + + //needs to be done properly + public Message WaitForReplyTo (uint id) + { + //Message msg = Inbound.Dequeue (); + Message msg; + + while ((msg = ReadMessage ()) != null) { + if (msg.Header.Fields.ContainsKey (FieldCode.ReplySerial)) + if ((uint)msg.Header.Fields[FieldCode.ReplySerial] == id) + return msg; + + HandleMessage (msg); + } + + return null; + } + + + //temporary hack + protected void DispatchSignals () + { + lock (Inbound) { + while (Inbound.Count != 0) { + Message msg = Inbound.Dequeue (); + HandleSignal (msg); + } + } + } + + //temporary hack + public void Iterate () + { + //Message msg = Inbound.Dequeue (); + Message msg = ReadMessage (); + HandleMessage (msg); + DispatchSignals (); + } + + protected void HandleMessage (Message msg) + { + switch (msg.Header.MessageType) { + case MessageType.MethodCall: + MethodCall method_call = new MethodCall (msg); + HandleMethodCall (method_call); + break; + case MessageType.MethodReturn: + MethodReturn method_return = new MethodReturn (msg); + if (PendingCalls.ContainsKey (method_return.ReplySerial)) { + //TODO: pending calls + //return msg; + } + //if the signature is empty, it's just a token return message + if (msg.Signature != Signature.Empty) + Console.Error.WriteLine ("Warning: Couldn't handle async MethodReturn message for request id " + method_return.ReplySerial + " with signature '" + msg.Signature + "'"); + break; + case MessageType.Error: + //TODO: better exception handling + Error error = new Error (msg); + string errMsg = ""; + if (msg.Signature.Value == "s") { + MessageReader reader = new MessageReader (msg); + reader.GetValue (out errMsg); + } + //throw new Exception ("Remote Error: Signature='" + msg.Signature.Value + "' " + error.ErrorName + ": " + errMsg); + //if (Protocol.Verbose) + Console.Error.WriteLine ("Remote Error: Signature='" + msg.Signature.Value + "' " + error.ErrorName + ": " + errMsg); + break; + case MessageType.Signal: + //HandleSignal (msg); + lock (Inbound) + Inbound.Enqueue (msg); + break; + case MessageType.Invalid: + default: + throw new Exception ("Invalid message received: MessageType='" + msg.Header.MessageType + "'"); + } + } + + protected Dictionary PendingCalls = new Dictionary (); + + + //this might need reworking with MulticastDelegate + protected void HandleSignal (Message msg) + { + Signal signal = new Signal (msg); + + string matchRule = MessageFilter.CreateMatchRule (MessageType.Signal, signal.Path, signal.Interface, signal.Member); + + if (Handlers.ContainsKey (matchRule)) { + Delegate dlg = Handlers[matchRule]; + //dlg.DynamicInvoke (GetDynamicValues (msg)); + + MethodInfo mi = dlg.Method; + //signals have no return value + dlg.DynamicInvoke (MessageHelper.GetDynamicValues (msg, mi.GetParameters ())); + + } else { + //TODO: how should we handle this condition? sending an Error may not be appropriate in this case + if (Protocol.Verbose) + Console.Error.WriteLine ("Warning: No signal handler for " + signal.Member); + } + } + + public Dictionary Handlers = new Dictionary (); + + //not particularly efficient and needs to be generalized + protected void HandleMethodCall (MethodCall method_call) + { + //Console.Error.WriteLine ("method_call destination: " + method_call.Destination); + //Console.Error.WriteLine ("method_call path: " + method_call.Path); + + //TODO: Ping and Introspect need to be abstracted and moved somewhere more appropriate once message filter infrastructure is complete + + if (method_call.Interface == "org.freedesktop.DBus.Peer" && method_call.Member == "Ping") { + object[] pingRet = new object[0]; + Message reply = MessageHelper.ConstructReplyFor (method_call, pingRet); + Send (reply); + return; + } + + if (method_call.Interface == "org.freedesktop.DBus.Introspectable" && method_call.Member == "Introspect") { + Introspector intro = new Introspector (); + intro.root_path = method_call.Path; + //FIXME: do this properly + foreach (ObjectPath pth in RegisteredObjects.Keys) { + if (pth.Value.StartsWith (method_call.Path.Value)) { + intro.target_path = pth; + intro.target_type = RegisteredObjects[pth].GetType (); + } + } + intro.HandleIntrospect (); + //Console.Error.WriteLine (intro.xml); + + object[] introRet = new object[1]; + introRet[0] = intro.xml; + Message reply = MessageHelper.ConstructReplyFor (method_call, introRet); + Send (reply); + return; + } + + if (RegisteredObjects.ContainsKey (method_call.Path)) { + object obj = RegisteredObjects[method_call.Path]; + Type type = obj.GetType (); + //object retObj = type.InvokeMember (msg.Member, BindingFlags.InvokeMethod, null, obj, MessageHelper.GetDynamicValues (msg)); + + string methodName = method_call.Member; + + //map property accessors + //FIXME: this needs to be done properly, not with simple String.Replace + //special case for Notifications left as a reminder that this is broken + if (method_call.Interface == "org.freedesktop.Notifications") { + methodName = methodName.Replace ("Get", "get_"); + methodName = methodName.Replace ("Set", "set_"); + } + + //FIXME: breaks for overloaded methods + MethodInfo mi = type.GetMethod (methodName, BindingFlags.Public | BindingFlags.Instance); + + //TODO: send errors instead of passing up local exceptions for these + + if (mi == null) + throw new Exception ("The requested method could not be resolved"); + + //FIXME: such a simple approach won't work unfortunately + //if (!Mapper.IsPublic (mi)) + // throw new Exception ("The resolved method is not marked as being public on this bus"); + + object retObj = null; + try { + object[] inArgs = MessageHelper.GetDynamicValues (method_call.message, mi.GetParameters ()); + retObj = mi.Invoke (obj, inArgs); + } catch (TargetInvocationException e) { + //TODO: consider whether it's correct to send an error for calls that don't expect a reply + + //TODO: complete exception sending support + //TODO: method not found etc. exceptions + Exception ie = e.InnerException; + if (Protocol.Verbose) { + Console.Error.WriteLine (); + Console.Error.WriteLine (ie); + Console.Error.WriteLine (); + } + + if (!method_call.message.ReplyExpected) { + Console.Error.WriteLine (); + Console.Error.WriteLine ("Warning: Not sending Error message (" + ie.GetType ().Name + ") as reply because no reply was expected by call to '" + (method_call.Interface + "." + method_call.Member) + "'"); + Console.Error.WriteLine (); + return; + } + + Error error = new Error (Mapper.GetInterfaceName (ie.GetType ()), method_call.message.Header.Serial); + error.message.Signature = new Signature (DType.String); + + MessageWriter writer = new MessageWriter (); + writer.Write (ie.Message); + error.message.Body = writer.ToArray (); + + //TODO: we should be more strict here, but this fallback was added as a quick fix for p2p + if (method_call.Sender != null) + error.message.Header.Fields[FieldCode.Destination] = method_call.Sender; + + error.message.Header.Fields[FieldCode.Interface] = method_call.Interface; + error.message.Header.Fields[FieldCode.Member] = method_call.Member; + + Send (error.message); + return; + } + + if (method_call.message.ReplyExpected) { + /* + object[] retObjs; + + if (retObj == null) { + retObjs = new object[0]; + } else { + retObjs = new object[1]; + retObjs[0] = retObj; + } + + Message reply = ConstructReplyFor (method_call, retObjs); + */ + Message reply = MessageHelper.ConstructReplyFor (method_call, mi.ReturnType, retObj); + Send (reply); + } + } else { + //FIXME: send the appropriate Error message + Console.Error.WriteLine ("Warning: No method handler for " + method_call.Member); + } + } + + protected Dictionary RegisteredObjects = new Dictionary (); + + //FIXME: this shouldn't be part of the core API + //that also applies to much of the other object mapping code + //it should cache proxies and objects, really + + //inspired by System.Activator + public object GetObject (Type type, string bus_name, ObjectPath path) + { + BusObject busObject = new BusObject (this, bus_name, path); + DProxy prox = new DProxy (busObject, type); + return prox.GetTransparentProxy (); + } + + /* + public object GetObject (Type type, string bus_name, ObjectPath path) + { + return BusObject.GetObject (this, bus_name, path, type); + } + */ + + public T GetObject (string bus_name, ObjectPath path) + { + return (T)GetObject (typeof (T), bus_name, path); + } + + public void Register (string bus_name, ObjectPath path, object obj) + { + Type type = obj.GetType (); + + BusObject busObject = new BusObject (this, bus_name, path); + + foreach (EventInfo ei in type.GetEvents (BindingFlags.Public | BindingFlags.Instance)) { + //hook up only events that are public to the bus + if (!Mapper.IsPublic (ei)) + continue; + + Delegate dlg = busObject.GetHookupDelegate (ei); + ei.AddEventHandler (obj, dlg); + } + + //FIXME: implement some kind of tree data structure or internal object hierarchy. right now we are ignoring the name and putting all object paths in one namespace, which is bad + RegisteredObjects[path] = obj; + } + + public object Unregister (string bus_name, ObjectPath path) + { + //TODO: make use of bus_name + + if (!RegisteredObjects.ContainsKey (path)) + throw new Exception ("Cannot unmarshal " + path + " as it isn't marshaled"); + object obj = RegisteredObjects[path]; + + RegisteredObjects.Remove (path); + + //FIXME: complete unmarshaling including the handlers we added etc. + + return obj; + } + + //these look out of place, but are useful + public virtual void AddMatch (string rule) + { + } + + public virtual void RemoveMatch (string rule) + { + } + + static Connection () + { + if (BitConverter.IsLittleEndian) + NativeEndianness = EndianFlag.Little; + else + NativeEndianness = EndianFlag.Big; + } + + public static readonly EndianFlag NativeEndianness; + } +} diff -urNad telepathy-sharp-0.0.svn.20060831/dbus-sharp/DBus.cs telepathy-sharp-0.0.svn.20070221/dbus-sharp/DBus.cs --- telepathy-sharp-0.0.svn.20060831/dbus-sharp/DBus.cs 1970-01-01 01:00:00.000000000 +0100 +++ telepathy-sharp-0.0.svn.20070221/dbus-sharp/DBus.cs 2007-02-21 19:10:38.000000000 +0100 @@ -0,0 +1,118 @@ +// Copyright 2006 Alp Toker +// This software is made available under the MIT License +// See COPYING for details + +using System; +using NDesk.DBus; + +//namespace org.freedesktop.DBus +namespace org.freedesktop.DBus +{ + /* + //what's this for? + public class DBusException : ApplicationException + { + } + */ + +#if UNDOCUMENTED_IN_SPEC + //TODO: maybe this should be mapped to its CLR counterpart directly? + //not yet used + [Interface ("org.freedesktop.DBus.Error.InvalidArgs")] + public class InvalidArgsException : ApplicationException + { + } +#endif + + [Flags] + public enum NameFlag : uint + { + None = 0, + AllowReplacement = 0x1, + ReplaceExisting = 0x2, + DoNotQueue = 0x4, + } + + public enum NameReply : uint + { + PrimaryOwner = 1, + InQueue, + Exists, + AlreadyOwner, + } + + public enum ReleaseNameReply : uint + { + Released = 1, + NonExistent, + NotOwner, + } + + public enum StartReply : uint + { + //The service was successfully started. + Success = 1, + //A connection already owns the given name. + AlreadyRunning, + } + + public delegate void NameOwnerChangedHandler (string name, string old_owner, string new_owner); + public delegate void NameAcquiredHandler (string name); + public delegate void NameLostHandler (string name); + + [Interface ("org.freedesktop.DBus.Peer")] + public interface Peer + { + void Ping (); + [return: Argument ("machine_uuid")] + string GetMachineId (); + } + + [Interface ("org.freedesktop.DBus.Introspectable")] + public interface Introspectable + { + [return: Argument ("data")] + string Introspect (); + } + + [Interface ("org.freedesktop.DBus.Properties")] + public interface Properties + { + //TODO: some kind of indexer mapping? + //object this [string propname] {get; set;} + + [return: Argument ("value")] + object Get (string @interface, string propname); + //void Get (string @interface, string propname, out object value); + void Set (string @interface, string propname, object value); + } + + [Interface ("org.freedesktop.DBus")] + public interface IBus : Introspectable + { + NameReply RequestName (string name, NameFlag flags); + ReleaseNameReply ReleaseName (string name); + string Hello (); + string[] ListNames (); + string[] ListActivatableNames (); + bool NameHasOwner (string name); + event NameOwnerChangedHandler NameOwnerChanged; + event NameLostHandler NameLost; + event NameAcquiredHandler NameAcquired; + StartReply StartServiceByName (string name, uint flags); + string GetNameOwner (string name); + uint GetConnectionUnixUser (string connection_name); + void AddMatch (string rule); + void RemoveMatch (string rule); + + //undocumented in spec + [Obsolete ("Undocumented in spec")] + string[] ListQueuedOwners (string name); + [Obsolete ("Undocumented in spec")] + uint GetConnectionUnixProcessID (string connection_name); + [Obsolete ("Undocumented in spec")] + byte[] GetConnectionSELinuxSecurityContext (string connection_name); + [Obsolete ("Undocumented in spec")] + void ReloadConfig (); + } +} diff -urNad telepathy-sharp-0.0.svn.20060831/dbus-sharp/DProxy.cs telepathy-sharp-0.0.svn.20070221/dbus-sharp/DProxy.cs --- telepathy-sharp-0.0.svn.20060831/dbus-sharp/DProxy.cs 1970-01-01 01:00:00.000000000 +0100 +++ telepathy-sharp-0.0.svn.20070221/dbus-sharp/DProxy.cs 2007-02-21 19:10:38.000000000 +0100 @@ -0,0 +1,51 @@ +// Copyright 2006 Alp Toker +// This software is made available under the MIT License +// See COPYING for details + +using System; +using System.Runtime.Remoting.Proxies; +using System.Runtime.Remoting.Messaging; + +namespace NDesk.DBus +{ + //marked internal because this is really an implementation detail and needs to be replaced + internal class DProxy : RealProxy + { + protected BusObject busObject; + + public DProxy (BusObject busObject, Type type) : base(type) + { + this.busObject = busObject; + } + + public override IMessage Invoke (IMessage message) + { + IMethodCallMessage callMessage = (IMethodCallMessage) message; + + object[] outArgs; + object retVal; + Exception exception; + busObject.Invoke (callMessage.MethodBase, callMessage.MethodName, callMessage.InArgs, out outArgs, out retVal, out exception); + + MethodReturnMessageWrapper returnMessage = new MethodReturnMessageWrapper ((IMethodReturnMessage) message); + returnMessage.Exception = exception; + returnMessage.ReturnValue = retVal; + + return returnMessage; + } + + /* + public override ObjRef CreateObjRef (Type ServerType) + { + throw new System.NotImplementedException (); + } + */ + + ~DProxy () + { + //FIXME: remove handlers/match rules here + if (Protocol.Verbose) + Console.Error.WriteLine ("Warning: Finalization of " + busObject.Path + " not yet supported"); + } + } +} diff -urNad telepathy-sharp-0.0.svn.20060831/dbus-sharp/examples/Makefile telepathy-sharp-0.0.svn.20070221/dbus-sharp/examples/Makefile --- telepathy-sharp-0.0.svn.20060831/dbus-sharp/examples/Makefile 2006-09-25 20:22:03.000000000 +0200 +++ telepathy-sharp-0.0.svn.20070221/dbus-sharp/examples/Makefile 1970-01-01 01:00:00.000000000 +0100 @@ -1,28 +0,0 @@ -DBUS_SHARP_PREFIX=.. - -VPATH=$(DBUS_SHARP_PREFIX)/src - -all: run test.exe test-sample.exe test-export.exe test-exceptions.exe test-notifications.exe - -test.exe: NDesk.DBus.dll Test.cs - -test-sample.exe: NDesk.DBus.dll TestSample.cs - -test-export.exe: NDesk.DBus.dll TestExport.cs - -test-exceptions.exe: NDesk.DBus.dll TestExceptions.cs - -test-server.exe: REFS=Mono.Posix - -test-server.exe: NDesk.DBus.dll TestServer.cs - -test-notifications.exe: NDesk.DBus.dll Notifications.cs TestNotifications.cs - -run: - echo '#!/bin/sh' > $@ - echo 'export MONO_PATH=$(DBUS_SHARP_PREFIX)/src:$$MONO_PATH' >> $@ - echo '$(RUNTIME) $$@' >> $@ - chmod +x $@ - - -include ../include.mk diff -urNad telepathy-sharp-0.0.svn.20060831/dbus-sharp/examples/Notifications.cs telepathy-sharp-0.0.svn.20070221/dbus-sharp/examples/Notifications.cs --- telepathy-sharp-0.0.svn.20060831/dbus-sharp/examples/Notifications.cs 2006-09-25 20:22:03.000000000 +0200 +++ telepathy-sharp-0.0.svn.20070221/dbus-sharp/examples/Notifications.cs 1970-01-01 01:00:00.000000000 +0100 @@ -1,31 +0,0 @@ -// Copyright 2006 Alp Toker -// This software is made available under the MIT License -// See COPYING for details - -using System; -using System.Collections.Generic; - -using NDesk.DBus; -using org.freedesktop.DBus; - -// Hand-written interfaces for bootstrapping - -namespace org.freedesktop -{ - public struct ServerInformation - { - public string Name; - public string Vendor; - public string Version; - public string SpecVersion; - } - - [Interface ("org.freedesktop.Notifications")] - public interface Notifications : Introspectable, Properties - { - ServerInformation ServerInformation { get; } - string[] Capabilities { get; } - void CloseNotification (uint id); - uint Notify (string app_name, uint id, string icon, string summary, string body, string[] actions, IDictionary hints, int timeout); - } -} diff -urNad telepathy-sharp-0.0.svn.20060831/dbus-sharp/examples/Test.cs telepathy-sharp-0.0.svn.20070221/dbus-sharp/examples/Test.cs --- telepathy-sharp-0.0.svn.20060831/dbus-sharp/examples/Test.cs 2006-09-25 20:22:03.000000000 +0200 +++ telepathy-sharp-0.0.svn.20070221/dbus-sharp/examples/Test.cs 1970-01-01 01:00:00.000000000 +0100 @@ -1,43 +0,0 @@ -// Copyright 2006 Alp Toker -// This software is made available under the MIT License -// See COPYING for details - -using System; -using NDesk.DBus; -using org.freedesktop.DBus; - -public class ManagedDBusTest -{ - public static void Main () - { - Connection conn = new Connection (); - - ObjectPath opath = new ObjectPath ("/org/freedesktop/DBus"); - string name = "org.freedesktop.DBus"; - - Bus bus = conn.GetObject (name, opath); - - bus.NameAcquired += delegate (string acquired_name) { - Console.WriteLine ("NameAcquired: " + acquired_name); - }; - - string myName = bus.Hello (); - Console.WriteLine ("myName: " + myName); - - Console.WriteLine (); - string xmlData = bus.Introspect (); - Console.WriteLine ("xmlData: " + xmlData); - - Console.WriteLine (); - foreach (string n in bus.ListNames ()) - Console.WriteLine (n); - - Console.WriteLine (); - foreach (string n in bus.ListNames ()) - Console.WriteLine ("Name " + n + " has owner: " + bus.NameHasOwner (n)); - - Console.WriteLine (); - //Console.WriteLine ("NameHasOwner: " + dbus.NameHasOwner (name)); - //Console.WriteLine ("NameHasOwner: " + dbus.NameHasOwner ("fiz")); - } -} diff -urNad telepathy-sharp-0.0.svn.20060831/dbus-sharp/examples/TestExceptions.cs telepathy-sharp-0.0.svn.20070221/dbus-sharp/examples/TestExceptions.cs --- telepathy-sharp-0.0.svn.20060831/dbus-sharp/examples/TestExceptions.cs 2006-09-25 20:22:03.000000000 +0200 +++ telepathy-sharp-0.0.svn.20070221/dbus-sharp/examples/TestExceptions.cs 1970-01-01 01:00:00.000000000 +0100 @@ -1,75 +0,0 @@ -// Copyright 2006 Alp Toker -// This software is made available under the MIT License -// See COPYING for details - -using System; -using System.Collections.Generic; -using NDesk.DBus; -using org.freedesktop.DBus; - -public class ManagedDBusTestExceptions -{ - public static void Main () - { - Connection conn = new Connection (); - - //begin ugly bits - ObjectPath opath = new ObjectPath ("/org/freedesktop/DBus"); - string name = "org.freedesktop.DBus"; - - Bus bus = conn.GetObject (name, opath); - - bus.NameAcquired += delegate (string acquired_name) { - Console.WriteLine ("NameAcquired: " + acquired_name); - }; - - string myName = bus.Hello (); - Console.WriteLine ("myName: " + myName); - - - ObjectPath myOpath = new ObjectPath ("/org/ndesk/testexceptions"); - string myNameReq = "org.ndesk.testexceptions"; - - DemoObject demo; - - if (bus.NameHasOwner (myNameReq)) { - demo = conn.GetObject (myNameReq, myOpath); - } else { - NameReply nameReply = bus.RequestName (myNameReq, NameFlag.None); - - Console.WriteLine ("nameReply: " + nameReply); - - demo = new DemoObject (); - conn.Marshal (demo, myNameReq, myOpath); - - while (true) - conn.Iterate (); - } - //end ugly bits - - Console.WriteLine (); - //org.freedesktop.DBus.Error.InvalidArgs: Requested bus name "" is not valid - try { - bus.RequestName ("", NameFlag.None); - } catch (Exception e) { - Console.WriteLine (e); - } - - //TODO: make this work as expected (what is expected?) - Console.WriteLine (); - demo.ThrowSomeException (); - //handle the thrown exception - conn.Iterate (); - } -} - -[Interface ("org.ndesk.testexceptions")] -public class DemoObject : MarshalByRefObject -{ - public void ThrowSomeException () - { - Console.WriteLine ("Asked to throw some Exception"); - - throw new Exception ("Some Exception"); - } -} diff -urNad telepathy-sharp-0.0.svn.20060831/dbus-sharp/examples/TestExport.cs telepathy-sharp-0.0.svn.20070221/dbus-sharp/examples/TestExport.cs --- telepathy-sharp-0.0.svn.20060831/dbus-sharp/examples/TestExport.cs 2006-09-25 20:22:03.000000000 +0200 +++ telepathy-sharp-0.0.svn.20070221/dbus-sharp/examples/TestExport.cs 1970-01-01 01:00:00.000000000 +0100 @@ -1,234 +0,0 @@ -// Copyright 2006 Alp Toker -// This software is made available under the MIT License -// See COPYING for details - -using System; -using System.Collections.Generic; -using NDesk.DBus; -using org.freedesktop.DBus; - -public class ManagedDBusTestExport -{ - public static void Main () - { - Connection conn = new Connection (); - - //begin ugly bits - ObjectPath opath = new ObjectPath ("/org/freedesktop/DBus"); - string name = "org.freedesktop.DBus"; - - Bus bus = conn.GetObject (name, opath); - - bus.NameAcquired += delegate (string acquired_name) { - Console.WriteLine ("NameAcquired: " + acquired_name); - }; - - string myName = bus.Hello (); - Console.WriteLine ("myName: " + myName); - - - ObjectPath myOpath = new ObjectPath ("/org/ndesk/test"); - string myNameReq = "org.ndesk.test"; - - DemoObject demo; - - if (bus.NameHasOwner (myNameReq)) { - demo = conn.GetObject (myNameReq, myOpath); - } else { - NameReply nameReply = bus.RequestName (myNameReq, NameFlag.None); - - Console.WriteLine ("nameReply: " + nameReply); - - demo = new DemoObject (); - conn.Marshal (demo, myNameReq, myOpath); - - while (true) - conn.Iterate (); - } - //end ugly bits - - demo.Say ("Hello world!"); - demo.Say ("Sibérie"); - Console.WriteLine (demo.EchoCaps ("foo bar")); - Console.WriteLine (demo.GetEnum ()); - demo.CheckEnum (DemoEnum.Bar); - demo.CheckEnum (demo.GetEnum ()); - - /* - Console.WriteLine (); - string outVal; - demo.ReturnOut (out outVal); - Console.WriteLine ("outVal: " + outVal); - */ - - Console.WriteLine (); - string[] texts = {"one", "two", "three"}; - texts = demo.EchoCapsArr (texts); - foreach (string text in texts) - Console.WriteLine (text); - - Console.WriteLine (); - string[][] arrarr = demo.ArrArr (); - Console.WriteLine (arrarr[1][0]); - - Console.WriteLine (); - int[] vals = demo.TextToInts ("1 2 3"); - foreach (int val in vals) - Console.WriteLine (val); - - Console.WriteLine (); - MyTuple fooTuple = demo.GetTuple (); - Console.WriteLine ("A: " + fooTuple.A); - Console.WriteLine ("B: " + fooTuple.B); - - Console.WriteLine (); - //KeyValuePair[] kvps = demo.GetDict (); - IDictionary dict = demo.GetDict (); - foreach (KeyValuePair kvp in dict) - Console.WriteLine (kvp.Key + ": " + kvp.Value); - - Console.WriteLine (); - demo.SomeEvent += delegate (string arg1, int arg2, double arg3, MyTuple mt) {Console.WriteLine ("SomeEvent handler: " + arg1 + ", " + arg2 + ", " + arg3 + ", " + mt.A + ", " + mt.B);}; - demo.FireOffSomeEvent (); - //handle the raised signal - conn.Iterate (); - } -} - -[Interface ("org.ndesk.test")] -public class DemoObject : MarshalByRefObject -{ - public void Say (string text) - { - Console.WriteLine (text); - } - - public string EchoCaps (string text) - { - return text.ToUpper (); - } - - public void CheckEnum (DemoEnum e) - { - Console.WriteLine (e); - } - - public DemoEnum GetEnum () - { - return DemoEnum.Bar; - } - - //this doesn't work yet, except for introspection - public DemoEnum EnumState - { - get { - return DemoEnum.Bar; - } set { - Console.WriteLine ("EnumState prop set to " + value); - } - } - - /* - public void ReturnOut (out string val) - { - val = "out value"; - } - */ - - public string[] EchoCapsArr (string[] texts) - { - string[] retTexts = new string[texts.Length]; - - for (int i = 0 ; i != texts.Length ; i++) - retTexts[i] = texts[i].ToUpper (); - - return retTexts; - } - - public string[][] ArrArr () - { - string[][] ret = new string[2][]; - - ret[0] = new string[] {"one", "two"}; - ret[1] = new string[] {"three", "four"}; - - return ret; - } - - public int[] TextToInts (string text) - { - string[] parts = text.Split (' '); - int[] rets = new int[parts.Length]; - - for (int i = 0 ; i != parts.Length ; i++) - rets[i] = Int32.Parse (parts[i]); - - return rets; - } - - public MyTuple GetTuple () - { - MyTuple tup; - - tup.A = "alpha"; - tup.B = "beta"; - - return tup; - } - - public IDictionary GetDict () - { - Dictionary dict = new Dictionary (); - - dict["one"] = "1"; - dict["two"] = "2"; - - return dict; - } - - /* - public KeyValuePair[] GetDict () - { - KeyValuePair[] rets = new KeyValuePair[2]; - - //rets[0] = new KeyValuePair ("one", "1"); - //rets[1] = new KeyValuePair ("two", "2"); - - rets[0] = new KeyValuePair ("second", " from example-service.py"); - rets[1] = new KeyValuePair ("first", "Hello Dict"); - - return rets; - } - */ - - public event SomeEventHandler SomeEvent; - - public void FireOffSomeEvent () - { - Console.WriteLine ("Asked to fire off SomeEvent"); - - MyTuple mt; - mt.A = "a"; - mt.B = "b"; - - if (SomeEvent != null) { - SomeEvent ("some string", 21, 19.84, mt); - Console.WriteLine ("Fired off SomeEvent"); - } - } -} - -public enum DemoEnum -{ - Foo, - Bar, -} - - -public struct MyTuple -{ - public string A; - public string B; -} - -public delegate void SomeEventHandler (string arg1, int arg2, double arg3, MyTuple mt); diff -urNad telepathy-sharp-0.0.svn.20060831/dbus-sharp/examples/TestNotifications.cs telepathy-sharp-0.0.svn.20070221/dbus-sharp/examples/TestNotifications.cs --- telepathy-sharp-0.0.svn.20060831/dbus-sharp/examples/TestNotifications.cs 2006-09-25 20:22:03.000000000 +0200 +++ telepathy-sharp-0.0.svn.20070221/dbus-sharp/examples/TestNotifications.cs 1970-01-01 01:00:00.000000000 +0100 @@ -1,51 +0,0 @@ -// Copyright 2006 Alp Toker -// This software is made available under the MIT License -// See COPYING for details - -using System; -using System.Collections.Generic; - -using NDesk.DBus; -using org.freedesktop; -using org.freedesktop.DBus; - -// Just for fun. A more complete implementation would cover the API at: -// http://www.galago-project.org/docs/api/libnotify/notification_8h.html -public class ManagedDBusTestNotifications -{ - public static void Main () - { - Connection conn = new Connection (); - - ObjectPath opath = new ObjectPath ("/org/freedesktop/DBus"); - string name = "org.freedesktop.DBus"; - - Bus bus = conn.GetObject (name, opath); - - bus.NameAcquired += delegate (string acquired_name) { - Console.WriteLine ("NameAcquired: " + acquired_name); - }; - - string myName = bus.Hello (); - Console.WriteLine ("myName: " + myName); - - Notifications nf = conn.GetObject ("org.freedesktop.Notifications", new ObjectPath ("/org/freedesktop/Notifications")); - - Console.WriteLine (); - Console.WriteLine ("Capabilities:"); - foreach (string cap in nf.Capabilities) - Console.WriteLine ("\t" + cap); - - ServerInformation si = nf.ServerInformation; - - //TODO: ability to pass null - Dictionary hints = new Dictionary (); - - string message = String.Format ("Brought to you using {0} {1} (implementing spec version {2}) from {3}.", si.Name, si.Version, si.SpecVersion, si.Vendor); - - uint handle = nf.Notify ("D-Bus# Notifications Demo", 0, "warning", "Managed D-Bus# says 'Hello'!", message, new string[0], hints, 0); - - Console.WriteLine (); - Console.WriteLine ("Got handle " + handle); - } -} diff -urNad telepathy-sharp-0.0.svn.20060831/dbus-sharp/examples/TestSample.cs telepathy-sharp-0.0.svn.20070221/dbus-sharp/examples/TestSample.cs --- telepathy-sharp-0.0.svn.20060831/dbus-sharp/examples/TestSample.cs 2006-09-25 20:22:03.000000000 +0200 +++ telepathy-sharp-0.0.svn.20070221/dbus-sharp/examples/TestSample.cs 1970-01-01 01:00:00.000000000 +0100 @@ -1,66 +0,0 @@ -// Copyright 2006 Alp Toker -// This software is made available under the MIT License -// See COPYING for details - -using System; -using System.Collections.Generic; -using NDesk.DBus; -using org.freedesktop.DBus; - -public class ManagedDBusTestSample -{ - public static void Main () - { - Connection conn = new Connection (); - - ObjectPath opath = new ObjectPath ("/org/freedesktop/DBus"); - string name = "org.freedesktop.DBus"; - - Bus bus = conn.GetObject (name, opath); - - bus.NameAcquired += delegate (string acquired_name) { - Console.WriteLine ("NameAcquired: " + acquired_name); - }; - - string myName = bus.Hello (); - Console.WriteLine ("myName: " + myName); - - SampleInterface sample = conn.GetObject ("org.designfu.SampleService", new ObjectPath ("/SomeObject")); - - Console.WriteLine (); - string xmlData = sample.Introspect (); - Console.WriteLine ("xmlData: " + xmlData); - - //object obj = sample.HelloWorld ("Hello from example-client.py!"); - string[] vals = sample.HelloWorld ("Hello from example-client.py!"); - foreach (string val in vals) - Console.WriteLine (val); - - Console.WriteLine (); - MyTuple tup = sample.GetTuple (); - Console.WriteLine (tup.A); - Console.WriteLine (tup.B); - - Console.WriteLine (); - IDictionary dict = sample.GetDict (); - foreach (KeyValuePair pair in dict) - Console.WriteLine (pair.Key + ": " + pair.Value); - } -} - -[Interface ("org.designfu.SampleInterface")] -public interface SampleInterface : Introspectable -{ - //void HelloWorld (object hello_message); - //object HelloWorld (object hello_message); - string[] HelloWorld (object hello_message); - MyTuple GetTuple (); - IDictionary GetDict (); -} - -//(ss) -public struct MyTuple -{ - public string A; - public string B; -} diff -urNad telepathy-sharp-0.0.svn.20060831/dbus-sharp/examples/TestServer.cs telepathy-sharp-0.0.svn.20070221/dbus-sharp/examples/TestServer.cs --- telepathy-sharp-0.0.svn.20060831/dbus-sharp/examples/TestServer.cs 2006-09-25 20:22:03.000000000 +0200 +++ telepathy-sharp-0.0.svn.20070221/dbus-sharp/examples/TestServer.cs 1970-01-01 01:00:00.000000000 +0100 @@ -1,132 +0,0 @@ -// Copyright 2006 Alp Toker -// This software is made available under the MIT License -// See COPYING for details - -using System; -using NDesk.DBus; -using org.freedesktop.DBus; - -using System.IO; -using System.Net; -using System.Net.Sockets; -using Mono.Unix; - -using System.Threading; - -public class TestServer -{ - //TODO: complete this test daemon/server example, and a client - //TODO: maybe generalise it and integrate it into the core - public static void Main (string[] args) - { - bool isServer; - - if (args.Length == 1 && args[0] == "server") - isServer = true; - else if (args.Length == 1 && args[0] == "client") - isServer = false; - else { - Console.Error.WriteLine ("Usage: test-server [server|client]"); - return; - } - - string addr = "unix:abstract=/tmp/dbus-ABCDEFGHIJ"; - - Connection conn; - - ObjectPath myOpath = new ObjectPath ("/org/ndesk/test"); - string myNameReq = "org.ndesk.test"; - - if (!isServer) { - conn = new Connection (false); - conn.Open (addr); - DemoObject demo = conn.GetObject (myNameReq, myOpath); - //float ret = demo.Hello ("hi from test client", 21); - float ret = 200; - while (ret > 5) { - ret = demo.Hello ("hi from test client", (int)ret); - Console.WriteLine ("Returned float: " + ret); - System.Threading.Thread.Sleep (1000); - } - } else { - string path; - bool abstr; - - Address.Parse (addr, out path, out abstr); - - AbstractUnixEndPoint ep = new AbstractUnixEndPoint (path); - Socket server = new Socket (AddressFamily.Unix, SocketType.Stream, 0); - - server.Bind (ep); - //server.Listen (1); - server.Listen (5); - - while (true) { - Console.WriteLine ("Waiting for client on " + addr); - Socket client = server.Accept (); - Console.WriteLine ("Client accepted"); - client.Blocking = true; - - PeerCred pc = new PeerCred (client); - Console.WriteLine ("PeerCred: pid={0}, uid={1}, gid={2}", pc.ProcessID, pc.UserID, pc.GroupID); - - conn = new Connection (false); - conn.ns = new NetworkStream (client); - conn.SocketHandle = (long)client.Handle; - - //ConnectionHandler.Handle (conn); - - //in reality a thread per connection is of course too expensive - ConnectionHandler hnd = new ConnectionHandler (conn); - new Thread (new ThreadStart (hnd.Handle)).Start (); - - Console.WriteLine (); - } - } - } -} - -public class ConnectionHandler -{ - protected Connection conn; - - public ConnectionHandler (Connection conn) - { - this.conn = conn; - } - - public void Handle () - { - ConnectionHandler.Handle (conn); - } - - public static void Handle (Connection conn) - { - string myNameReq = "org.ndesk.test"; - ObjectPath myOpath = new ObjectPath ("/org/ndesk/test"); - - DemoObject demo = new DemoObject (); - conn.Marshal (demo, myNameReq, myOpath); - - //TODO: handle lost connections etc. properly instead of stupido try/catch - try { - while (true) - conn.Iterate (); - } catch (Exception e) { - //Console.Error.WriteLine (e); - } - - conn.Unmarshal (myNameReq, myOpath); - } -} - -[Interface ("org.ndesk.test")] -public class DemoObject : MarshalByRefObject -{ - public float Hello (string arg0, int arg1) - { - Console.WriteLine ("Got a Hello(" + arg0 + ", " + arg1 +")"); - - return (float)arg1/2; - } -} diff -urNad telepathy-sharp-0.0.svn.20060831/dbus-sharp/ExportObject.cs telepathy-sharp-0.0.svn.20070221/dbus-sharp/ExportObject.cs --- telepathy-sharp-0.0.svn.20060831/dbus-sharp/ExportObject.cs 1970-01-01 01:00:00.000000000 +0100 +++ telepathy-sharp-0.0.svn.20070221/dbus-sharp/ExportObject.cs 2007-02-21 19:10:38.000000000 +0100 @@ -0,0 +1,25 @@ +// Copyright 2006 Alp Toker +// This software is made available under the MIT License +// See COPYING for details + +using System; +using System.Reflection; +using System.Reflection.Emit; + +using org.freedesktop.DBus; + +namespace NDesk.DBus +{ + internal class ExportObject : BusObject, Peer + { + public void Ping () + { + } + + public string GetMachineId () + { + //TODO: implement this + return String.Empty; + } + } +} diff -urNad telepathy-sharp-0.0.svn.20060831/dbus-sharp/.gitignore telepathy-sharp-0.0.svn.20070221/dbus-sharp/.gitignore --- telepathy-sharp-0.0.svn.20060831/dbus-sharp/.gitignore 2006-09-25 20:22:03.000000000 +0200 +++ telepathy-sharp-0.0.svn.20070221/dbus-sharp/.gitignore 1970-01-01 01:00:00.000000000 +0100 @@ -1,3 +0,0 @@ -*.exe -*.dll -*.mdb diff -urNad telepathy-sharp-0.0.svn.20060831/dbus-sharp/include.mk telepathy-sharp-0.0.svn.20070221/dbus-sharp/include.mk --- telepathy-sharp-0.0.svn.20060831/dbus-sharp/include.mk 2006-09-25 20:22:03.000000000 +0200 +++ telepathy-sharp-0.0.svn.20070221/dbus-sharp/include.mk 1970-01-01 01:00:00.000000000 +0100 @@ -1,18 +0,0 @@ -#CSC_DEBUGFLAGS=-debug -d:TRACE -CSC_DEBUGFLAGS=-debug -CSC=gmcs $(CSC_DEBUGFLAGS) -MONO_DEBUGFLAGS=--debug -RUNTIME=mono $(MONO_DEBUGFLAGS) - -#%.exe: -%.exe %.dll %.module: - $(CSC) $(CSFLAGS) -out:$@ -t:$(TARGET) $(addprefix -pkg:,$(PKGS)) $(addprefix -r:,$(REFS)) $(addprefix -r:,$(filter %.dll,$^)) $(addprefix -addmodule:,$(filter %.module,$^)) $(filter %.cs,$^) - -%.exe: TARGET = exe - -%.dll: TARGET = library - -%.module: TARGET = module - -#$(MODULE)_SOURCES := foo.cs - diff -urNad telepathy-sharp-0.0.svn.20060831/dbus-sharp/Introspection.cs telepathy-sharp-0.0.svn.20070221/dbus-sharp/Introspection.cs --- telepathy-sharp-0.0.svn.20060831/dbus-sharp/Introspection.cs 1970-01-01 01:00:00.000000000 +0100 +++ telepathy-sharp-0.0.svn.20070221/dbus-sharp/Introspection.cs 2007-02-21 19:10:38.000000000 +0100 @@ -0,0 +1,325 @@ +// Copyright 2006 Alp Toker +// This software is made available under the MIT License +// See COPYING for details + +using System; +using System.Diagnostics; +using System.Collections.Generic; +using System.IO; +using System.Xml; +using System.Text; +using System.Reflection; + +namespace NDesk.DBus +{ + //TODO: complete this class + public class Introspector + { + const string NAMESPACE = "http://www.freedesktop.org/standards/dbus"; + const string PUBLIC_IDENTIFIER = "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN"; + const string SYSTEM_IDENTIFIER = "http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd"; + + public StringBuilder sb; + public string xml; + public Type target_type = null; + public ObjectPath root_path = ObjectPath.Root; + public ObjectPath target_path = ObjectPath.Root; + + protected XmlWriter writer; + + public Introspector () + { + XmlWriterSettings settings = new XmlWriterSettings (); + settings.Indent = true; + settings.IndentChars = (" "); + settings.OmitXmlDeclaration = true; + + sb = new StringBuilder (); + + writer = XmlWriter.Create (sb, settings); + } + + public void HandleIntrospect () + { + writer.WriteDocType ("node", PUBLIC_IDENTIFIER, SYSTEM_IDENTIFIER, null); + + //TODO: write version info in a comment, when we get an AssemblyInfo.cs + + writer.WriteComment (" Never rely on XML introspection data for dynamic binding. It is provided only for convenience and is subject to change at any time. "); + + writer.WriteComment (" Warning: Intospection support is incomplete in this implementation "); + + writer.WriteComment (" This is the introspection result for ObjectPath: " + root_path + " "); + + //the root node element + writer.WriteStartElement ("node"); + + //FIXME: don't hardcode this stuff, do it properly! + if (root_path.Value == "/") { + writer.WriteStartElement ("node"); + writer.WriteAttributeString ("name", "org"); + writer.WriteEndElement (); + } + + if (root_path.Value == "/org") { + writer.WriteStartElement ("node"); + writer.WriteAttributeString ("name", "ndesk"); + writer.WriteEndElement (); + } + + if (root_path.Value == "/org/ndesk") { + writer.WriteStartElement ("node"); + writer.WriteAttributeString ("name", "test"); + writer.WriteEndElement (); + } + + if (root_path.Value == target_path.Value) { + WriteNodeBody (); + } + + /* + WriteEnum (typeof (org.freedesktop.DBus.NameFlag)); + WriteEnum (typeof (org.freedesktop.DBus.NameReply)); + WriteEnum (typeof (org.freedesktop.DBus.ReleaseNameReply)); + WriteEnum (typeof (org.freedesktop.DBus.StartReply)); + WriteInterface (typeof (org.freedesktop.DBus.IBus)); + */ + + writer.WriteEndElement (); + + writer.Flush (); + xml = sb.ToString (); + } + + //public void WriteNode () + public void WriteNodeBody () + { + //writer.WriteStartElement ("node"); + + //TODO: non-well-known introspection has paths as well, which we don't do yet. read the spec again + //hackishly just remove the root '/' to make the path relative for now + //writer.WriteAttributeString ("name", target_path.Value.Substring (1)); + //writer.WriteAttributeString ("name", "test"); + + //reflect our own interface manually + WriteInterface (typeof (org.freedesktop.DBus.Introspectable)); + + //reflect the target interface + if (target_type != null) { + WriteInterface (target_type); + + foreach (Type ifType in target_type.GetInterfaces ()) + WriteInterface (ifType); + } + + //TODO: review recursion of interfaces and inheritance hierarchy + + //writer.WriteEndElement (); + } + + public void WriteArg (ParameterInfo pi) + { + WriteArg (pi.ParameterType, Mapper.GetArgumentName (pi), pi.IsOut, false); + } + + public void WriteArgReverse (ParameterInfo pi) + { + WriteArg (pi.ParameterType, Mapper.GetArgumentName (pi), pi.IsOut, true); + } + + //TODO: clean up and get rid of reverse (or argIsOut) parm + public void WriteArg (Type argType, string argName, bool argIsOut, bool reverse) + { + argType = argIsOut ? argType.GetElementType () : argType; + if (argType == typeof (void)) + return; + + //FIXME: remove these special cases, they are just for testing + if (argType.FullName == "GLib.Value") + argType = typeof (object); + if (argType.FullName == "GLib.GType") + argType = typeof (Signature); + + writer.WriteStartElement ("arg"); + + if (!String.IsNullOrEmpty (argName)) + writer.WriteAttributeString ("name", argName); + + //we can't rely on the default direction (qt-dbus requires a direction at time of writing), so we use a boolean to reverse the parameter direction and make it explicit + + if (argIsOut) + writer.WriteAttributeString ("direction", !reverse ? "out" : "in"); + else + writer.WriteAttributeString ("direction", !reverse ? "in" : "out"); + + Signature sig = Signature.GetSig (argType); + + //FIXME: this hides the fact that there are invalid types coming up + //sig.Value = sig.Value.Replace ((char)DType.Invalid, (char)DType.Variant); + //sig.Value = sig.Value.Replace ((char)DType.Single, (char)DType.UInt32); + + //writer.WriteAttributeString ("type", Signature.GetSig (argType).Value); + writer.WriteAttributeString ("type", sig.Value); + + //annotations aren't valid in an arg element, so this is disabled + //if (argType.IsEnum) + // WriteAnnotation ("org.ndesk.DBus.Enum", Mapper.GetInterfaceName (argType)); + + writer.WriteEndElement (); + } + + public void WriteMethod (MethodInfo mi) + { + writer.WriteStartElement ("method"); + writer.WriteAttributeString ("name", mi.Name); + + foreach (ParameterInfo pi in mi.GetParameters ()) + WriteArg (pi); + + //Mono <= 1.1.13 doesn't support MethodInfo.ReturnParameter, so avoid it + //WriteArgReverse (mi.ReturnParameter); + WriteArg (mi.ReturnType, Mapper.GetArgumentName (mi.ReturnTypeCustomAttributes, "ret"), false, true); + + WriteAnnotations (mi); + + writer.WriteEndElement (); + } + + public void WriteProperty (PropertyInfo pri) + { + //expose properties as dbus properties + writer.WriteStartElement ("property"); + writer.WriteAttributeString ("name", pri.Name); + writer.WriteAttributeString ("type", Signature.GetSig (pri.PropertyType).Value); + string access = (pri.CanRead ? "read" : String.Empty) + (pri.CanWrite ? "write" : String.Empty); + writer.WriteAttributeString ("access", access); + WriteAnnotations (pri); + writer.WriteEndElement (); + + //expose properties as methods also + //it may not be worth doing this in the long run + /* + if (pri.CanRead) { + writer.WriteStartElement ("method"); + writer.WriteAttributeString ("name", "Get" + pri.Name); + WriteArgReverse (pri.GetGetMethod ().ReturnParameter); + writer.WriteEndElement (); + } + + if (pri.CanWrite) { + writer.WriteStartElement ("method"); + writer.WriteAttributeString ("name", "Set" + pri.Name); + foreach (ParameterInfo pi in pri.GetSetMethod ().GetParameters ()) + WriteArg (pi); + writer.WriteEndElement (); + } + */ + } + + public void WriteSignal (EventInfo ei) + { + writer.WriteStartElement ("signal"); + writer.WriteAttributeString ("name", ei.Name); + + foreach (ParameterInfo pi in ei.EventHandlerType.GetMethod ("Invoke").GetParameters ()) + WriteArgReverse (pi); + + WriteAnnotations (ei); + + //no need to consider the delegate return value as dbus doesn't support it + writer.WriteEndElement (); + } + + const BindingFlags relevantBindingFlags = BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly; + + public void WriteInterface (Type type) + { + if (type == null) + return; + + //TODO: this is unreliable, fix it + if (!Mapper.IsPublic (type)) + return; + + writer.WriteStartElement ("interface"); + + writer.WriteAttributeString ("name", Mapper.GetInterfaceName (type)); + + /* + foreach (MemberInfo mbi in type.GetMembers (relevantBindingFlags)) { + switch (mbi.MemberType) { + case MemberTypes.Method: + if (!((MethodInfo)mbi).IsSpecialName) + WriteMethod ((MethodInfo)mbi); + break; + case MemberTypes.Event: + WriteSignal ((EventInfo)mbi); + break; + case MemberTypes.Property: + WriteProperty ((PropertyInfo)mbi); + break; + default: + Console.Error.WriteLine ("Warning: Unhandled MemberType '{0}' encountered while introspecting {1}", mbi.MemberType, type.FullName); + break; + } + } + */ + + foreach (MethodInfo mi in type.GetMethods (relevantBindingFlags)) + if (!mi.IsSpecialName) + WriteMethod (mi); + + foreach (EventInfo ei in type.GetEvents (relevantBindingFlags)) + WriteSignal (ei); + + foreach (PropertyInfo pri in type.GetProperties (relevantBindingFlags)) + WriteProperty (pri); + + //TODO: indexers + + //TODO: attributes as annotations? + + writer.WriteEndElement (); + + //this recursion seems somewhat inelegant + WriteInterface (type.BaseType); + } + + public void WriteAnnotations (ICustomAttributeProvider attrProvider) + { + if (Mapper.IsDeprecated (attrProvider)) + WriteAnnotation ("org.freedesktop.DBus.Deprecated", "true"); + } + + public void WriteAnnotation (string name, string value) + { + writer.WriteStartElement ("annotation"); + + writer.WriteAttributeString ("name", name); + writer.WriteAttributeString ("value", value); + + writer.WriteEndElement (); + } + + //this is not in the spec, and is not finalized + public void WriteEnum (Type type) + { + writer.WriteStartElement ("enum"); + writer.WriteAttributeString ("name", Mapper.GetInterfaceName (type)); + writer.WriteAttributeString ("type", Signature.GetSig (type.GetElementType ()).Value); + writer.WriteAttributeString ("flags", (type.IsDefined (typeof (FlagsAttribute), false)) ? "true" : "false"); + + string[] names = Enum.GetNames (type); + + int i = 0; + foreach (Enum val in Enum.GetValues (type)) { + writer.WriteStartElement ("element"); + writer.WriteAttributeString ("name", names[i++]); + writer.WriteAttributeString ("value", val.ToString ("d")); + writer.WriteEndElement (); + } + + writer.WriteEndElement (); + } + } +} diff -urNad telepathy-sharp-0.0.svn.20060831/dbus-sharp/IntrospectionSchema.cs telepathy-sharp-0.0.svn.20070221/dbus-sharp/IntrospectionSchema.cs --- telepathy-sharp-0.0.svn.20060831/dbus-sharp/IntrospectionSchema.cs 1970-01-01 01:00:00.000000000 +0100 +++ telepathy-sharp-0.0.svn.20070221/dbus-sharp/IntrospectionSchema.cs 2007-02-21 19:10:38.000000000 +0100 @@ -0,0 +1,108 @@ +// Copyright 2006 Alp Toker +// This software is made available under the MIT License +// See COPYING for details + +using System.Xml.Serialization; +using System.Collections.Generic; + +namespace Schemas { + + [XmlRootAttribute(IsNullable=true)] + public class Member { + [XmlAttributeAttribute("name")] + public string Name; + } + + /* + public class Node { + + [XmlAttributeAttribute("name")] + public string Name; + + [XmlElementAttribute("node", Type=typeof(Node))] + [XmlElementAttribute("interface", Type=typeof(@Interface))] + public object[] Items; + } + */ + + [XmlRootAttribute("interface", IsNullable=true)] + public class @Interface { + + [XmlAttributeAttribute("name")] + public string Name; + + [XmlElementAttribute("method", Type=typeof(Method))] + [XmlElementAttribute("signal", Type=typeof(Signal))] + [XmlElementAttribute("property", Type=typeof(Property))] + [XmlElementAttribute("annotation", Type=typeof(Annotation))] + public object[] Items; + } + + [XmlRootAttribute(IsNullable=true)] + public class Method : Member { + + /* + [XmlElementAttribute("arg", Type=typeof(Argument))] + [XmlElementAttribute("annotation", Type=typeof(Annotation))] + public object[] Items; + */ + + [XmlElementAttribute("arg", Type=typeof(Argument))] + public List Arguments; + //public Argument[] Arguments; + } + + [XmlRootAttribute(IsNullable=true)] + public class Argument { + + [XmlAttributeAttribute("name")] + public string Name; + + [XmlAttributeAttribute("type")] + public string Type; + + [System.ComponentModel.DefaultValue(ArgDirection.@in)] + [XmlAttributeAttribute("direction")] + public ArgDirection Direction = ArgDirection.@in; + } + + public enum ArgDirection { + @in, + @out, + } + + [XmlRootAttribute(IsNullable=true)] + public class Annotation { + + [XmlAttributeAttribute("name")] + public string Name; + + [XmlAttributeAttribute("value")] + public string Value; + } + + [XmlRootAttribute("signal", IsNullable=true)] + public class Signal : Member { + [XmlElementAttribute("arg", Type=typeof(Argument))] + [XmlElementAttribute("annotation", Type=typeof(Annotation))] + public object[] Items; + } + + [XmlRootAttribute(IsNullable=true)] + public class Property : Member { + [XmlAttributeAttribute("type")] + public string Type; + + [XmlAttributeAttribute("access")] + public propertyAccess Access; + + [XmlElementAttribute("annotation")] + public Annotation[] Annotation; + } + + public enum propertyAccess { + read, + write, + readwrite, + } +} diff -urNad telepathy-sharp-0.0.svn.20060831/dbus-sharp/Makefile telepathy-sharp-0.0.svn.20070221/dbus-sharp/Makefile --- telepathy-sharp-0.0.svn.20060831/dbus-sharp/Makefile 2006-09-25 22:10:53.000000000 +0200 +++ telepathy-sharp-0.0.svn.20070221/dbus-sharp/Makefile 1970-01-01 01:00:00.000000000 +0100 @@ -1,8 +0,0 @@ -all: - $(MAKE) -C src - $(MAKE) -C tools -install: - test -z "/usr/lib/telepathy-sharp" || mkdir -p -- $(DESTDIR)usr/lib/telepathy-sharp - /usr/bin/install -c -m 644 './src/NDesk.DBus.dll'\ - $(DESTDIR)/usr/lib/telepathy-sharp/NDesk.DBus.dll - diff -urNad telepathy-sharp-0.0.svn.20060831/dbus-sharp/Makefile.am telepathy-sharp-0.0.svn.20070221/dbus-sharp/Makefile.am --- telepathy-sharp-0.0.svn.20060831/dbus-sharp/Makefile.am 1970-01-01 01:00:00.000000000 +0100 +++ telepathy-sharp-0.0.svn.20070221/dbus-sharp/Makefile.am 2007-02-21 19:41:44.000000000 +0100 @@ -0,0 +1,42 @@ +CSC_FLAGS = -debug -unsafe + +ASSEMBLY_NAME = NDesk.DBus +ASSEMBLY = $(ASSEMBLY_NAME).dll +NDesk_DBusdir = $(pkglibdir) +NDesk_DBus_SCRIPTS = $(ASSEMBLY) + +TARGET = $(ASSEMBLY) + +SOURCES= \ + Address.cs \ + AssemblyInfo.cs \ + Authentication.cs \ + Bus.cs \ + BusObject.cs \ + Connection.cs \ + DBus.cs \ + DProxy.cs \ + ExportObject.cs \ + Introspection.cs \ + IntrospectionSchema.cs \ + Mapper.cs \ + Message.cs \ + MessageFilter.cs \ + MessageReader.cs \ + MessageWriter.cs \ + Protocol.cs \ + Server.cs \ + Signature.cs \ + Transport.cs \ + UnixMonoTransport.cs \ + UnixNativeTransport.cs \ + Wrapper.cs + +CLEANFILES = $(ASSEMBLY) $(ASSEMBLY).mdb $(ASSEMBLY).config + +PKG_REFERENCES = -r:Mono.Posix + +$(ASSEMBLY): $(SOURCES) + $(CSC) -target:library -out:$@ $(CSC_FLAGS) $(SOURCES) $(PKG_REFERENCES) + +all: $(ASSEMBLY) diff -urNad telepathy-sharp-0.0.svn.20060831/dbus-sharp/Makefile.in telepathy-sharp-0.0.svn.20070221/dbus-sharp/Makefile.in --- telepathy-sharp-0.0.svn.20060831/dbus-sharp/Makefile.in 1970-01-01 01:00:00.000000000 +0100 +++ telepathy-sharp-0.0.svn.20070221/dbus-sharp/Makefile.in 2007-02-21 21:16:16.000000000 +0100 @@ -0,0 +1,349 @@ +# Makefile.in generated by automake 1.9.6 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005 Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +top_builddir = .. +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +INSTALL = @INSTALL@ +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +target_triplet = @target@ +subdir = dbus-sharp +DIST_COMMON = README $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ + COPYING +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_CLEAN_FILES = +am__installdirs = "$(DESTDIR)$(NDesk_DBusdir)" +NDesk_DBusSCRIPT_INSTALL = $(INSTALL_SCRIPT) +SCRIPTS = $(NDesk_DBus_SCRIPTS) +DIST_SOURCES = +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMTAR = @AMTAR@ +ASM_VERSION = @ASM_VERSION@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CSC = @CSC@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LTLIBOBJS = @LTLIBOBJS@ +MAINT = @MAINT@ +MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ +MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ +MAKEINFO = @MAKEINFO@ +MONO_DEPENDENCY_CFLAGS = @MONO_DEPENDENCY_CFLAGS@ +MONO_DEPENDENCY_LIBS = @MONO_DEPENDENCY_LIBS@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PKG_CONFIG = @PKG_CONFIG@ +RUNTIME = @RUNTIME@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +VERSION = @VERSION@ +am__leading_dot = @am__leading_dot@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +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@ +sysconfdir = @sysconfdir@ +target = @target@ +target_alias = @target_alias@ +target_cpu = @target_cpu@ +target_os = @target_os@ +target_vendor = @target_vendor@ +CSC_FLAGS = -debug -unsafe +ASSEMBLY_NAME = NDesk.DBus +ASSEMBLY = $(ASSEMBLY_NAME).dll +NDesk_DBusdir = $(pkglibdir) +NDesk_DBus_SCRIPTS = $(ASSEMBLY) +TARGET = $(ASSEMBLY) +SOURCES = \ + Address.cs \ + AssemblyInfo.cs \ + Authentication.cs \ + Bus.cs \ + BusObject.cs \ + Connection.cs \ + DBus.cs \ + DProxy.cs \ + ExportObject.cs \ + Introspection.cs \ + IntrospectionSchema.cs \ + Mapper.cs \ + Message.cs \ + MessageFilter.cs \ + MessageReader.cs \ + MessageWriter.cs \ + Protocol.cs \ + Server.cs \ + Signature.cs \ + Transport.cs \ + UnixMonoTransport.cs \ + UnixNativeTransport.cs \ + Wrapper.cs + +CLEANFILES = $(ASSEMBLY) $(ASSEMBLY).mdb $(ASSEMBLY).config +PKG_REFERENCES = -r:Mono.Posix +all: all-am + +.SUFFIXES: +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ + && exit 0; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu dbus-sharp/Makefile'; \ + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu dbus-sharp/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: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +install-NDesk_DBusSCRIPTS: $(NDesk_DBus_SCRIPTS) + @$(NORMAL_INSTALL) + test -z "$(NDesk_DBusdir)" || $(mkdir_p) "$(DESTDIR)$(NDesk_DBusdir)" + @list='$(NDesk_DBus_SCRIPTS)'; for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + if test -f $$d$$p; then \ + f=`echo "$$p" | sed 's|^.*/||;$(transform)'`; \ + echo " $(NDesk_DBusSCRIPT_INSTALL) '$$d$$p' '$(DESTDIR)$(NDesk_DBusdir)/$$f'"; \ + $(NDesk_DBusSCRIPT_INSTALL) "$$d$$p" "$(DESTDIR)$(NDesk_DBusdir)/$$f"; \ + else :; fi; \ + done + +uninstall-NDesk_DBusSCRIPTS: + @$(NORMAL_UNINSTALL) + @list='$(NDesk_DBus_SCRIPTS)'; for p in $$list; do \ + f=`echo "$$p" | sed 's|^.*/||;$(transform)'`; \ + echo " rm -f '$(DESTDIR)$(NDesk_DBusdir)/$$f'"; \ + rm -f "$(DESTDIR)$(NDesk_DBusdir)/$$f"; \ + done +uninstall-info-am: +tags: TAGS +TAGS: + +ctags: CTAGS +CTAGS: + + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ + list='$(DISTFILES)'; for file in $$list; do \ + case $$file in \ + $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ + $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ + esac; \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test "$$dir" != "$$file" && test "$$dir" != "."; then \ + dir="/$$dir"; \ + $(mkdir_p) "$(distdir)$$dir"; \ + else \ + dir=''; \ + fi; \ + if test -d $$d/$$file; then \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(SCRIPTS) +installdirs: + for dir in "$(DESTDIR)$(NDesk_DBusdir)"; do \ + test -z "$$dir" || $(mkdir_p) "$$dir"; \ + done +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic mostlyclean-am + +distclean: distclean-am + -rm -f Makefile +distclean-am: clean-am distclean-generic + +dvi: dvi-am + +dvi-am: + +html: html-am + +info: info-am + +info-am: + +install-data-am: install-NDesk_DBusSCRIPTS + +install-exec-am: + +install-info: install-info-am + +install-man: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-generic + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-NDesk_DBusSCRIPTS uninstall-info-am + +.PHONY: all all-am check check-am clean clean-generic distclean \ + distclean-generic distdir dvi dvi-am html html-am info info-am \ + install install-NDesk_DBusSCRIPTS install-am install-data \ + install-data-am install-exec install-exec-am install-info \ + install-info-am install-man install-strip installcheck \ + installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-generic pdf \ + pdf-am ps ps-am uninstall uninstall-NDesk_DBusSCRIPTS \ + uninstall-am uninstall-info-am + + +$(ASSEMBLY): $(SOURCES) + $(CSC) -target:library -out:$@ $(CSC_FLAGS) $(SOURCES) $(PKG_REFERENCES) + +all: $(ASSEMBLY) +# 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 -urNad telepathy-sharp-0.0.svn.20060831/dbus-sharp/Mapper.cs telepathy-sharp-0.0.svn.20070221/dbus-sharp/Mapper.cs --- telepathy-sharp-0.0.svn.20060831/dbus-sharp/Mapper.cs 1970-01-01 01:00:00.000000000 +0100 +++ telepathy-sharp-0.0.svn.20070221/dbus-sharp/Mapper.cs 2007-02-21 19:10:38.000000000 +0100 @@ -0,0 +1,214 @@ +// Copyright 2006 Alp Toker +// This software is made available under the MIT License +// See COPYING for details + +using System; +using System.Collections.Generic; +using System.Reflection; + +namespace NDesk.DBus +{ + public static class Mapper + { + //TODO: move these Get*Name helpers somewhere more appropriate + public static string GetArgumentName (ParameterInfo pi) + { + string argName = pi.Name; + + if (pi.IsRetval && String.IsNullOrEmpty (argName)) + argName = "ret"; + + return GetArgumentName ((ICustomAttributeProvider)pi, argName); + } + + public static string GetArgumentName (ICustomAttributeProvider attrProvider, string defaultName) + { + string argName = defaultName; + + //TODO: no need for foreach + foreach (ArgumentAttribute aa in attrProvider.GetCustomAttributes (typeof (ArgumentAttribute), false)) + argName = aa.Name; + + return argName; + } + + public static bool IsPublic (MemberInfo mi) + { + return IsPublic (mi.DeclaringType); + } + + public static bool IsPublic (Type type) + { + //we need to have a proper look at what's really public at some point + //this will do for now + + if (type.IsDefined (typeof (InterfaceAttribute), false)) + return true; + + if (type.IsSubclassOf (typeof (MarshalByRefObject))) + return true; + + return false; + } + + public static string GetInterfaceName (MemberInfo mi) + { + return GetInterfaceName (mi.DeclaringType); + } + + public static string GetInterfaceName (Type type) + { + string interfaceName = type.FullName; + + //TODO: better fallbacks and namespace mangling when no InterfaceAttribute is available + + //TODO: no need for foreach + foreach (InterfaceAttribute ia in type.GetCustomAttributes (typeof (InterfaceAttribute), false)) + interfaceName = ia.Name; + + return interfaceName; + } + + public static Type[] GetTypes (ArgDirection dir, ParameterInfo[] parms) + { + List types = new List (); + + //TODO: consider InOut/Ref + + for (int i = 0 ; i != parms.Length ; i++) { + switch (dir) { + case ArgDirection.In: + //docs say IsIn isn't reliable, and this is indeed true + //if (parms[i].IsIn) + if (!parms[i].IsOut) + types.Add (parms[i].ParameterType); + break; + case ArgDirection.Out: + if (parms[i].IsOut) { + //TODO: note that IsOut is optional to the compiler, we may want to use IsByRef instead + //eg: if (parms[i].ParameterType.IsByRef) + types.Add (parms[i].ParameterType.GetElementType ()); + } + break; + } + } + + return types.ToArray (); + } + + public static bool IsDeprecated (ICustomAttributeProvider attrProvider) + { + return attrProvider.IsDefined (typeof (ObsoleteAttribute), false); + } + } + + //TODO: this class is messy, move the methods somewhere more appropriate + public static class MessageHelper + { + //GetDynamicValues() should probably use yield eventually + + public static object[] GetDynamicValues (Message msg, ParameterInfo[] parms) + { + //TODO: consider out parameters + + Type[] types = new Type[parms.Length]; + for (int i = 0 ; i != parms.Length ; i++) + types[i] = parms[i].ParameterType; + + return MessageHelper.GetDynamicValues (msg, types); + } + + public static object[] GetDynamicValues (Message msg, Type[] types) + { + object[] vals = new object[types.Length]; + + if (msg.Body != null) { + MessageReader reader = new MessageReader (msg); + + for (int i = 0 ; i != types.Length ; i++) { + object arg; + reader.GetValue (types[i], out arg); + vals[i] = arg; + } + } + + return vals; + } + + //should generalize this method + //it is duplicated in DProxy + public static Message ConstructReplyFor (MethodCall method_call, object[] vals) + { + MethodReturn method_return = new MethodReturn (method_call.message.Header.Serial); + Message replyMsg = method_return.message; + + Signature inSig = Signature.GetSig (vals); + + if (vals != null && vals.Length != 0) { + MessageWriter writer = new MessageWriter (); + + foreach (object arg in vals) + writer.Write (arg.GetType (), arg); + + replyMsg.Body = writer.ToArray (); + } + + //TODO: we should be more strict here, but this fallback was added as a quick fix for p2p + if (method_call.Sender != null) + replyMsg.Header.Fields[FieldCode.Destination] = method_call.Sender; + + replyMsg.Signature = inSig; + + //replyMsg.WriteHeader (); + + return replyMsg; + } + + //TODO: merge this with the above method + public static Message ConstructReplyFor (MethodCall method_call, Type retType, object retVal) + { + MethodReturn method_return = new MethodReturn (method_call.message.Header.Serial); + Message replyMsg = method_return.message; + + Signature inSig = Signature.GetSig (retType); + + if (inSig != Signature.Empty) { + MessageWriter writer = new MessageWriter (); + writer.Write (retType, retVal); + replyMsg.Body = writer.ToArray (); + } + + //TODO: we should be more strict here, but this fallback was added as a quick fix for p2p + if (method_call.Sender != null) + replyMsg.Header.Fields[FieldCode.Destination] = method_call.Sender; + + replyMsg.Signature = inSig; + + //replyMsg.WriteHeader (); + + return replyMsg; + } + } + + [AttributeUsage (AttributeTargets.Interface | AttributeTargets.Class, AllowMultiple=false, Inherited=true)] + public class InterfaceAttribute : Attribute + { + public string Name; + + public InterfaceAttribute (string name) + { + this.Name = name; + } + } + + [AttributeUsage (AttributeTargets.Parameter | AttributeTargets.ReturnValue, AllowMultiple=false, Inherited=true)] + public class ArgumentAttribute : Attribute + { + public string Name; + + public ArgumentAttribute (string name) + { + this.Name = name; + } + } +} diff -urNad telepathy-sharp-0.0.svn.20060831/dbus-sharp/Message.cs telepathy-sharp-0.0.svn.20070221/dbus-sharp/Message.cs --- telepathy-sharp-0.0.svn.20060831/dbus-sharp/Message.cs 1970-01-01 01:00:00.000000000 +0100 +++ telepathy-sharp-0.0.svn.20070221/dbus-sharp/Message.cs 2007-02-21 19:10:38.000000000 +0100 @@ -0,0 +1,131 @@ +// Copyright 2006 Alp Toker +// This software is made available under the MIT License +// See COPYING for details + +using System; +using System.Diagnostics; +using System.Collections.Generic; +using System.IO; + +namespace NDesk.DBus +{ + public class Message + { + public Message () + { + Header.Endianness = EndianFlag.Little; + Header.MessageType = MessageType.MethodCall; + //hdr->Flags = HeaderFlag.None; + Header.Flags = HeaderFlag.NoReplyExpected; //TODO: is this the right place to do this? + Header.MajorVersion = Protocol.Version; + Header.Length = 0; + //Header.Serial = conn.GenerateSerial (); + Header.Fields = new Dictionary (); + } + + public Header Header; + public byte[] HeaderData; + + public Signature Signature + { + get { + if (Header.Fields.ContainsKey (FieldCode.Signature)) + return (Signature)Header.Fields[FieldCode.Signature]; + else + return Signature.Empty; + } set { + if (value == Signature.Empty) + Header.Fields.Remove (FieldCode.Signature); + else + Header.Fields[FieldCode.Signature] = value; + } + } + + public bool ReplyExpected + { + get { + return (Header.Flags & HeaderFlag.NoReplyExpected) == HeaderFlag.None; + } set { + if (value) + Header.Flags &= ~HeaderFlag.NoReplyExpected; //flag off + else + Header.Flags |= HeaderFlag.NoReplyExpected; //flag on + } + } + + //public HeaderField[] HeaderFields; + //public Dictionary; + + public byte[] Body; + + //TODO: make use of Locked + protected bool locked = false; + public bool Locked + { + get { + return locked; + } + } + + public void ParseHeader () + { + //GetValue (stream, typeof (Header), out Header); + + EndianFlag endianness = (EndianFlag)HeaderData[0]; + MessageReader reader = new MessageReader (endianness, HeaderData); + + ValueType valT; + reader.GetValue (typeof (Header), out valT); + Header = (Header)valT; + + /* + //foreach (HeaderField field in HeaderFields) + foreach (KeyValuePair field in Header.Fields) + { + //Console.WriteLine (field.Key + " = " + field.Value); + switch (field.Key) + { + case FieldCode.Invalid: + break; + case FieldCode.Path: + Path = (ObjectPath)field.Value; + break; + case FieldCode.Interface: + Interface = (string)field.Value; + break; + case FieldCode.Member: + Member = (string)field.Value; + break; + case FieldCode.ErrorName: + ErrorName = (string)field.Value; + break; + case FieldCode.ReplySerial: + ReplySerial = (uint)field.Value; + break; + case FieldCode.Destination: + Destination = (string)field.Value; + break; + case FieldCode.Sender: + Sender = (string)field.Value; + break; + case FieldCode.Signature: + Signature = (Signature)field.Value; + break; + } + } + */ + } + + public void WriteHeader () + { + if (Body != null) + Header.Length = (uint)Body.Length; + + MessageWriter writer = new MessageWriter (); + writer.Write (typeof (Header), Header); + //writer.WriteFromDict (typeof (FieldCode), typeof (object), Header.Fields); + writer.CloseWrite (); + HeaderData = writer.ToArray (); + } + } +} diff -urNad telepathy-sharp-0.0.svn.20060831/dbus-sharp/MessageFilter.cs telepathy-sharp-0.0.svn.20070221/dbus-sharp/MessageFilter.cs --- telepathy-sharp-0.0.svn.20060831/dbus-sharp/MessageFilter.cs 1970-01-01 01:00:00.000000000 +0100 +++ telepathy-sharp-0.0.svn.20070221/dbus-sharp/MessageFilter.cs 2007-02-21 19:10:38.000000000 +0100 @@ -0,0 +1,50 @@ +// Copyright 2006 Alp Toker +// This software is made available under the MIT License +// See COPYING for details + +using System; + +namespace NDesk.DBus +{ + public class MessageFilter + { + //this should probably be made to use HeaderField or similar + //this class is not generalized yet + + public static string MessageTypeToString (MessageType mtype) + { + switch (mtype) + { + case MessageType.MethodCall: + return "method_call"; + case MessageType.MethodReturn: + return "method_return"; + case MessageType.Error: + return "error"; + case MessageType.Signal: + return "signal"; + case MessageType.Invalid: + return "invalid"; + default: + throw new Exception ("Bad MessageType: " + mtype); + } + } + + public static string CreateMatchRule (MessageType mtype) + { + return "type='" + MessageTypeToString (mtype) + "'"; + } + + public static string CreateMatchRule (MessageType type, ObjectPath path, string @interface, string member) + { + return "type='" + MessageTypeToString (type) + "',path='" + path.Value + "',interface='" + @interface + "',member='" + member + "'"; + } + + //TODO + //this is useful as a Predicate delegate + public bool Match (Message message) + { + return false; + } + } +} diff -urNad telepathy-sharp-0.0.svn.20060831/dbus-sharp/MessageReader.cs telepathy-sharp-0.0.svn.20070221/dbus-sharp/MessageReader.cs --- telepathy-sharp-0.0.svn.20060831/dbus-sharp/MessageReader.cs 1970-01-01 01:00:00.000000000 +0100 +++ telepathy-sharp-0.0.svn.20070221/dbus-sharp/MessageReader.cs 2007-02-21 19:10:38.000000000 +0100 @@ -0,0 +1,500 @@ +// Copyright 2006 Alp Toker +// This software is made available under the MIT License +// See COPYING for details + +//defined by default, since this is not a controversial extension +#define PROTO_TYPE_SINGLE + +using System; +using System.Text; +using System.Diagnostics; +using System.Collections.Generic; +using System.IO; + +namespace NDesk.DBus +{ + public class MessageReader + { + //FIXME: use endianness instead of failing on non-native endianness + protected EndianFlag endianness; + protected byte[] data; + //TODO: this should be uint or long to handle long messages + protected int pos = 0; + + public MessageReader (EndianFlag endianness, byte[] data) + { + if (data == null) + throw new ArgumentNullException ("data"); + + this.endianness = endianness; + this.data = data; + } + + public MessageReader (Message message) : this (message.Header.Endianness, message.Body) + { + if (message == null) + throw new ArgumentNullException ("message"); + } + + public void GetValue (Type type, out object val) + { + if (type == typeof (void)) { + val = null; + return; + } + + if (type.IsArray) { + Array valArr; + GetValue (type, out valArr); + val = valArr; + } else if (type == typeof (ObjectPath)) { + ObjectPath valOP; + GetValue (out valOP); + val = valOP; + } else if (type == typeof (Signature)) { + Signature valSig; + GetValue (out valSig); + val = valSig; + } else if (type.IsGenericType && type.GetGenericTypeDefinition () == typeof (IDictionary<,>)) { + Type[] genArgs = type.GetGenericArguments (); + Type dictType = typeof (Dictionary<,>).MakeGenericType (genArgs); + val = Activator.CreateInstance(dictType, new object[0]); + System.Collections.IDictionary idict = (System.Collections.IDictionary)val; + GetValueToDict (genArgs[0], genArgs[1], idict); + } else if (!type.IsPrimitive && type.IsValueType && !type.IsEnum) { + ValueType valV; + GetValue (type, out valV); + val = valV; + } else { + DType dtype = Signature.TypeToDType (type); + GetValue (dtype, out val); + } + + if (type.IsEnum) + val = Enum.ToObject (type, val); + } + + //helper method, should not be used generally + public void GetValue (DType dtype, out object val) + { + switch (dtype) + { + case DType.Byte: + { + byte vval; + GetValue (out vval); + val = vval; + } + break; + case DType.Boolean: + { + bool vval; + GetValue (out vval); + val = vval; + } + break; + case DType.Int16: + { + short vval; + GetValue (out vval); + val = vval; + } + break; + case DType.UInt16: + { + ushort vval; + GetValue (out vval); + val = vval; + } + break; + case DType.Int32: + { + int vval; + GetValue (out vval); + val = vval; + } + break; + case DType.UInt32: + { + uint vval; + GetValue (out vval); + val = vval; + } + break; + case DType.Int64: + { + long vval; + GetValue (out vval); + val = vval; + } + break; + case DType.UInt64: + { + ulong vval; + GetValue (out vval); + val = vval; + } + break; +#if PROTO_TYPE_SINGLE + case DType.Single: + { + float vval; + GetValue (out vval); + val = vval; + } + break; +#endif + case DType.Double: + { + double vval; + GetValue (out vval); + val = vval; + } + break; + case DType.String: + { + string vval; + GetValue (out vval); + val = vval; + } + break; + case DType.ObjectPath: + { + ObjectPath vval; + GetValue (out vval); + val = vval; + } + break; + case DType.Signature: + { + Signature vval; + GetValue (out vval); + val = vval; + } + break; + case DType.Variant: + { + object vval; + GetValue (out vval); + val = vval; + } + break; + default: + val = null; + throw new Exception ("Unhandled D-Bus type: " + dtype); + } + } + + //alternative GetValue() implementations + //needed for reading messages in machine-native format, until we do this properly + //TODO: don't ignore the endian flag in the header + + public void GetValue (out byte val) + { + val = data[pos++]; + } + + public void GetValue (out bool val) + { + uint intval; + GetValue (out intval); + + //TODO: confirm semantics of dbus boolean + val = intval == 0 ? false : true; + } + + unsafe protected void MarshalUShort (byte *dst) + { + ReadPad (2); + + if (endianness == Connection.NativeEndianness) { + dst[0] = data[pos + 0]; + dst[1] = data[pos + 1]; + } else { + dst[0] = data[pos + 1]; + dst[1] = data[pos + 0]; + } + + pos += 2; + } + + unsafe public void GetValue (out short val) + { + fixed (short* ret = &val) + MarshalUShort ((byte*)ret); + } + + unsafe public void GetValue (out ushort val) + { + fixed (ushort* ret = &val) + MarshalUShort ((byte*)ret); + } + + unsafe protected void MarshalUInt (byte *dst) + { + ReadPad (4); + + if (endianness == Connection.NativeEndianness) { + dst[0] = data[pos + 0]; + dst[1] = data[pos + 1]; + dst[2] = data[pos + 2]; + dst[3] = data[pos + 3]; + } else { + dst[0] = data[pos + 3]; + dst[1] = data[pos + 2]; + dst[2] = data[pos + 1]; + dst[3] = data[pos + 0]; + } + + pos += 4; + } + + unsafe public void GetValue (out int val) + { + fixed (int* ret = &val) + MarshalUInt ((byte*)ret); + } + + unsafe public void GetValue (out uint val) + { + fixed (uint* ret = &val) + MarshalUInt ((byte*)ret); + } + + unsafe protected void MarshalULong (byte *dst) + { + ReadPad (8); + + if (endianness == Connection.NativeEndianness) { + for (int i = 0; i < 8; ++i) + dst[i] = data[pos + i]; + } else { + for (int i = 0; i < 8; ++i) + dst[i] = data[pos + (7 - i)]; + } + + pos += 8; + } + + unsafe public void GetValue (out long val) + { + fixed (long* ret = &val) + MarshalULong ((byte*)ret); + } + + unsafe public void GetValue (out ulong val) + { + fixed (ulong* ret = &val) + MarshalULong ((byte*)ret); + } + +#if PROTO_TYPE_SINGLE + unsafe public void GetValue (out float val) + { + fixed (float* ret = &val) + MarshalUInt ((byte*)ret); + } +#endif + + unsafe public void GetValue (out double val) + { + fixed (double* ret = &val) + MarshalULong ((byte*)ret); + } + + public void GetValue (out string val) + { + uint ln; + GetValue (out ln); + + val = Encoding.UTF8.GetString (data, pos, (int)ln); + pos += (int)ln + 1; //+1 is null string terminator + } + + public void GetValue (out ObjectPath val) + { + //exactly the same as string + string sval; + GetValue (out sval); + val = new ObjectPath (sval); + } + + public void GetValue (out Signature val) + { + byte ln; + GetValue (out ln); + + byte[] sigData = new byte[ln]; + Array.Copy (data, pos, sigData, 0, (int)ln); + val = new Signature (sigData); + pos += (int)ln + 1; //+1 is null signature terminator + } + + //variant + public void GetValue (out object val) + { + Signature sig; + GetValue (out sig); + + GetValue (sig, out val); + } + + public void GetValue (Signature sig, out object val) + { + GetValue (sig.ToType (), out val); + } + + //not pretty or efficient but works + public void GetValueToDict (Type keyType, Type valType, System.Collections.IDictionary val) + { + uint ln; + GetValue (out ln); + + //advance to the alignment of the element + //ReadPad (Protocol.GetAlignment (Signature.TypeToDType (type))); + ReadPad (8); + + int endPos = pos + (int)ln; + + //while (stream.Position != endPos) + while (pos < endPos) + { + ReadPad (8); + + object keyVal; + GetValue (keyType, out keyVal); + + object valVal; + GetValue (valType, out valVal); + + val.Add (keyVal, valVal); + } + + if (pos != endPos) + throw new Exception ("Read pos " + pos + " != ep " + endPos); + } + + //this could be made generic to avoid boxing + //restricted to primitive elements because of the DType bottleneck + public void GetValue (Type type, out Array val) + { + if (type.IsArray) + type = type.GetElementType (); + + uint ln; + GetValue (out ln); + + //advance to the alignment of the element + ReadPad (Protocol.GetAlignment (Signature.TypeToDType (type))); + + int endPos = pos + (int)ln; + + //List vals = new List (); + System.Collections.ArrayList vals = new System.Collections.ArrayList (); + + //while (stream.Position != endPos) + while (pos < endPos) + { + object elem; + //GetValue (Signature.TypeToDType (type), out elem); + GetValue (type, out elem); + vals.Add (elem); + } + + if (pos != endPos) + throw new Exception ("Read pos " + pos + " != ep " + endPos); + + val = vals.ToArray (type); + //val = Array.CreateInstance (type.UnderlyingSystemType, vals.Count); + } + + //struct + //probably the wrong place for this + //there might be more elegant solutions + public void GetValue (Type type, out ValueType val) + { + System.Reflection.ConstructorInfo[] cis = type.GetConstructors (); + if (cis.Length != 0) { + System.Reflection.ConstructorInfo ci = cis[0]; + //Console.WriteLine ("ci: " + ci); + System.Reflection.ParameterInfo[] parms = ci.GetParameters (); + + /* + Type[] sig = new Type[parms.Length]; + for (int i = 0 ; i != parms.Length ; i++) + sig[i] = parms[i].ParameterType; + object retObj = ci.Invoke (null, MessageHelper.GetDynamicValues (msg, sig)); + */ + + //TODO: use MessageHelper.GetDynamicValues() when it's refactored to be applicable + /* + object[] vals; + vals = MessageHelper.GetDynamicValues (msg, parms); + */ + + List vals = new List (parms.Length); + foreach (System.Reflection.ParameterInfo parm in parms) { + object arg; + GetValue (parm.ParameterType, out arg); + vals.Add (arg); + } + + //object retObj = ci.Invoke (val, vals.ToArray ()); + val = (ValueType)Activator.CreateInstance (type, vals.ToArray ()); + return; + } + + //no suitable ctor, marshal as a struct + ReadPad (8); + + val = (ValueType)Activator.CreateInstance (type); + + /* + if (type.IsGenericType && type.GetGenericTypeDefinition () == typeof (KeyValuePair<,>)) { + object elem; + + System.Reflection.PropertyInfo key_prop = type.GetProperty ("Key"); + GetValue (key_prop.PropertyType, out elem); + key_prop.SetValue (val, elem, null); + + System.Reflection.PropertyInfo val_prop = type.GetProperty ("Value"); + GetValue (val_prop.PropertyType, out elem); + val_prop.SetValue (val, elem, null); + + return; + } + */ + + System.Reflection.FieldInfo[] fis = type.GetFields (); + + foreach (System.Reflection.FieldInfo fi in fis) { + object elem; + //GetValue (Signature.TypeToDType (fi.FieldType), out elem); + GetValue (fi.FieldType, out elem); + //public virtual void SetValueDirect (TypedReference obj, object value); + fi.SetValue (val, elem); + } + } + + public void ReadNull () + { + if (data[pos++] != 0) + throw new Exception ("Read non-zero null terminator"); + } + + /* + public void ReadPad (int alignment) + { + pos = Protocol.Padded (pos, alignment); + } + */ + + public void ReadPad (int alignment) + { + //make sure the pos-1 is right for the exception message when we have a test suite + while (pos != Protocol.Padded (pos, alignment)) + if (data[pos++] != 0) + throw new Exception ("Read non-zero padding byte at pos " + (pos-1) + ", pad value was " + data[pos-1]); + } + } +} diff -urNad telepathy-sharp-0.0.svn.20060831/dbus-sharp/MessageWriter.cs telepathy-sharp-0.0.svn.20070221/dbus-sharp/MessageWriter.cs --- telepathy-sharp-0.0.svn.20060831/dbus-sharp/MessageWriter.cs 1970-01-01 01:00:00.000000000 +0100 +++ telepathy-sharp-0.0.svn.20070221/dbus-sharp/MessageWriter.cs 2007-02-21 19:10:38.000000000 +0100 @@ -0,0 +1,359 @@ +// Copyright 2006 Alp Toker +// This software is made available under the MIT License +// See COPYING for details + +//defined by default, since this is not a controversial extension +#define PROTO_TYPE_SINGLE + +using System; +using System.Text; +using System.Diagnostics; +using System.Collections.Generic; +using System.IO; + +namespace NDesk.DBus +{ + public class MessageWriter + { + //TODO: use endianness instead of writing the message is in native format + protected EndianFlag endianness; + protected MemoryStream stream; + protected BinaryWriter bw; + + //TODO: enable this ctor instead of the current one when endian support is done + //public MessageWriter () : this (Connection.NativeEndianness) + public MessageWriter () : this (EndianFlag.Little) + { + } + + public MessageWriter (EndianFlag endianness) + { + if (endianness != EndianFlag.Little) + throw new NotImplementedException ("Only little-endian message writing is currently supported"); + + this.endianness = endianness; + stream = new MemoryStream (); + bw = new BinaryWriter (stream); + } + + public byte[] ToArray () + { + //TODO: mark the writer locked or something here + return stream.ToArray (); + } + + public void CloseWrite () + { + int needed = Protocol.PadNeeded ((int)stream.Position, 8); + for (int i = 0 ; i != needed ; i++) + stream.WriteByte (0); + } + + public void Write (byte val) + { + WritePad (1); + bw.Write (val); + } + + public void Write (bool val) + { + WritePad (4); + bw.Write ((uint) (val ? 1 : 0)); + } + + public void Write (short val) + { + WritePad (2); + bw.Write (val); + } + + public void Write (ushort val) + { + WritePad (2); + bw.Write (val); + } + + public void Write (int val) + { + WritePad (4); + bw.Write (val); + } + + public void Write (uint val) + { + + WritePad (4); + bw.Write (val); + } + + public void Write (long val) + { + WritePad (8); + bw.Write (val); + } + + public void Write (ulong val) + { + WritePad (8); + bw.Write (val); + } + +#if PROTO_TYPE_SINGLE + public void Write (float val) + { + WritePad (4); + bw.Write (val); + } +#endif + + public void Write (double val) + { + WritePad (8); + bw.Write (val); + } + + public void Write (string val) + { + byte[] utf8_data = Encoding.UTF8.GetBytes (val); + Write ((uint)utf8_data.Length); + bw.Write (utf8_data); + bw.Write ((byte)0); //NULL string terminator + } + + public void Write (ObjectPath val) + { + Write (val.Value); + } + + public void Write (Signature val) + { + WritePad (1); + Write ((byte)val.Length); + bw.Write (val.GetBuffer ()); + bw.Write ((byte)0); //NULL signature terminator + } + + public void Write (Type type, object val) + { + if (type == typeof (void)) + return; + + if (type.IsArray) { + Write (type, (Array)val); + } else if (type == typeof (ObjectPath)) { + Write ((ObjectPath)val); + } else if (type == typeof (Signature)) { + Write ((Signature)val); + } else if (type.IsGenericType && (type.GetGenericTypeDefinition () == typeof (IDictionary<,>) || type.GetGenericTypeDefinition () == typeof (Dictionary<,>))) { + Type[] genArgs = type.GetGenericArguments (); + System.Collections.IDictionary idict = (System.Collections.IDictionary)val; + WriteFromDict (genArgs[0], genArgs[1], idict); + } else if (!type.IsPrimitive && type.IsValueType && !type.IsEnum) { + Write (type, (ValueType)val); + /* + } else if (type.IsGenericType && type.GetGenericTypeDefinition () == typeof (Nullable<>)) { + //is it possible to support nullable types? + Type[] genArgs = type.GetGenericArguments (); + WriteVariant (genArgs[0], val); + */ + } else { + Write (Signature.TypeToDType (type), val); + } + } + + //helper method, should not be used as it boxes needlessly + public void Write (DType dtype, object val) + { + switch (dtype) + { + case DType.Byte: + { + Write ((byte)val); + } + break; + case DType.Boolean: + { + Write ((bool)val); + } + break; + case DType.Int16: + { + Write ((short)val); + } + break; + case DType.UInt16: + { + Write ((ushort)val); + } + break; + case DType.Int32: + { + Write ((int)val); + } + break; + case DType.UInt32: + { + Write ((uint)val); + } + break; + case DType.Int64: + { + Write ((long)val); + } + break; + case DType.UInt64: + { + Write ((ulong)val); + } + break; +#if PROTO_TYPE_SINGLE + case DType.Single: + { + Write ((float)val); + } + break; +#endif + case DType.Double: + { + Write ((double)val); + } + break; + case DType.String: + { + Write ((string)val); + } + break; + case DType.ObjectPath: + { + Write ((ObjectPath)val); + } + break; + case DType.Signature: + { + Write ((Signature)val); + } + break; + case DType.Variant: + { + Write ((object)val); + } + break; + default: + throw new Exception ("Unhandled D-Bus type: " + dtype); + } + } + + //variant + public void Write (object val) + { + //TODO: maybe support sending null variants + + if (val == null) + throw new NotSupportedException ("Cannot send null variant"); + + Type type = val.GetType (); + + WriteVariant (type, val); + } + + public void WriteVariant (Type type, object val) + { + Signature sig = Signature.GetSig (type); + + Write (sig); + Write (type, val); + } + + //this requires a seekable stream for now + public void Write (Type type, Array val) + { + //if (type.IsArray) + type = type.GetElementType (); + + Write ((uint)0); + long lengthPos = stream.Position - 4; + + //advance to the alignment of the element + WritePad (Protocol.GetAlignment (Signature.TypeToDType (type))); + + long startPos = stream.Position; + + foreach (object elem in val) + Write (type, elem); + + long endPos = stream.Position; + + stream.Position = lengthPos; + Write ((uint)(endPos - startPos)); + + stream.Position = endPos; + } + + public void WriteFromDict (Type keyType, Type valType, System.Collections.IDictionary val) + { + Write ((uint)0); + long lengthPos = stream.Position - 4; + + //advance to the alignment of the element + //WritePad (Protocol.GetAlignment (Signature.TypeToDType (type))); + WritePad (8); + + long startPos = stream.Position; + + foreach (System.Collections.DictionaryEntry entry in val) + { + WritePad (8); + + Write (keyType, entry.Key); + Write (valType, entry.Value); + } + + long endPos = stream.Position; + + stream.Position = lengthPos; + Write ((uint)(endPos - startPos)); + + stream.Position = endPos; + } + + public void Write (Type type, ValueType val) + { + WritePad (8); //offset for structs, right? + + /* + ConstructorInfo[] cis = type.GetConstructors (); + if (cis.Length != 0) { + System.Reflection.ParameterInfo[] parms = ci.GetParameters (); + + foreach (ParameterInfo parm in parms) { + } + } + */ + if (type.IsGenericType && type.GetGenericTypeDefinition () == typeof (KeyValuePair<,>)) { + System.Reflection.PropertyInfo key_prop = type.GetProperty ("Key"); + Write (key_prop.PropertyType, key_prop.GetValue (val, null)); + + System.Reflection.PropertyInfo val_prop = type.GetProperty ("Value"); + Write (val_prop.PropertyType, val_prop.GetValue (val, null)); + + return; + } + + System.Reflection.FieldInfo[] fis = type.GetFields (); + + foreach (System.Reflection.FieldInfo fi in fis) { + object elem; + //public virtual object GetValueDirect (TypedReference obj); + elem = fi.GetValue (val); + //Write (Signature.TypeToDType (fi.FieldType), elem); + Write (fi.FieldType, elem); + } + } + + //RNGCryptoServiceProvider rng = new RNGCryptoServiceProvider (); + public void WritePad (int alignment) + { + stream.Position = Protocol.Padded ((int)stream.Position, alignment); + } + } +} diff -urNad telepathy-sharp-0.0.svn.20060831/dbus-sharp/Protocol.cs telepathy-sharp-0.0.svn.20070221/dbus-sharp/Protocol.cs --- telepathy-sharp-0.0.svn.20060831/dbus-sharp/Protocol.cs 1970-01-01 01:00:00.000000000 +0100 +++ telepathy-sharp-0.0.svn.20070221/dbus-sharp/Protocol.cs 2007-02-21 19:10:38.000000000 +0100 @@ -0,0 +1,285 @@ +// Copyright 2006 Alp Toker +// This software is made available under the MIT License +// See COPYING for details + +//defined by default, since this is not a controversial extension +#define PROTO_TYPE_SINGLE + +using System; +using System.Collections.Generic; + +namespace NDesk.DBus +{ + //yyyyuua{yv} + public struct Header + { + public EndianFlag Endianness; + public MessageType MessageType; + public HeaderFlag Flags; + public byte MajorVersion; + public uint Length; + public uint Serial; + //public HeaderField[] Fields; + public IDictionary Fields; + + /* + public static DType TypeForField (FieldCode f) + { + switch (f) { + case FieldCode.Invalid: + return DType.Invalid; + case FieldCode.Path: + return DType.ObjectPath; + case FieldCode.Interface: + return DType.String; + case FieldCode.Member: + return DType.String; + case FieldCode.ErrorName: + return DType.String; + case FieldCode.ReplySerial: + return DType.UInt32; + case FieldCode.Destination: + return DType.String; + case FieldCode.Sender: + return DType.String; + case FieldCode.Signature: + return DType.Signature; +#if PROTO_REPLY_SIGNATURE + case FieldCode.ReplySignature: //note: not supported in dbus + return DType.Signature; +#endif + default: + return DType.Invalid; + } + } + */ + } + + /* + public struct HeaderField + { + //public HeaderField (FieldCode code, object value) + //{ + // this.Code = code; + // this.Value = value; + //} + + public static HeaderField Create (FieldCode code, object value) + { + HeaderField hf; + + hf.Code = code; + hf.Value = value; + + return hf; + } + + public FieldCode Code; + public object Value; + } + */ + + public enum MessageType : byte + { + //This is an invalid type. + Invalid, + //Method call. + MethodCall, + //Method reply with returned data. + MethodReturn, + //Error reply. If the first argument exists and is a string, it is an error message. + Error, + //Signal emission. + Signal, + } + + public enum FieldCode : byte + { + Invalid, + Path, + Interface, + Member, + ErrorName, + ReplySerial, + Destination, + Sender, + Signature, +#if PROTO_REPLY_SIGNATURE + ReplySignature, //note: not supported in dbus +#endif + } + + public enum EndianFlag : byte + { + Little = (byte)'l', + Big = (byte)'B', + } + + [Flags] + public enum HeaderFlag : byte + { + None = 0, + NoReplyExpected = 0x1, + NoAutoStart = 0x2, + } + + public struct ObjectPath //: IComparable, IComparable, IEquatable + { + public static readonly ObjectPath Root = new ObjectPath ("/"); + + public readonly string Value; + + public ObjectPath (string value) + { + this.Value = value; + } + + public override string ToString () + { + return Value; + } + + //this may or may not prove useful + public string[] Decomposed + { + get { + return Value.Split ('/'); + /* + } set { + Value = String.Join ("/", value); + */ + } + } + + /* + public int CompareTo (object value) + { + return 1; + } + + public int CompareTo (ObjectPath value) + { + return 1; + } + + public bool Equals (ObjectPath value) + { + return false; + } + */ + } + + public static class Protocol + { + //protocol versions that we support + public const byte MinVersion = 0; + public const byte Version = 1; +#if PROTO_TYPE_SINGLE + public const byte MaxVersion = 2; +#else + public const byte MaxVersion = 1; +#endif + + public static int PadNeeded (int pos, int alignment) + { + int pad = pos % alignment; + pad = pad == 0 ? 0 : alignment - pad; + + return pad; + } + + public static int Padded (int pos, int alignment) + { + int pad = pos % alignment; + if (pad != 0) + pos += alignment - pad; + + return pos; + } + + public static int GetAlignment (DType dtype) + { + switch (dtype) { + case DType.Byte: + return 1; + case DType.Boolean: + return 4; + case DType.Int16: + case DType.UInt16: + return 2; + case DType.Int32: + case DType.UInt32: + return 4; + case DType.Int64: + case DType.UInt64: + return 8; +#if PROTO_TYPE_SINGLE + case DType.Single: //Not yet supported! + return 4; +#endif + case DType.Double: + return 8; + case DType.String: + return 4; + case DType.ObjectPath: + return 4; + case DType.Signature: + return 1; + case DType.Array: + return 4; + case DType.Struct: + return 8; + case DType.Variant: + return 1; + case DType.DictEntry: + return 8; + case DType.Invalid: + default: + throw new Exception ("Cannot determine alignment of " + dtype); + } + } + + //this class may not be the best place for Verbose + public readonly static bool Verbose; + + static Protocol () + { + Verbose = !String.IsNullOrEmpty (Environment.GetEnvironmentVariable ("DBUS_VERBOSE")); + } + } + +#if UNDOCUMENTED_IN_SPEC +/* +"org.freedesktop.DBus.Error.Failed" +"org.freedesktop.DBus.Error.NoMemory" +"org.freedesktop.DBus.Error.ServiceUnknown" +"org.freedesktop.DBus.Error.NameHasNoOwner" +"org.freedesktop.DBus.Error.NoReply" +"org.freedesktop.DBus.Error.IOError" +"org.freedesktop.DBus.Error.BadAddress" +"org.freedesktop.DBus.Error.NotSupported" +"org.freedesktop.DBus.Error.LimitsExceeded" +"org.freedesktop.DBus.Error.AccessDenied" +"org.freedesktop.DBus.Error.AuthFailed" +"org.freedesktop.DBus.Error.NoServer" +"org.freedesktop.DBus.Error.Timeout" +"org.freedesktop.DBus.Error.NoNetwork" +"org.freedesktop.DBus.Error.AddressInUse" +"org.freedesktop.DBus.Error.Disconnected" +"org.freedesktop.DBus.Error.InvalidArgs" +"org.freedesktop.DBus.Error.FileNotFound" +"org.freedesktop.DBus.Error.UnknownMethod" +"org.freedesktop.DBus.Error.TimedOut" +"org.freedesktop.DBus.Error.MatchRuleNotFound" +"org.freedesktop.DBus.Error.MatchRuleInvalid" +"org.freedesktop.DBus.Error.Spawn.ExecFailed" +"org.freedesktop.DBus.Error.Spawn.ForkFailed" +"org.freedesktop.DBus.Error.Spawn.ChildExited" +"org.freedesktop.DBus.Error.Spawn.ChildSignaled" +"org.freedesktop.DBus.Error.Spawn.Failed" +"org.freedesktop.DBus.Error.UnixProcessIdUnknown" +"org.freedesktop.DBus.Error.InvalidSignature" +"org.freedesktop.DBus.Error.SELinuxSecurityContextUnknown" +*/ +#endif +} diff -urNad telepathy-sharp-0.0.svn.20060831/dbus-sharp/README telepathy-sharp-0.0.svn.20070221/dbus-sharp/README --- telepathy-sharp-0.0.svn.20060831/dbus-sharp/README 2006-09-25 20:22:03.000000000 +0200 +++ telepathy-sharp-0.0.svn.20070221/dbus-sharp/README 2007-02-21 19:10:38.000000000 +0100 @@ -1,8 +1,8 @@ D-Bus for .NET ============== -This is a C# implementation of D-Bus. It's often referred to as "managed -D-Bus" to avoid confusion with existing bindings (which wrap libdbus). +This is a C# implementation of D-Bus, the small message bus with a big +appetite. See http://www.ndesk.org/DBusSharp @@ -13,8 +13,8 @@ See http://www.freedesktop.org/wiki/Software/dbus for general information on the D-Bus IPC mechanism. -This software is currently at an early stage of development and not -recommended for use in stable applications. +This software is currently at an early stage of development and IS NOT +EXPECTED TO WORK YET. However it is hoped that it will soon provide a tested, high-performance bridge to and from all systems that are exposed via D-Bus, regardless of diff -urNad telepathy-sharp-0.0.svn.20060831/dbus-sharp/Server.cs telepathy-sharp-0.0.svn.20070221/dbus-sharp/Server.cs --- telepathy-sharp-0.0.svn.20060831/dbus-sharp/Server.cs 1970-01-01 01:00:00.000000000 +0100 +++ telepathy-sharp-0.0.svn.20070221/dbus-sharp/Server.cs 2007-02-21 19:10:38.000000000 +0100 @@ -0,0 +1,41 @@ +// Copyright 2006 Alp Toker +// This software is made available under the MIT License +// See COPYING for details + +using System; +using System.IO; +using System.Net; +using System.Net.Sockets; + +namespace NDesk.DBus +{ + //TODO: complete this class + public class Server + { + public void Listen (string address) + { + this.address = address; + } + + public void Disconnect () + { + } + + public bool IsConnected + { + get { + return true; + } + } + + protected string address; + public string Address + { + get { + return address; + } + } + + //TODO: new connection event/virtual method + } +} diff -urNad telepathy-sharp-0.0.svn.20060831/dbus-sharp/Signature.cs telepathy-sharp-0.0.svn.20070221/dbus-sharp/Signature.cs --- telepathy-sharp-0.0.svn.20060831/dbus-sharp/Signature.cs 1970-01-01 01:00:00.000000000 +0100 +++ telepathy-sharp-0.0.svn.20070221/dbus-sharp/Signature.cs 2007-02-21 19:10:38.000000000 +0100 @@ -0,0 +1,546 @@ +// Copyright 2006 Alp Toker +// This software is made available under the MIT License +// See COPYING for details + +using System; +using System.Text; + +using System.Collections.Generic; +//TODO: Reflection should be done at a higher level than this class +using System.Reflection; + +namespace NDesk.DBus +{ + //maybe this should be nullable? + public struct Signature + { + //TODO: this class needs some work + //Data should probably include the null terminator + + public static readonly Signature Empty = new Signature (String.Empty); + + public static bool operator == (Signature a, Signature b) + { + /* + //TODO: remove this hack to handle bad case when Data is null + if (a.data == null || b.data == null) + throw new Exception ("Encountered Signature with null buffer"); + */ + + /* + if (a.data == null && b.data == null) + return true; + + if (a.data == null || b.data == null) + return false; + */ + + if (a.data.Length != b.data.Length) + return false; + + for (int i = 0 ; i != a.data.Length ; i++) + if (a.data[i] != b.data[i]) + return false; + + return true; + } + + public static bool operator != (Signature a, Signature b) + { + return !(a == b); + } + + public override bool Equals (object o) + { + if (o == null) + return false; + + if (!(o is Signature)) + return false; + + return this == (Signature)o; + } + + public override int GetHashCode () + { + return data.GetHashCode (); + } + + public static Signature operator + (Signature s1, Signature s2) + { + return Concat (s1, s2); + } + + //these need to be optimized + public static Signature Concat (Signature s1, Signature s2) + { + return new Signature (s1.Value + s2.Value); + } + + public static Signature Copy (Signature sig) + { + return new Signature (sig.Value); + } + + public Signature (string value) + { + this.data = Encoding.ASCII.GetBytes (value); + } + + public Signature (byte[] value) + { + this.data = new byte[value.Length]; + + for (int i = 0 ; i != value.Length ; i++) + this.data[i] = value[i]; + } + + //this will become obsolete soon + public Signature (DType value) + { + this.data = new byte[1]; + this.data[0] = (byte)value; + } + + public Signature (DType[] value) + { + this.data = new byte[value.Length]; + + /* + MemoryStream ms = new MemoryStream (this.data); + + foreach (DType t in value) + ms.WriteByte ((byte)t); + */ + + for (int i = 0 ; i != value.Length ; i++) + this.data[i] = (byte)value[i]; + } + + byte[] data; + + //TODO: this should be private, but MessageWriter and Monitor still use it + //[Obsolete] + public byte[] GetBuffer () + { + return data; + } + + public DType this[int index] + { + get { + return (DType)data[index]; + } + } + + public int Length + { + get { + return data.Length; + } + } + + //[Obsolete] + public string Value + { + get { + /* + //FIXME: hack to handle bad case when Data is null + if (data == null) + return String.Empty; + */ + + return Encoding.ASCII.GetString (data); + } + } + + public override string ToString () + { + StringBuilder sb = new StringBuilder (); + + foreach (DType t in data) { + //we shouldn't rely on object mapping here, but it's an easy way to get string representations for now + Type type = DTypeToType (t); + if (type != null) { + sb.Append (type.Name); + } else { + char c = (char)t; + if (!Char.IsControl (c)) + sb.Append (c); + else + sb.Append (@"\" + (int)c); + } + sb.Append (" "); + } + + return sb.ToString (); + } + + public Signature MakeArraySignature () + { + return new Signature (DType.Array) + this; + } + + public static Signature MakeStruct (params Signature[] elems) + { + Signature sig = Signature.Empty; + + sig += new Signature (DType.StructBegin); + + foreach (Signature elem in elems) + sig += elem; + + sig += new Signature (DType.StructEnd); + + return sig; + } + + public static Signature MakeDictEntry (Signature keyType, Signature valueType) + { + Signature sig = Signature.Empty; + + sig += new Signature (DType.DictEntryBegin); + + sig += keyType; + sig += valueType; + + sig += new Signature (DType.DictEntryEnd); + + return sig; + } + + public static Signature MakeDict (Signature keyType, Signature valueType) + { + return MakeDictEntry (keyType, valueType).MakeArraySignature (); + } + + /* + //TODO: complete this + public bool IsPrimitive + { + get { + if (this == Signature.Empty) + return true; + + return false; + } + } + */ + + public bool IsDict + { + get { + if (Length < 3) + return false; + + if (!IsArray) + return false; + + if (this[2] != DType.DictEntryBegin) + return false; + + return true; + } + } + + public bool IsArray + { + get { + if (Length < 2) + return false; + + if (this[0] != DType.Array) + return false; + + return true; + } + } + + public Signature GetElementSignature () + { + if (!IsArray) + throw new Exception ("Cannot get the element signature of a non-array (signature was '" + this + "')"); + + //TODO: improve this + if (Length != 2) + throw new NotSupportedException ("Parsing signatures with more than one primitive value is not supported (signature was '" + this + "')"); + + return new Signature (this[1]); + } + + public Type ToType () + { + if (this == Signature.Empty) + return typeof (void); + + if (IsArray) + return GetElementSignature ().ToType ().MakeArrayType (); + + if (Length == 1) + return DTypeToType (this[0]); + + throw new NotSupportedException ("Parsing or converting this signature is not yet supported (signature was '" + this + "')"); + } + + public static DType TypeCodeToDType (TypeCode typeCode) + { + switch (typeCode) + { + case TypeCode.Empty: + return DType.Invalid; + case TypeCode.Object: + return DType.Invalid; + case TypeCode.DBNull: + return DType.Invalid; + case TypeCode.Boolean: + return DType.Boolean; + case TypeCode.Char: + return DType.UInt16; + case TypeCode.SByte: + return DType.Byte; + case TypeCode.Byte: + return DType.Byte; + case TypeCode.Int16: + return DType.Int16; + case TypeCode.UInt16: + return DType.UInt16; + case TypeCode.Int32: + return DType.Int32; + case TypeCode.UInt32: + return DType.UInt32; + case TypeCode.Int64: + return DType.Int64; + case TypeCode.UInt64: + return DType.UInt64; + case TypeCode.Single: + return DType.Single; + case TypeCode.Double: + return DType.Double; + case TypeCode.Decimal: + return DType.Invalid; + case TypeCode.DateTime: + return DType.Invalid; + case TypeCode.String: + return DType.String; + default: + return DType.Invalid; + } + } + + public static DType TypeToDType (Type type) + { + if (type == typeof (void)) + return DType.Invalid; + + if (type == typeof (string)) + return DType.String; + + if (type == typeof (ObjectPath)) + return DType.ObjectPath; + + if (type == typeof (Signature)) + return DType.Signature; + + if (type == typeof (object)) + return DType.Variant; + + if (type.IsPrimitive) + return TypeCodeToDType (Type.GetTypeCode (type)); + + if (type.IsEnum) + return TypeToDType (type.GetElementType ()); + + //needs work + if (type.IsArray) + return DType.Array; + + if (!type.IsPrimitive && type.IsValueType && !type.IsEnum) + return DType.Struct; + + //if (type.UnderlyingSystemType != null) + // return TypeToDType (type.UnderlyingSystemType); + + //TODO: maybe throw an exception here + return DType.Invalid; + } + + /* + public static DType TypeToDType (Type type) + { + if (type == null) + return DType.Invalid; + else if (type == typeof (byte)) + return DType.Byte; + else if (type == typeof (bool)) + return DType.Boolean; + else if (type == typeof (short)) + return DType.Int16; + else if (type == typeof (ushort)) + return DType.UInt16; + else if (type == typeof (int)) + return DType.Int32; + else if (type == typeof (uint)) + return DType.UInt32; + else if (type == typeof (long)) + return DType.Int64; + else if (type == typeof (ulong)) + return DType.UInt64; + else if (type == typeof (float)) //FIXME: this isn't supported by DBus yet + return DType.Single; + else if (type == typeof (double)) + return DType.Double; + else if (type == typeof (string)) + return DType.String; + else if (type == typeof (ObjectPath)) + return DType.ObjectPath; + else if (type == typeof (Signature)) + return DType.Signature; + else + return DType.Invalid; + } + */ + + public static Type DTypeToType (DType dtype) + { + switch (dtype) { + case DType.Invalid: + return typeof (void); + case DType.Byte: + return typeof (byte); + case DType.Boolean: + return typeof (bool); + case DType.Int16: + return typeof (short); + case DType.UInt16: + return typeof (ushort); + case DType.Int32: + return typeof (int); + case DType.UInt32: + return typeof (uint); + case DType.Int64: + return typeof (long); + case DType.UInt64: + return typeof (ulong); + case DType.Single: //Not yet supported! + return typeof (float); + case DType.Double: + return typeof (double); + case DType.String: + return typeof (string); + case DType.ObjectPath: + return typeof (ObjectPath); + case DType.Signature: + return typeof (Signature); + case DType.Array: + return typeof (Array); + case DType.Struct: + return typeof (ValueType); + case DType.DictEntry: + return typeof (System.Collections.Generic.KeyValuePair<,>); + case DType.Variant: + return typeof (object); + default: + return null; + } + } + + public static Signature GetSig (object[] objs) + { + return GetSig (Type.GetTypeArray (objs)); + } + + public static Signature GetSig (Type[] types) + { + if (types == null) + throw new ArgumentNullException ("types"); + + Signature sig = Signature.Empty; + + foreach (Type type in types) + sig += GetSig (type); + + return sig; + } + + public static Signature GetSig (Type type) + { + if (type == null) + throw new ArgumentNullException ("type"); + + //this is inelegant, but works for now + if (type == typeof (Signature)) + return new Signature (DType.Signature); + + if (type == typeof (ObjectPath)) + return new Signature (DType.ObjectPath); + + if (type == typeof (void)) + return Signature.Empty; + + if (type.IsArray) + return GetSig (type.GetElementType ()).MakeArraySignature (); + + if (type.IsMarshalByRef) { + //TODO: consider further what to do for remote object reference marshaling + return new Signature (DType.ObjectPath); + } + + if (type.IsGenericType && (type.GetGenericTypeDefinition () == typeof (IDictionary<,>) || type.GetGenericTypeDefinition () == typeof (Dictionary<,>))) { + + Type[] genArgs = type.GetGenericArguments (); + return Signature.MakeDict (GetSig (genArgs[0]), GetSig (genArgs[1])); + } + + if (!type.IsPrimitive && type.IsValueType && !type.IsEnum) { + Signature sig = Signature.Empty; + + foreach (FieldInfo fi in type.GetFields ()) { + //there didn't seem to be a way to do this with BindingFlags at time of writing + if (fi.IsStatic) + continue; + sig += GetSig (fi.FieldType); + } + + return Signature.MakeStruct (sig); + } + + DType dtype = Signature.TypeToDType (type); + return new Signature (dtype); + } + } + + public enum ArgDirection + { + In, + Out, + } + + public enum DType : byte + { + Invalid = (byte)'\0', + + Byte = (byte)'y', + Boolean = (byte)'b', + Int16 = (byte)'n', + UInt16 = (byte)'q', + Int32 = (byte)'i', + UInt32 = (byte)'u', + Int64 = (byte)'x', + UInt64 = (byte)'t', + Single = (byte)'f', //This is not yet supported! + Double = (byte)'d', + String = (byte)'s', + ObjectPath = (byte)'o', + Signature = (byte)'g', + + Array = (byte)'a', + Struct = (byte)'r', + DictEntry = (byte)'e', + Variant = (byte)'v', + + StructBegin = (byte)'(', + StructEnd = (byte)')', + DictEntryBegin = (byte)'{', + DictEntryEnd = (byte)'}', + } +} diff -urNad telepathy-sharp-0.0.svn.20060831/dbus-sharp/src/Address.cs telepathy-sharp-0.0.svn.20070221/dbus-sharp/src/Address.cs --- telepathy-sharp-0.0.svn.20060831/dbus-sharp/src/Address.cs 2006-09-25 20:22:03.000000000 +0200 +++ telepathy-sharp-0.0.svn.20070221/dbus-sharp/src/Address.cs 1970-01-01 01:00:00.000000000 +0100 @@ -1,64 +0,0 @@ -// Copyright 2006 Alp Toker -// This software is made available under the MIT License -// See COPYING for details - -using System; - -namespace NDesk.DBus -{ - public class Address - { - //this method is not pretty - //not worth improving until there is a spec for this format - //TODO: confirm that return value represents parse errors - public static bool Parse (string addr, out string path, out bool abstr) - { - //(unix:(path|abstract)=.*,guid=.*|tcp:host=.*(,port=.*)?);? ... - path = null; - abstr = false; - - if (String.IsNullOrEmpty (addr)) - return false; - - string[] parts; - - parts = addr.Split (':'); - if (parts[0] == "unix") { - parts = parts[1].Split (','); - parts = parts[0].Split ('='); - if (parts[0] == "path") - abstr = false; - else if (parts[0] == "abstract") - abstr = true; - else - return false; - - path = parts[1]; - } else { - return false; - } - - return true; - } - - const string SYSTEM_BUS_ADDRESS = "unix:path=/var/run/dbus/system_bus_socket"; - public static string SystemBus - { - get { - string addr = Environment.GetEnvironmentVariable ("DBUS_SYSTEM_BUS_ADDRESS"); - - if (String.IsNullOrEmpty (addr)) - addr = SYSTEM_BUS_ADDRESS; - - return addr; - } - } - - public static string SessionBus - { - get { - return Environment.GetEnvironmentVariable ("DBUS_SESSION_BUS_ADDRESS"); - } - } - } -} diff -urNad telepathy-sharp-0.0.svn.20060831/dbus-sharp/src/AssemblyInfo.cs telepathy-sharp-0.0.svn.20070221/dbus-sharp/src/AssemblyInfo.cs --- telepathy-sharp-0.0.svn.20060831/dbus-sharp/src/AssemblyInfo.cs 2006-09-25 20:22:03.000000000 +0200 +++ telepathy-sharp-0.0.svn.20070221/dbus-sharp/src/AssemblyInfo.cs 1970-01-01 01:00:00.000000000 +0100 @@ -1,8 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; - -//[assembly: AssemblyVersion("0.0.0.*")] -[assembly: AssemblyTitle ("NDesk.DBus")] -[assembly: AssemblyDescription ("D-Bus IPC protocol library and CLR binding")] -[assembly: AssemblyCopyright ("Copyright (C) Alp Toker")] -[assembly: AssemblyCompany ("NDesk")] diff -urNad telepathy-sharp-0.0.svn.20060831/dbus-sharp/src/Authentication.cs telepathy-sharp-0.0.svn.20070221/dbus-sharp/src/Authentication.cs --- telepathy-sharp-0.0.svn.20060831/dbus-sharp/src/Authentication.cs 2006-09-25 20:22:03.000000000 +0200 +++ telepathy-sharp-0.0.svn.20070221/dbus-sharp/src/Authentication.cs 1970-01-01 01:00:00.000000000 +0100 @@ -1,145 +0,0 @@ -// Copyright 2006 Alp Toker -// This software is made available under the MIT License -// See COPYING for details - -using System; -using System.Diagnostics; -using System.Collections.Generic; -using System.IO; - -using System.Text; -using System.Globalization; - -namespace NDesk.DBus.Authentication -{ - public enum ClientState - { - WaitingForData, - WaitingForOK, - WaitingForReject, - } - - public enum ServerState - { - WaitingForAuth, - WaitingForData, - WaitingForBegin, - } - - public class SaslClient - { - protected Connection conn; - - protected SaslClient () - { - } - - public SaslClient (Connection conn) - { - this.conn = conn; - } - - public void Run () - { - //NetworkStream ns = new NetworkStream (sock); - //UnixStream ns = new UnixStream ((int)sock.Handle); - StreamReader sr = new StreamReader (conn.ns, Encoding.ASCII); - StreamWriter sw = new StreamWriter (conn.ns, Encoding.ASCII); - - sw.NewLine = "\r\n"; - //sw.AutoFlush = true; - - //send peer credentials null byte. note that this might not be portable - //there are also selinux, BSD etc. considerations - sw.Write ('\0'); - - string str = conn.Transport.AuthString (); - byte[] bs = Encoding.ASCII.GetBytes (str); - - string authStr = ToHex (bs); - - sw.WriteLine ("AUTH EXTERNAL {0}", authStr); - sw.Flush (); - - string ok_rep = sr.ReadLine (); - - string[] parts; - parts = ok_rep.Split (' '); - - if (parts.Length < 1 || parts[0] != "OK") - throw new Exception ("Authentication error: AUTH EXTERNAL was not OK"); - - /* - string guid = parts[1]; - byte[] guidData = FromHex (guid); - uint unixTime = BitConverter.ToUInt32 (guidData, 0); - Console.Error.WriteLine ("guid: " + guid + ", " + "unixTime: " + unixTime + " (" + UnixToDateTime (unixTime) + ")"); - */ - - sw.WriteLine ("BEGIN"); - sw.Flush (); - } - - //From Mono.Unix.Native.NativeConvert - //should these methods use long or (u)int? - public static DateTime UnixToDateTime (long time) - { - DateTime LocalUnixEpoch = new DateTime (1970, 1, 1); - TimeSpan LocalUtcOffset = TimeZone.CurrentTimeZone.GetUtcOffset (DateTime.UtcNow); - return LocalUnixEpoch.AddSeconds ((double) time + LocalUtcOffset.TotalSeconds); - } - - public static long DateTimeToUnix (DateTime time) - { - DateTime LocalUnixEpoch = new DateTime (1970, 1, 1); - TimeSpan LocalUtcOffset = TimeZone.CurrentTimeZone.GetUtcOffset (DateTime.UtcNow); - TimeSpan unixTime = time.Subtract (LocalUnixEpoch) - LocalUtcOffset; - - return (long) unixTime.TotalSeconds; - } - - //From Mono.Security.Cryptography - //Modified to output lowercase hex - static public string ToHex (byte[] input) - { - if (input == null) - return null; - - StringBuilder sb = new StringBuilder (input.Length * 2); - foreach (byte b in input) { - sb.Append (b.ToString ("x2", CultureInfo.InvariantCulture)); - } - return sb.ToString (); - } - - //From Mono.Security.Cryptography - static private byte FromHexChar (char c) - { - if ((c >= 'a') && (c <= 'f')) - return (byte) (c - 'a' + 10); - if ((c >= 'A') && (c <= 'F')) - return (byte) (c - 'A' + 10); - if ((c >= '0') && (c <= '9')) - return (byte) (c - '0'); - throw new ArgumentException ("Invalid hex char"); - } - - //From Mono.Security.Cryptography - static public byte[] FromHex (string hex) - { - if (hex == null) - return null; - if ((hex.Length & 0x1) == 0x1) - throw new ArgumentException ("Length must be a multiple of 2"); - - byte[] result = new byte [hex.Length >> 1]; - int n = 0; - int i = 0; - while (n < result.Length) { - result [n] = (byte) (FromHexChar (hex [i++]) << 4); - result [n++] += FromHexChar (hex [i++]); - } - return result; - } - } -} diff -urNad telepathy-sharp-0.0.svn.20060831/dbus-sharp/src/Connection.cs telepathy-sharp-0.0.svn.20070221/dbus-sharp/src/Connection.cs --- telepathy-sharp-0.0.svn.20060831/dbus-sharp/src/Connection.cs 2006-09-25 20:22:03.000000000 +0200 +++ telepathy-sharp-0.0.svn.20070221/dbus-sharp/src/Connection.cs 1970-01-01 01:00:00.000000000 +0100 @@ -1,700 +0,0 @@ -// Copyright 2006 Alp Toker -// This software is made available under the MIT License -// See COPYING for details - -using System; -using System.Diagnostics; -using System.Collections.Generic; -using System.IO; - -using System.Reflection; -using System.Reflection.Emit; - -//using Console = System.Diagnostics.Trace; - -namespace NDesk.DBus -{ - using Authentication; - - public class Connection - { - //TODO: reduce/correct visibility of these when appropriate - public Stream ns = null; - public long SocketHandle; - - protected Transport transport; - public Transport Transport { - get { - return transport; - } set { - transport = value; - } - } - - public Connection () : this (true) - { - } - - public Connection (bool autoConnect) - { - if (!autoConnect) - return; - - string path; - bool abstr; - - Address.Parse (Address.SessionBus, out path, out abstr); - - //not really correct - if (String.IsNullOrEmpty (path)) - Address.Parse (Address.SystemBus, out path, out abstr); - - Open (path, abstr); - Authenticate (); - } - - public void Open (string address) - { - string path; - bool abstr; - - if (address == null) - throw new ArgumentNullException ("address"); - - if (!Address.Parse (address, out path, out abstr)) - throw new ArgumentException ("Invalid D-Bus address: '" + address + "'", "address"); - - Open (path, abstr); - } - - public void Open (string path, bool abstr) - { - //transport = new UnixMonoTransport (path, abstr); - transport = new UnixNativeTransport (path, abstr); - ns = transport.Stream; - SocketHandle = transport.SocketHandle; - } - - public void Authenticate () - { - SaslClient auth = new SaslClient (this); - auth.Run (); - } - - //Interlocked.Increment() handles the overflow condition for uint correctly, so it's ok to store the value as an int but cast it to uint - protected int serial = 0; - public uint GenerateSerial () - { - //return ++serial; - return (uint)System.Threading.Interlocked.Increment (ref serial); - } - - - - - public Message SendWithReplyAndBlock (Message msg) - { - uint id = SendWithReply (msg); - - Message retMsg = WaitForReplyTo (id); - - return retMsg; - } - - public uint SendWithReply (Message msg) - { - msg.ReplyExpected = true; - return Send (msg); - } - - public uint Send (Message msg) - { - msg.Header.Serial = GenerateSerial (); - - msg.WriteHeader (); - - WriteMessage (msg); - - //Outbound.Enqueue (msg); - //temporary - //Flush (); - - return msg.Header.Serial; - } - - //could be cleaner - protected void WriteMessage (Message msg) - { - //ns.Write (msg.HeaderData, 0, msg.HeaderSize); - //Console.WriteLine ("headerSize: " + msg.HeaderSize); - //Console.WriteLine ("headerLength: " + msg.HeaderData.Length); - //Console.WriteLine (); - ns.Write (msg.HeaderData, 0, msg.HeaderData.Length); - if (msg.Body != null) { - ns.Write (msg.Body, 0, msg.Body.Length); - //msg.Body.WriteTo (ns); - } - } - - protected Queue Inbound = new Queue (); - protected Queue Outbound = new Queue (); - - public void Flush () - { - //should just iterate the enumerator here - while (Outbound.Count != 0) { - Message msg = Outbound.Dequeue (); - WriteMessage (msg); - } - } - - public Message ReadMessage () - { - //FIXME: fix reading algorithm to work in one step - //this code is a bit silly and inefficient - //hopefully it's at least correct and avoids polls for now - - int read; - - byte[] buf = new byte[16]; - read = ns.Read (buf, 0, 16); - - if (read != 16) - throw new Exception ("Header read length mismatch: " + read + " of expected " + "16"); - - MemoryStream ms = new MemoryStream (); - - ms.Write (buf, 0, 16); - - int toRead; - int bodyLen; - - //FIXME: use endianness instead of failing on non-native endianness - EndianFlag endianness = (EndianFlag)buf[0]; - if (endianness != Connection.NativeEndianness) - throw new NotImplementedException ("Only native-endian message reading is currently supported"); - - bodyLen = (int)BitConverter.ToUInt32 (buf, 4); - toRead = (int)BitConverter.ToUInt32 (buf, 12); - - toRead = Padding.Padded ((int)toRead, 8); - - buf = new byte[toRead]; - - read = ns.Read (buf, 0, toRead); - - if (read != toRead) - throw new Exception ("Read length mismatch: " + read + " of expected " + toRead); - - ms.Write (buf, 0, buf.Length); - - Message msg = new Message (); - msg.HeaderData = ms.ToArray (); - - //read the body - if (bodyLen != 0) { - //FIXME - //msg.Body = new byte[(int)msg.Header->Length]; - byte[] body = new byte[bodyLen]; - - //int len = ns.Read (msg.Body, 0, msg.Body.Length); - int len = ns.Read (body, 0, bodyLen); - - //if (len != msg.Body.Length) - if (len != bodyLen) - throw new Exception ("Message body size mismatch"); - - //msg.Body = new MemoryStream (body); - msg.Body = body; - } - - //this needn't be done here - msg.ParseHeader (); - - return msg; - } - - //this is just a start - //needs to be done properly - public Message WaitForReplyTo (uint id) - { - //Message msg = Inbound.Dequeue (); - - Message msg; - - while ((msg = ReadMessage ()) != null) { - switch (msg.Header.MessageType) { - case MessageType.Invalid: - throw new Exception ("Invalid message received"); - case MessageType.MethodCall: - MethodCall method_call = new MethodCall (msg); - HandleMethodCall (method_call); - break; - case MessageType.MethodReturn: - MethodReturn method_return = new MethodReturn (msg); - if (method_return.ReplySerial == id) - return msg; - //if the signature is empty, it's just a token return message - if (msg.Signature != Signature.Empty) - Console.Error.WriteLine ("Warning: While waiting for reply to " + id + ": Couldn't handle async MethodReturn message for request id " + method_return.ReplySerial + " with signature '" + msg.Signature + "'"); - break; - case MessageType.Error: - Error error = new Error (msg); - if (error.ReplySerial == id) - return msg; - Console.Error.WriteLine ("Warning: While waiting for reply to " + id + ": Couldn't handle async Error message for request id " + error.ReplySerial + " with signature '" + msg.Signature + "'"); - break; - case MessageType.Signal: - //Signal signal = new Signal (msg); - HandleSignal (msg); - break; - } - } - - return null; - } - - - //temporary hack - public void Iterate () - { - //Message msg = Inbound.Dequeue (); - - Message msg; - - msg = ReadMessage (); - - switch (msg.Header.MessageType) { - case MessageType.MethodCall: - MethodCall method_call = new MethodCall (msg); - HandleMethodCall (method_call); - break; - case MessageType.MethodReturn: - MethodReturn method_return = new MethodReturn (msg); - if (PendingCalls.ContainsKey (method_return.ReplySerial)) { - //TODO: pending calls - //return msg; - } - //if the signature is empty, it's just a token return message - if (msg.Signature != Signature.Empty) - Console.Error.WriteLine ("Warning: Couldn't handle async MethodReturn message for request id " + method_return.ReplySerial + " with signature '" + msg.Signature + "'"); - break; - case MessageType.Error: - //TODO: better exception handling - Error error = new Error (msg); - string errMsg = ""; - if (msg.Signature.Value == "s") { - MessageReader reader = new MessageReader (msg); - reader.GetValue (out errMsg); - } - throw new Exception ("Remote Error: Signature='" + msg.Signature.Value + "' " + error.ErrorName + ": " + errMsg); - case MessageType.Signal: - HandleSignal (msg); - break; - case MessageType.Invalid: - default: - throw new Exception ("Invalid message received: MessageType='" + msg.Header.MessageType + "'"); - } - } - - public Dictionary PendingCalls = new Dictionary (); - - - //this might need reworking with MulticastDelegate - public void HandleSignal (Message msg) - { - Signal signal = new Signal (msg); - - if (Handlers.ContainsKey (signal.Member)) { - Delegate dlg = Handlers[signal.Member]; - //dlg.DynamicInvoke (GetDynamicValues (msg)); - - MethodInfo mi = dlg.Method; - //signals have no return value - dlg.DynamicInvoke (GetDynamicValues (msg, mi.GetParameters ())); - - } else { - //TODO: how should we handle this condition? sending an Error may not be appropriate in this case - Console.Error.WriteLine ("Warning: No signal handler for " + signal.Member); - } - } - - public Dictionary Handlers = new Dictionary (); - - //should generalize this method - //it is duplicated in DProxy - protected Message ConstructReplyFor (MethodCall method_call, object[] vals) - { - MethodReturn method_return = new MethodReturn (method_call.message.Header.Serial); - //Message replyMsg = new Message (); - Message replyMsg = method_return.message; - - //replyMsg.Header.MessageType = MessageType.MethodReturn; - //replyMsg.ReplyExpected = false; - - Signature inSig = Signature.GetSig (vals); - - if (vals != null && vals.Length != 0) { - MessageWriter writer = new MessageWriter (EndianFlag.Little); - - foreach (object arg in vals) - writer.Write (arg.GetType (), arg); - - replyMsg.Body = writer.ToArray (); - } - - //FIXME: this breaks the abstraction - replyMsg.Header.Fields[FieldCode.ReplySerial] = method_call.message.Header.Serial; - //TODO: this is a temporary hack to make p2p work, we should always send Destination - if (method_call.Sender != null) - replyMsg.Header.Fields[FieldCode.Destination] = method_call.Sender; - if (inSig != Signature.Empty) - replyMsg.Header.Fields[FieldCode.Signature] = inSig; - - //replyMsg.WriteHeader (); - - return replyMsg; - } - - //not particularly efficient and needs to be generalized - public void HandleMethodCall (MethodCall method_call) - { - //Console.Error.WriteLine ("method_call destination: " + method_call.Destination); - //Console.Error.WriteLine ("method_call path: " + method_call.Path); - - //TODO: Ping and Introspect need to be abstracted and moved somewhere more appropriate once message filter infrastructure is complete - - if (method_call.Interface == "org.freedesktop.DBus.Peer" && method_call.Member == "Ping") { - object[] pingRet = new object[0]; - Message reply = ConstructReplyFor (method_call, pingRet); - Send (reply); - return; - } - - if (method_call.Interface == "org.freedesktop.DBus.Introspectable" && method_call.Member == "Introspect") { - Introspector intro = new Introspector (); - intro.root_path = method_call.Path; - //FIXME: do this properly - foreach (ObjectPath pth in RegisteredObjects.Keys) { - if (pth.Value.StartsWith (method_call.Path.Value)) { - intro.target_path = pth; - intro.target_type = RegisteredObjects[pth].GetType (); - } - } - intro.HandleIntrospect (); - //Console.Error.WriteLine (intro.xml); - - object[] introRet = new object[1]; - introRet[0] = intro.xml; - Message reply = ConstructReplyFor (method_call, introRet); - Send (reply); - return; - } - - if (RegisteredObjects.ContainsKey (method_call.Path)) { - object obj = RegisteredObjects[method_call.Path]; - Type type = obj.GetType (); - //object retObj = type.InvokeMember (msg.Member, BindingFlags.InvokeMethod, null, obj, GetDynamicValues (msg)); - - string methodName = method_call.Member; - - //map property accessors - //FIXME: this needs to be done properly, not with simple String.Replace - //special case for Notifications left as a reminder that this is broken - if (method_call.Interface == "org.freedesktop.Notifications") { - methodName = methodName.Replace ("Get", "get_"); - methodName = methodName.Replace ("Set", "set_"); - } - - //FIXME: breaks for overloaded methods - MethodInfo mi = type.GetMethod (methodName, BindingFlags.Public | BindingFlags.Instance); - object retObj = null; - try { - retObj = mi.Invoke (obj, GetDynamicValues (method_call.message, mi.GetParameters ())); - } catch (TargetInvocationException e) { - Console.Error.WriteLine (e); - - //TODO: complete exception sending support - //need to find out what outgoing Error messages look like - /* - Exception ie = e.InnerException; - //Console.Error.WriteLine ("e \n\n" + e + "\n\n contains \n\n" + ie); - - Error error = new Error ("org.ndesk.SomeException", method_call.message.Header.Serial); - //TODO: this is a temporary hack to make p2p work, we should always send Destination - if (method_call.Sender != null) - error.message.Header.Fields[FieldCode.Destination] = method_call.Sender; - - error.message.Header.Fields[FieldCode.Interface] = method_call.Interface; - error.message.Header.Fields[FieldCode.Member] = method_call.Member; - - Send (error.message); - */ - return; - } - - if (method_call.message.ReplyExpected) { - object[] retObjs; - - if (retObj == null) { - retObjs = new object[0]; - } else { - retObjs = new object[1]; - retObjs[0] = retObj; - } - - Message reply = ConstructReplyFor (method_call, retObjs); - Send (reply); - } - } else { - //FIXME: send the appropriate Error message - Console.Error.WriteLine ("Warning: No method handler for " + method_call.Member); - } - } - - protected Dictionary RegisteredObjects = new Dictionary (); - - //GetDynamicValues() should probably use yield eventually - - public object[] GetDynamicValues (Message msg, ParameterInfo[] parms) - { - //TODO: consider out parameters - - Type[] types = new Type[parms.Length]; - for (int i = 0 ; i != parms.Length ; i++) - types[i] = parms[i].ParameterType; - - return GetDynamicValues (msg, types); - } - - public object[] GetDynamicValues (Message msg, Type[] types) - { - List vals = new List (); - - if (msg.Body != null) { - MessageReader reader = new MessageReader (msg); - - foreach (Type type in types) { - object arg; - reader.GetValue (type, out arg); - vals.Add (arg); - } - } - - return vals.ToArray (); - } - - public object[] GetDynamicValues (Message msg) - { - List vals = new List (); - - if (msg.Body != null) { - MessageReader reader = new MessageReader (msg); - - foreach (DType dtype in msg.Signature.Data) { - object arg; - reader.GetValue (dtype, out arg); - vals.Add (arg); - } - } - - return vals.ToArray (); - } - - //FIXME: this shouldn't be part of the core API - //that also applies to much of the other object mapping code - //it should cache proxies and objects, really - - //inspired by System.Activator - public object GetObject (Type type, string bus_name, ObjectPath object_path) - { - DProxy prox = new DProxy (this, bus_name, object_path, type); - return prox.GetTransparentProxy (); - } - - public T GetObject (string bus_name, ObjectPath object_path) - { - return (T)GetObject (typeof (T), bus_name, object_path); - } - - //see also: - //from System.Runtime.Remoting.RemotingServices: - //public static object Connect (Type classToProxy, string url); - - //this may be silly API, but better than raw access to the dictionary: - //inspired by System.Runtime.Remoting.RemotingServices - //public ObjRef Marshal (MarshalByRefObject obj, string uri) - public void Marshal (MarshalByRefObject obj, string bus_name, ObjectPath path) - { - Marshal ((object) obj, bus_name, path); - } - - //just in case the MarshalByRefObject requirement is crack - //FIXME: this api is slightly confused right now - public void Marshal (object obj, string bus_name, ObjectPath path) - { - //this is just the start of il generation work - - Type type = obj.GetType (); - - //note that this hooks up to all events, not declared only right now - foreach (EventInfo ei in type.GetEvents ()) { - Delegate dlg = GetHookupDelegate (ei, bus_name, path); - ei.AddEventHandler (obj, dlg); - } - - //FIXME: implement some kind of tree data structure or internal object hierarchy. right now we are ignoring the name and putting all object paths in one namespace, which is bad - RegisteredObjects[path] = obj; - } - - //public static Delegate GetHookupDelegate (EventInfo ei, string bus_name, ObjectPath path) - public Delegate GetHookupDelegate (EventInfo ei, string bus_name, ObjectPath path) - { - //Console.Error.WriteLine (ei.Name); - - if (ei.EventHandlerType.IsAssignableFrom (typeof (System.EventHandler))) - Console.Error.WriteLine ("Warning: Cannot yet fully marshal EventHandler and its subclasses: " + ei.EventHandlerType); - - ParameterInfo[] delegateParms = ei.EventHandlerType.GetMethod ("Invoke").GetParameters (); - Type[] hookupParms = new Type[delegateParms.Length+1]; - hookupParms[0] = typeof (Connection); - for (int i = 0; i < delegateParms.Length ; i++) - hookupParms[i+1] = delegateParms[i].ParameterType; - - DynamicMethod hookupMethod = new DynamicMethod ("Handle" + ei.Name, typeof (void), hookupParms, typeof (object)); - ILGenerator ilg = hookupMethod.GetILGenerator (); - - //the Connection instance - ilg.Emit (OpCodes.Ldarg_0); - - //bus_name - ilg.Emit (OpCodes.Ldstr, bus_name); - - //object_path - //TODO: make this an ObjectPath struct rather than a string? - ilg.Emit (OpCodes.Ldstr, path.Value); - - //interface - ilg.Emit (OpCodes.Ldstr, GetInterfaceName (ei)); - - //member - ilg.Emit (OpCodes.Ldstr, ei.Name); - - LocalBuilder local = ilg.DeclareLocal (typeof (object[])); - ilg.Emit (OpCodes.Ldc_I4, hookupParms.Length - 1); - ilg.Emit (OpCodes.Newarr, typeof (object)); - ilg.Emit (OpCodes.Stloc, local); - - //offset by one because arg0 is the instance of the delegate - for (int i = 1 ; i < hookupParms.Length ; i++) - { - Type t = hookupParms[i]; - - ilg.Emit (OpCodes.Ldloc, local); - //the delegate instance offset requires a -1 here - ilg.Emit (OpCodes.Ldc_I4, i-1); - ilg.Emit (OpCodes.Ldarg, i); - if (t.IsValueType) - ilg.Emit (OpCodes.Box, t); - ilg.Emit (OpCodes.Stelem_Ref); - } - - ilg.Emit (OpCodes.Ldloc, local); - ilg.Emit (OpCodes.Call, typeof (Connection).GetMethod ("InvokeSignal")); - - //void return - ilg.Emit (OpCodes.Ret); - - Delegate d = hookupMethod.CreateDelegate (ei.EventHandlerType, this); - return d; - } - - public object Unmarshal (string bus_name, ObjectPath path) - { - //TODO: make use of bus_name - - if (!RegisteredObjects.ContainsKey (path)) - throw new Exception ("Cannot unmarshal " + path + " as it isn't marshaled"); - object obj = RegisteredObjects[path]; - - RegisteredObjects.Remove (path); - - //FIXME: complete unmarshaling including the handlers we added etc. - - return obj; - } - - //TODO: consider whether the dynamic approach will fall apart with variants, or if some kind of boxing tests can be used, whether to pass a Type[] signature, or is this a non-problem? - public void InvokeSignal (string bus_name, string object_path, string @interface, string member, object[] args) - { - //TODO: make use of bus_name - - //Console.Error.WriteLine ("SomeHandler " + @interface + ", " + member); - Signature sig = Signature.GetSig (args); - - Signal signal = new Signal (new ObjectPath (object_path), @interface, member); - signal.message.Signature = sig; - - if (args != null && args.Length != 0) { - MessageWriter writer = new MessageWriter (EndianFlag.Little); - - foreach (object arg in args) - writer.Write (arg.GetType (), arg); - - signal.message.Body = writer.ToArray (); - } - - Send (signal.message); - } - - //TODO: move these Get*Name helpers somewhere more appropriate - public static string GetArgumentName (ParameterInfo pi) - { - string argName = pi.Name; - - if (pi.IsRetval && String.IsNullOrEmpty (argName)) - argName = "ret"; - - return GetArgumentName ((ICustomAttributeProvider)pi, argName); - } - - public static string GetArgumentName (ICustomAttributeProvider attrProvider, string defaultName) - { - string argName = defaultName; - - //TODO: no need for foreach - foreach (ArgumentAttribute aa in attrProvider.GetCustomAttributes (typeof (ArgumentAttribute), false)) - argName = aa.Name; - - return argName; - } - - public static string GetInterfaceName (MemberInfo mi) - { - return GetInterfaceName (mi.DeclaringType); - } - - public static string GetInterfaceName (Type type) - { - string interfaceName = type.FullName; - - //TODO: better fallbacks and namespace mangling when no InterfaceAttribute is available - - //TODO: no need for foreach - foreach (InterfaceAttribute ia in type.GetCustomAttributes (typeof (InterfaceAttribute), false)) - interfaceName = ia.Name; - - return interfaceName; - } - - static Connection () - { - if (BitConverter.IsLittleEndian) - NativeEndianness = EndianFlag.Little; - else - NativeEndianness = EndianFlag.Big; - } - - public static readonly EndianFlag NativeEndianness; - } -} diff -urNad telepathy-sharp-0.0.svn.20060831/dbus-sharp/src/DBus.cs telepathy-sharp-0.0.svn.20070221/dbus-sharp/src/DBus.cs --- telepathy-sharp-0.0.svn.20060831/dbus-sharp/src/DBus.cs 2006-09-25 20:22:03.000000000 +0200 +++ telepathy-sharp-0.0.svn.20070221/dbus-sharp/src/DBus.cs 1970-01-01 01:00:00.000000000 +0100 @@ -1,111 +0,0 @@ -// Copyright 2006 Alp Toker -// This software is made available under the MIT License -// See COPYING for details - -using System; -using NDesk.DBus; - -//namespace org.freedesktop.DBus -namespace org.freedesktop.DBus -{ - /* - //what's this for? - public class DBusException : ApplicationException - { - } - */ - -#if UNDOCUMENTED_IN_SPEC - //TODO: maybe this should be mapped to its CLR counterpart directly? - //not yet used - [Interface ("org.freedesktop.DBus.Error.InvalidArgs")] - public class InvalidArgsException : ApplicationException - { - } -#endif - - [Flags] - public enum NameFlag : uint - { - None = 0, - AllowReplacement = 0x1, - ReplaceExisting = 0x2, - DoNotQueue = 0x4, - } - - public enum NameReply : uint - { - PrimaryOwner = 1, - InQueue, - Exists, - AlreadyOwner, - } - - public enum ReleaseNameReply : uint - { - Released = 1, - NonExistent, - NotOwner, - } - - public enum StartReply : uint - { - //The service was successfully started. - Success = 1, - //A connection already owns the given name. - AlreadyRunning, - } - - public delegate void NameOwnerChangedHandler (string name, string old_owner, string new_owner); - public delegate void NameAcquiredHandler (string name); - public delegate void NameLostHandler (string name); - - [Interface ("org.freedesktop.DBus.Peer")] - public interface Peer - { - void Ping (); - } - - [Interface ("org.freedesktop.DBus.Introspectable")] - public interface Introspectable - { - [return: Argument ("data")] - string Introspect (); - } - - [Interface ("org.freedesktop.DBus.Properties")] - public interface Properties - { - //TODO: some kind of indexer mapping? - //object this [string propname] {get; set;} - - [return: Argument ("value")] - object Get (string @interface, string propname); - //void Get (string @interface, string propname, out object value); - void Set (string @interface, string propname, object value); - } - - [Interface ("org.freedesktop.DBus")] - public interface Bus : Introspectable - { - NameReply RequestName (string name, NameFlag flags); - ReleaseNameReply ReleaseName (string name); - string Hello (); - string[] ListNames (); - bool NameHasOwner (string name); - event NameOwnerChangedHandler NameOwnerChanged; - event NameLostHandler NameLost; - event NameAcquiredHandler NameAcquired; - StartReply StartServiceByName (string name, uint flags); - string GetNameOwner (string name); - uint GetConnectionUnixUser (string connection_name); - void AddMatch (string rule); - void RemoveMatch (string rule); - -#if UNDOCUMENTED_IN_SPEC - //undocumented in spec - //there are more of these - void ReloadConfig (); -#endif - } -} diff -urNad telepathy-sharp-0.0.svn.20060831/dbus-sharp/src/DProxy.cs telepathy-sharp-0.0.svn.20070221/dbus-sharp/src/DProxy.cs --- telepathy-sharp-0.0.svn.20060831/dbus-sharp/src/DProxy.cs 2006-09-25 20:22:03.000000000 +0200 +++ telepathy-sharp-0.0.svn.20070221/dbus-sharp/src/DProxy.cs 1970-01-01 01:00:00.000000000 +0100 @@ -1,222 +0,0 @@ -// Copyright 2006 Alp Toker -// This software is made available under the MIT License -// See COPYING for details - -using System; -using System.IO; -using System.Collections.Generic; -using System.Reflection; -using System.Runtime.Remoting.Proxies; -using System.Runtime.Remoting.Messaging; - -namespace NDesk.DBus -{ - //marked internal because this is really an implementation detail and needs to be replaced - internal class DProxy : RealProxy - { - Connection conn; - - string bus_name; - ObjectPath object_path; - - //Dictionary methods = new Dictionary (); - - public DProxy (Connection conn, string bus_name, ObjectPath object_path, Type type) : base(type) - { - this.conn = conn; - this.bus_name = bus_name; - this.object_path = object_path; - } - - public override IMessage Invoke (IMessage msg) - { - IMethodCallMessage mcm = (IMethodCallMessage) msg; - - MethodReturnMessageWrapper newRet = new MethodReturnMessageWrapper ((IMethodReturnMessage) msg); - - MethodInfo imi = mcm.MethodBase as MethodInfo; - string methodName = mcm.MethodName; - - if (imi != null && imi.IsSpecialName) { - if (methodName.StartsWith ("add_")) { - string[] parts = mcm.MethodName.Split ('_'); - string ename = parts[1]; - Delegate dlg = (Delegate)mcm.InArgs[0]; - - conn.Handlers[ename] = dlg; - - //inelegant - if (bus_name != "org.freedesktop.DBus" || object_path.Value != "/org/freedesktop/DBus" || ename != "NameAcquired") { - org.freedesktop.DBus.Bus bus = conn.GetObject ("org.freedesktop.DBus", new ObjectPath ("/org/freedesktop/DBus")); - bus.AddMatch (MessageFilter.CreateMatchRule (MessageType.Signal, object_path, Connection.GetInterfaceName (imi), ename)); - conn.Iterate (); - } - - return (IMethodReturnMessage) newRet; - } - - if (mcm.MethodName.StartsWith ("remove_")) { - string[] parts = mcm.MethodName.Split ('_'); - - string ename = parts[1]; - //Delegate dlg = (Delegate)mcm.InArgs[0]; - - //FIXME: this removes the match rule even when we still have delegates connected to the event! - //inelegant - if (bus_name != "org.freedesktop.DBus" || object_path.Value != "/org/freedesktop/DBus" || ename != "NameAcquired") { - org.freedesktop.DBus.Bus bus = conn.GetObject ("org.freedesktop.DBus", new ObjectPath ("/org/freedesktop/DBus")); - bus.RemoveMatch (MessageFilter.CreateMatchRule (MessageType.Signal, object_path, Connection.GetInterfaceName (imi), ename)); - conn.Iterate (); - } - - conn.Handlers.Remove (ename); - - return (IMethodReturnMessage) newRet; - } - } - - Signature inSig = Signature.GetSig (mcm.InArgs); - - MethodCall method_call; - Message callMsg; - - //build the outbound method call message - { - //this bit is error-prone (no null checking) and will need rewriting when DProxy is replaced - string iface = null; - if (imi != null) - iface = Connection.GetInterfaceName (imi); - - //map property accessors - //TODO: this needs to be done properly, not with simple String.Replace - //note that IsSpecialName is also for event accessors, but we already handled those and returned - if (imi != null && imi.IsSpecialName) { - methodName = methodName.Replace ("get_", "Get"); - methodName = methodName.Replace ("set_", "Set"); - } - - /* - callMsg.Header.Fields[FieldCode.Path] = object_path; - callMsg.Header.Fields[FieldCode.Interface] = iface; - callMsg.Header.Fields[FieldCode.Member] = methodName; - callMsg.Header.Fields[FieldCode.Destination] = bus_name; - if (inSig != Signature.Empty) - callMsg.Header.Fields[FieldCode.Signature] = inSig; - */ - - //callMsg.WriteHeader (); - - /* - if (inSig == Signature.Empty) - { - callMsg.WriteHeader (HeaderField.Create (FieldCode.Path, object_path), HeaderField.Create (FieldCode.Interface, iface), HeaderField.Create (FieldCode.Member, methodName), HeaderField.Create (FieldCode.Destination, bus_name)); - } else { - callMsg.WriteHeader (HeaderField.Create (FieldCode.Path, object_path), HeaderField.Create (FieldCode.Interface, iface), HeaderField.Create (FieldCode.Member, methodName), HeaderField.Create (FieldCode.Destination, bus_name), HeaderField.Create (FieldCode.Signature, inSig)); - } - */ - - if (inSig != Signature.Empty) - method_call = new MethodCall (object_path, iface, methodName, bus_name, inSig); - else - method_call = new MethodCall (object_path, iface, methodName, bus_name); - - callMsg = method_call.message; - - if (mcm.InArgs != null && mcm.InArgs.Length != 0) { - MessageWriter writer = new MessageWriter (EndianFlag.Little); - - foreach (object arg in mcm.InArgs) - writer.Write (arg.GetType (), arg); - - callMsg.Body = writer.ToArray (); - } - } - - bool needsReply = true; - - MethodInfo mi = newRet.MethodBase as MethodInfo; - - //TODO: complete out parameter support - Signature oSig = Signature.GetSig (ArgDirection.Out, mi.GetParameters ()); - if (oSig != Signature.Empty) - throw new Exception ("Out parameters not yet supported: out_signature='" + oSig.Value + "'"); - - if (mi.ReturnType == typeof (void)) - needsReply = false; - - callMsg.ReplyExpected = needsReply; - - //signature helper is broken, so write it by hand - callMsg.Header.Fields[FieldCode.Path] = object_path; - //callMsg.Header.Fields[FieldCode.Interface] = iface; - callMsg.Header.Fields[FieldCode.Member] = methodName; - callMsg.Header.Fields[FieldCode.Destination] = bus_name; - if (inSig != Signature.Empty) - callMsg.Header.Fields[FieldCode.Signature] = inSig; - - if (!needsReply) { - conn.Send (callMsg); - return (IMethodReturnMessage) newRet; - } - - Type[] retTypeArr = new Type[1]; - retTypeArr[0] = mi.ReturnType; - -#if PROTO_REPLY_SIGNATURE - Signature outSig = Signature.GetSig (retTypeArr); - callMsg.Header.Fields[FieldCode.ReplySignature] = outSig; -#endif - - Message retMsg = conn.SendWithReplyAndBlock (callMsg); - - //handle the reply message - if (retMsg.Header.MessageType == MessageType.Error) { - //TODO: typed exceptions - Error error = new Error (retMsg); - string errMsg = ""; - if (retMsg.Signature.Value.StartsWith ("s")) { - MessageReader reader = new MessageReader (retMsg); - reader.GetValue (out errMsg); - } - Exception e = new Exception (error.ErrorName + ": " + errMsg); - newRet.Exception = e; - } else if (retMsg.Header.MessageType == MessageType.MethodReturn) { - newRet.ReturnValue = conn.GetDynamicValues (retMsg, retTypeArr)[0]; - } else { - //should not be possible to reach this at present - throw new Exception ("Got unexpected message of type " + retMsg.Header.MessageType + " while waiting for a MethodReturn"); - } - - return (IMethodReturnMessage) newRet; - } - - /* - public override ObjRef CreateObjRef (Type ServerType) - { - throw new System.NotImplementedException (); - } - */ - } - - [AttributeUsage (AttributeTargets.Interface | AttributeTargets.Class, AllowMultiple=false, Inherited=true)] - public class InterfaceAttribute : Attribute - { - public string Name; - - public InterfaceAttribute (string name) - { - this.Name = name; - } - } - - [AttributeUsage (AttributeTargets.Parameter | AttributeTargets.ReturnValue, AllowMultiple=false, Inherited=true)] - public class ArgumentAttribute : Attribute - { - public string Name; - - public ArgumentAttribute (string name) - { - this.Name = name; - } - } -} diff -urNad telepathy-sharp-0.0.svn.20060831/dbus-sharp/src/Introspection.cs telepathy-sharp-0.0.svn.20070221/dbus-sharp/src/Introspection.cs --- telepathy-sharp-0.0.svn.20060831/dbus-sharp/src/Introspection.cs 2006-09-25 20:22:03.000000000 +0200 +++ telepathy-sharp-0.0.svn.20070221/dbus-sharp/src/Introspection.cs 1970-01-01 01:00:00.000000000 +0100 @@ -1,281 +0,0 @@ -// Copyright 2006 Alp Toker -// This software is made available under the MIT License -// See COPYING for details - -using System; -using System.Diagnostics; -using System.Collections.Generic; -using System.IO; -using System.Xml; -using System.Text; -using System.Reflection; - -namespace NDesk.DBus -{ - //TODO: complete this class - public class Introspector - { - const string NAMESPACE = "http://www.freedesktop.org/standards/dbus"; - const string PUBLIC_IDENTIFIER = "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN"; - const string SYSTEM_IDENTIFIER = "http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd"; - - public StringBuilder sb; - public string xml; - public Type target_type = null; - public ObjectPath root_path = ObjectPath.Root; - public ObjectPath target_path = ObjectPath.Root; - - protected XmlWriter writer; - - public Introspector () - { - XmlWriterSettings settings = new XmlWriterSettings (); - settings.Indent = true; - settings.IndentChars = (" "); - settings.OmitXmlDeclaration = true; - - sb = new StringBuilder (); - - writer = XmlWriter.Create (sb, settings); - } - - public void HandleIntrospect () - { - writer.WriteDocType ("node", PUBLIC_IDENTIFIER, SYSTEM_IDENTIFIER, null); - - //TODO: write version info in a comment, when we get an AssemblyInfo.cs - - writer.WriteComment (" Never rely on XML introspection data for dynamic binding. It is provided only for convenience and is subject to change at any time. "); - - writer.WriteComment (" Warning: Intospection support is incomplete in this implementation "); - - writer.WriteComment (" This is the introspection result for ObjectPath: " + root_path + " "); - - //the root node element - writer.WriteStartElement ("node"); - - //FIXME: don't hardcode this stuff, do it properly! - if (root_path.Value == "/") { - writer.WriteStartElement ("node"); - writer.WriteAttributeString ("name", "org"); - writer.WriteEndElement (); - } - - if (root_path.Value == "/org") { - writer.WriteStartElement ("node"); - writer.WriteAttributeString ("name", "ndesk"); - writer.WriteEndElement (); - } - - if (root_path.Value == "/org/ndesk") { - writer.WriteStartElement ("node"); - writer.WriteAttributeString ("name", "test"); - writer.WriteEndElement (); - } - - if (root_path.Value == target_path.Value) { - WriteNodeBody (); - } - - writer.WriteEndElement (); - - writer.Flush (); - xml = sb.ToString (); - } - - //public void WriteNode () - public void WriteNodeBody () - { - //writer.WriteStartElement ("node"); - - //TODO: non-well-known introspection has paths as well, which we don't do yet. read the spec again - //hackishly just remove the root '/' to make the path relative for now - //writer.WriteAttributeString ("name", target_path.Value.Substring (1)); - //writer.WriteAttributeString ("name", "test"); - - //reflect our own interface manually - WriteInterface (typeof (org.freedesktop.DBus.Introspectable)); - - //reflect the target interface - if (target_type != null) { - WriteInterface (target_type); - - foreach (Type ifType in target_type.GetInterfaces ()) - WriteInterface (ifType); - } - - //TODO: review recursion of interfaces and inheritance hierarchy - - //writer.WriteEndElement (); - } - - public void WriteArg (ParameterInfo pi) - { - WriteArg (pi.ParameterType, Connection.GetArgumentName (pi), pi.IsOut, false); - } - - public void WriteArgReverse (ParameterInfo pi) - { - WriteArg (pi.ParameterType, Connection.GetArgumentName (pi), pi.IsOut, true); - } - - //TODO: clean up and get rid of reverse (or argIsOut) parm - public void WriteArg (Type argType, string argName, bool argIsOut, bool reverse) - { - argType = argIsOut ? argType.GetElementType () : argType; - if (argType == typeof (void)) - return; - - //FIXME: remove these special cases, they are just for testing - if (argType.FullName == "GLib.Value") - argType = typeof (object); - if (argType.FullName == "GLib.GType") - argType = typeof (Signature); - - writer.WriteStartElement ("arg"); - - if (!String.IsNullOrEmpty (argName)) - writer.WriteAttributeString ("name", argName); - - //we can't rely on the default direction (qt-dbus requires a direction at time of writing), so we use a boolean to reverse the parameter direction and make it explicit - - if (argIsOut) - writer.WriteAttributeString ("direction", !reverse ? "out" : "in"); - else - writer.WriteAttributeString ("direction", !reverse ? "in" : "out"); - - Signature sig = Signature.GetSig (argType); - - //FIXME: this hides the fact that there are invalid types coming up - //sig.Value = sig.Value.Replace ((char)DType.Invalid, (char)DType.Variant); - //sig.Value = sig.Value.Replace ((char)DType.Single, (char)DType.UInt32); - - //writer.WriteAttributeString ("type", Signature.GetSig (argType).Value); - writer.WriteAttributeString ("type", sig.Value); - - writer.WriteEndElement (); - } - - public void WriteMethod (MethodInfo mi) - { - writer.WriteStartElement ("method"); - writer.WriteAttributeString ("name", mi.Name); - - foreach (ParameterInfo pi in mi.GetParameters ()) - WriteArg (pi); - - //Mono <= 1.1.13 doesn't support MethodInfo.ReturnParameter, so avoid it - //WriteArgReverse (mi.ReturnParameter); - WriteArg (mi.ReturnType, Connection.GetArgumentName (mi.ReturnTypeCustomAttributes, "ret"), false, true); - - writer.WriteEndElement (); - } - - public void WriteProperty (PropertyInfo pri) - { - //expose properties as dbus properties - writer.WriteStartElement ("property"); - writer.WriteAttributeString ("name", pri.Name); - writer.WriteAttributeString ("type", Signature.GetSig (pri.PropertyType).Value); - string access = (pri.CanRead ? "read" : String.Empty) + (pri.CanWrite ? "write" : String.Empty); - writer.WriteAttributeString ("access", access); - writer.WriteEndElement (); - - //expose properties as methods also - //it may not be worth doing this in the long run - /* - if (pri.CanRead) { - writer.WriteStartElement ("method"); - writer.WriteAttributeString ("name", "Get" + pri.Name); - WriteArgReverse (pri.GetGetMethod ().ReturnParameter); - writer.WriteEndElement (); - } - - if (pri.CanWrite) { - writer.WriteStartElement ("method"); - writer.WriteAttributeString ("name", "Set" + pri.Name); - foreach (ParameterInfo pi in pri.GetSetMethod ().GetParameters ()) - WriteArg (pi); - writer.WriteEndElement (); - } - */ - } - - public void WriteSignal (EventInfo ei) - { - writer.WriteStartElement ("signal"); - writer.WriteAttributeString ("name", ei.Name); - - foreach (ParameterInfo pi in ei.EventHandlerType.GetMethod ("Invoke").GetParameters ()) - WriteArgReverse (pi); - - //no need to consider the delegate return value as dbus doesn't support it - writer.WriteEndElement (); - } - - const BindingFlags relevantBindingFlags = BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly; - - public void WriteInterface (Type type) - { - if (type == null) - return; - - //TODO: this is unreliable, fix it - if (!type.IsInterface && !type.IsSubclassOf (typeof (MarshalByRefObject))) - return; - - writer.WriteStartElement ("interface"); - - writer.WriteAttributeString ("name", Connection.GetInterfaceName (type)); - - /* - foreach (MemberInfo mbi in type.GetMembers (relevantBindingFlags)) { - switch (mbi.MemberType) { - case MemberTypes.Method: - if (!((MethodInfo)mbi).IsSpecialName) - WriteMethod ((MethodInfo)mbi); - break; - case MemberTypes.Event: - WriteSignal ((EventInfo)mbi); - break; - case MemberTypes.Property: - WriteProperty ((PropertyInfo)mbi); - break; - default: - Console.Error.WriteLine ("Warning: Unhandled MemberType '{0}' encountered while introspecting {1}", mbi.MemberType, type.FullName); - break; - } - } - */ - - foreach (MethodInfo mi in type.GetMethods (relevantBindingFlags)) - if (!mi.IsSpecialName) - WriteMethod (mi); - - foreach (EventInfo ei in type.GetEvents (relevantBindingFlags)) - WriteSignal (ei); - - foreach (PropertyInfo pri in type.GetProperties (relevantBindingFlags)) - WriteProperty (pri); - - //TODO: indexers - - //TODO: attributes as annotations? - - writer.WriteEndElement (); - - //this recursion seems somewhat inelegant - WriteInterface (type.BaseType); - } - - public void WriteAnnotation (string name, string value) - { - writer.WriteStartElement ("annotation"); - - writer.WriteAttributeString ("name", name); - writer.WriteAttributeString ("value", value); - - writer.WriteEndElement (); - } - } -} diff -urNad telepathy-sharp-0.0.svn.20060831/dbus-sharp/src/IntrospectionSchema.cs telepathy-sharp-0.0.svn.20070221/dbus-sharp/src/IntrospectionSchema.cs --- telepathy-sharp-0.0.svn.20060831/dbus-sharp/src/IntrospectionSchema.cs 2006-09-25 20:22:03.000000000 +0200 +++ telepathy-sharp-0.0.svn.20070221/dbus-sharp/src/IntrospectionSchema.cs 1970-01-01 01:00:00.000000000 +0100 @@ -1,108 +0,0 @@ -// Copyright 2006 Alp Toker -// This software is made available under the MIT License -// See COPYING for details - -using System.Xml.Serialization; -using System.Collections.Generic; - -namespace Schemas { - - [XmlRootAttribute(IsNullable=true)] - public class Member { - [XmlAttributeAttribute("name")] - public string Name; - } - - /* - public class Node { - - [XmlAttributeAttribute("name")] - public string Name; - - [XmlElementAttribute("node", Type=typeof(Node))] - [XmlElementAttribute("interface", Type=typeof(@Interface))] - public object[] Items; - } - */ - - [XmlRootAttribute("interface", IsNullable=true)] - public class @Interface { - - [XmlAttributeAttribute("name")] - public string Name; - - [XmlElementAttribute("method", Type=typeof(Method))] - [XmlElementAttribute("signal", Type=typeof(Signal))] - [XmlElementAttribute("property", Type=typeof(Property))] - [XmlElementAttribute("annotation", Type=typeof(Annotation))] - public object[] Items; - } - - [XmlRootAttribute(IsNullable=true)] - public class Method : Member { - - /* - [XmlElementAttribute("arg", Type=typeof(Argument))] - [XmlElementAttribute("annotation", Type=typeof(Annotation))] - public object[] Items; - */ - - [XmlElementAttribute("arg", Type=typeof(Argument))] - public List Arguments; - //public Argument[] Arguments; - } - - [XmlRootAttribute(IsNullable=true)] - public class Argument { - - [XmlAttributeAttribute("name")] - public string Name; - - [XmlAttributeAttribute("type")] - public string Type; - - [System.ComponentModel.DefaultValue(ArgDirection.@in)] - [XmlAttributeAttribute("direction")] - public ArgDirection Direction = ArgDirection.@in; - } - - public enum ArgDirection { - @in, - @out, - } - - [XmlRootAttribute(IsNullable=true)] - public class Annotation { - - [XmlAttributeAttribute("name")] - public string Name; - - [XmlAttributeAttribute("value")] - public string Value; - } - - [XmlRootAttribute("signal", IsNullable=true)] - public class Signal : Member { - [XmlElementAttribute("arg", Type=typeof(Argument))] - [XmlElementAttribute("annotation", Type=typeof(Annotation))] - public object[] Items; - } - - [XmlRootAttribute(IsNullable=true)] - public class Property : Member { - [XmlAttributeAttribute("type")] - public string Type; - - [XmlAttributeAttribute("access")] - public propertyAccess Access; - - [XmlElementAttribute("annotation")] - public Annotation[] Annotation; - } - - public enum propertyAccess { - read, - write, - readwrite, - } -} diff -urNad telepathy-sharp-0.0.svn.20060831/dbus-sharp/src/Makefile telepathy-sharp-0.0.svn.20070221/dbus-sharp/src/Makefile --- telepathy-sharp-0.0.svn.20060831/dbus-sharp/src/Makefile 2006-09-25 20:22:03.000000000 +0200 +++ telepathy-sharp-0.0.svn.20070221/dbus-sharp/src/Makefile 1970-01-01 01:00:00.000000000 +0100 @@ -1,15 +0,0 @@ -all: NDesk.DBus.dll - -BUS_SOURCES=Address.cs AssemblyInfo.cs Connection.cs Authentication.cs Protocol.cs Message.cs MessageFilter.cs MessageReader.cs MessageWriter.cs Server.cs Transport.cs Wrapper.cs -#UNIX_SOURCES=UnixMonoTransport.cs -UNIX_SOURCES=UnixNativeTransport.cs -CLR_SOURCES=DBus.cs Introspection.cs DProxy.cs Signature.cs - -NDesk.DBus.dll: REFS=Mono.Posix - -NDesk.DBus.dll: CSFLAGS=-d:PROTO_REPLY_SIGNATURE - -NDesk.DBus.dll: $(BUS_SOURCES) $(UNIX_SOURCES) $(CLR_SOURCES) - - -include ../include.mk diff -urNad telepathy-sharp-0.0.svn.20060831/dbus-sharp/src/Message.cs telepathy-sharp-0.0.svn.20070221/dbus-sharp/src/Message.cs --- telepathy-sharp-0.0.svn.20060831/dbus-sharp/src/Message.cs 2006-09-25 20:22:03.000000000 +0200 +++ telepathy-sharp-0.0.svn.20070221/dbus-sharp/src/Message.cs 1970-01-01 01:00:00.000000000 +0100 @@ -1,133 +0,0 @@ -// Copyright 2006 Alp Toker -// This software is made available under the MIT License -// See COPYING for details - -using System; -using System.Diagnostics; -using System.Collections.Generic; -using System.IO; - -namespace NDesk.DBus -{ - public class Message - { - public Message () - { - Header.Endianness = EndianFlag.Little; - Header.MessageType = MessageType.MethodCall; - //hdr->Flags = HeaderFlag.None; - Header.Flags = HeaderFlag.NoReplyExpected; //TODO: is this the right place to do this? - Header.MajorVersion = 1; - Header.Length = 0; - //Header.Serial = conn.GenerateSerial (); - Header.Fields = new Dictionary (); - } - - public Header Header; - public byte[] HeaderData; - - public Signature Signature - { - get { - if (Header.Fields.ContainsKey (FieldCode.Signature)) - return (Signature)Header.Fields[FieldCode.Signature]; - else - return new Signature (); - } set { - //TODO: remove from dict if value empty or null - Header.Fields[FieldCode.Signature] = value; - } - } - - //FIXME: hacked to work for the common cases since bit logic is broken - public bool ReplyExpected - { - get { - //return (Header.Flags & HeaderFlag.NoReplyExpected) != HeaderFlag.NoReplyExpected; - return (Header.Flags != HeaderFlag.NoReplyExpected); - } set { - if (value) - //Header.Flags &= ~HeaderFlag.NoReplyExpected; //flag off - Header.Flags = HeaderFlag.None; //flag off - else - //Header.Flags |= ~HeaderFlag.NoReplyExpected; //flag on - Header.Flags = HeaderFlag.NoReplyExpected; //flag on - } - } - - //public HeaderField[] HeaderFields; - //public Dictionary; - - public byte[] Body; - - //TODO: make use of Locked - protected bool locked = false; - public bool Locked - { - get { - return locked; - } - } - - public void ParseHeader () - { - //GetValue (stream, typeof (Header), out Header); - - EndianFlag endianness = (EndianFlag)HeaderData[0]; - MessageReader reader = new MessageReader (endianness, HeaderData); - - ValueType valT; - reader.GetValue (typeof (Header), out valT); - Header = (Header)valT; - - /* - //foreach (HeaderField field in HeaderFields) - foreach (KeyValuePair field in Header.Fields) - { - //Console.WriteLine (field.Key + " = " + field.Value); - switch (field.Key) - { - case FieldCode.Invalid: - break; - case FieldCode.Path: - Path = (ObjectPath)field.Value; - break; - case FieldCode.Interface: - Interface = (string)field.Value; - break; - case FieldCode.Member: - Member = (string)field.Value; - break; - case FieldCode.ErrorName: - ErrorName = (string)field.Value; - break; - case FieldCode.ReplySerial: - ReplySerial = (uint)field.Value; - break; - case FieldCode.Destination: - Destination = (string)field.Value; - break; - case FieldCode.Sender: - Sender = (string)field.Value; - break; - case FieldCode.Signature: - Signature = (Signature)field.Value; - break; - } - } - */ - } - - public void WriteHeader () - { - if (Body != null) - Header.Length = (uint)Body.Length; - - MessageWriter writer = new MessageWriter (EndianFlag.Little); - writer.Write (typeof (Header), Header); - //writer.WriteFromDict (typeof (FieldCode), typeof (object), Header.Fields); - writer.CloseWrite (); - HeaderData = writer.ToArray (); - } - } -} diff -urNad telepathy-sharp-0.0.svn.20060831/dbus-sharp/src/MessageFilter.cs telepathy-sharp-0.0.svn.20070221/dbus-sharp/src/MessageFilter.cs --- telepathy-sharp-0.0.svn.20060831/dbus-sharp/src/MessageFilter.cs 2006-09-25 20:22:03.000000000 +0200 +++ telepathy-sharp-0.0.svn.20070221/dbus-sharp/src/MessageFilter.cs 1970-01-01 01:00:00.000000000 +0100 @@ -1,50 +0,0 @@ -// Copyright 2006 Alp Toker -// This software is made available under the MIT License -// See COPYING for details - -using System; - -namespace NDesk.DBus -{ - public class MessageFilter - { - //this should probably be made to use HeaderField or similar - //this class is not generalized yet - - public static string MessageTypeToString (MessageType mtype) - { - switch (mtype) - { - case MessageType.MethodCall: - return "method_call"; - case MessageType.MethodReturn: - return "method_return"; - case MessageType.Error: - return "error"; - case MessageType.Signal: - return "signal"; - case MessageType.Invalid: - return "invalid"; - default: - throw new Exception ("Bad MessageType: " + mtype); - } - } - - public static string CreateMatchRule (MessageType mtype) - { - return "type='" + MessageTypeToString (mtype) + "'"; - } - - public static string CreateMatchRule (MessageType type, ObjectPath path, string @interface, string member) - { - return "type='" + MessageTypeToString (type) + "',path='" + path.Value + "',interface='" + @interface + "',member='" + member + "'"; - } - - //TODO - //this is useful as a Predicate delegate - public bool Match (Message message) - { - return false; - } - } -} diff -urNad telepathy-sharp-0.0.svn.20060831/dbus-sharp/src/MessageReader.cs telepathy-sharp-0.0.svn.20070221/dbus-sharp/src/MessageReader.cs --- telepathy-sharp-0.0.svn.20060831/dbus-sharp/src/MessageReader.cs 2006-09-25 20:22:03.000000000 +0200 +++ telepathy-sharp-0.0.svn.20070221/dbus-sharp/src/MessageReader.cs 1970-01-01 01:00:00.000000000 +0100 @@ -1,582 +0,0 @@ -// Copyright 2006 Alp Toker -// This software is made available under the MIT License -// See COPYING for details - -//defined by default, since this is not a controversial extension -#define PROTO_TYPE_SINGLE - -using System; -using System.Text; -using System.Diagnostics; -using System.Collections.Generic; -using System.IO; - -namespace NDesk.DBus -{ - public class MessageReader - { - //FIXME: use endianness instead of failing on non-native endianness - protected EndianFlag endianness; - protected byte[] data; - //TODO: this should be uint or long to handle long messages - protected int pos = 0; - - public MessageReader (EndianFlag endianness, byte[] data) - { - if (endianness != Connection.NativeEndianness) - throw new NotImplementedException ("Only native-endian message reading is currently supported"); - - if (data == null) - throw new ArgumentNullException ("data"); - - this.endianness = endianness; - this.data = data; - } - - public MessageReader (Message message) : this (message.Header.Endianness, message.Body) - { - if (message == null) - throw new ArgumentNullException ("message"); - } - - public void CloseRead () - { - ReadPad (8); - //this needs more thought - } - - public void GetValue (Type type, out object val) - { - if (type.IsArray) { - Array valArr; - GetValue (type, out valArr); - val = valArr; - } else if (type.IsGenericType && type.GetGenericTypeDefinition () == typeof (IDictionary<,>)) { - Type[] genArgs = type.GetGenericArguments (); - Type dictType = typeof (Dictionary<,>).MakeGenericType (genArgs); - val = Activator.CreateInstance(dictType, new object[0]); - System.Collections.IDictionary idict = (System.Collections.IDictionary)val; - GetValueToDict (genArgs[0], genArgs[1], idict); - /* - } else if (type == typeof (ObjectPath)) { - //FIXME: find a better way of specifying structs that must be marshaled by value and not as a struct like ObjectPath - //this is just a quick proof of concept fix - //TODO: are there others we should special case in this hack? - //TODO: this code has analogues elsewhere that need both this quick fix, and the real fix when it becomes available - DType dtype = Signature.TypeToDType (type); - GetValue (dtype, out val); - */ - } else if (!type.IsPrimitive && type.IsValueType && !type.IsEnum) { - ValueType valV; - GetValue (type, out valV); - val = valV; - } else { - DType dtype = Signature.TypeToDType (type); - GetValue (dtype, out val); - } - - if (type.IsEnum) - val = Enum.ToObject (type, val); - } - - //helper method, should not be used generally - public void GetValue (DType dtype, out object val) - { - switch (dtype) - { - case DType.Byte: - { - byte vval; - GetValue (out vval); - val = vval; - } - break; - case DType.Boolean: - { - bool vval; - GetValue (out vval); - val = vval; - } - break; - case DType.Int16: - { - short vval; - GetValue (out vval); - val = vval; - } - break; - case DType.UInt16: - { - ushort vval; - GetValue (out vval); - val = vval; - } - break; - case DType.Int32: - { - int vval; - GetValue (out vval); - val = vval; - } - break; - case DType.UInt32: - { - uint vval; - GetValue (out vval); - val = vval; - } - break; - case DType.Int64: - { - long vval; - GetValue (out vval); - val = vval; - } - break; - case DType.UInt64: - { - ulong vval; - GetValue (out vval); - val = vval; - } - break; -#if PROTO_TYPE_SINGLE - case DType.Single: - { - float vval; - GetValue (out vval); - val = vval; - } - break; -#endif - case DType.Double: - { - double vval; - GetValue (out vval); - val = vval; - } - break; - case DType.String: - { - string vval; - GetValue (out vval); - val = vval; - } - break; - case DType.ObjectPath: - { - ObjectPath vval; - GetValue (out vval); - val = vval; - } - break; - case DType.Signature: - { - Signature vval; - GetValue (out vval); - val = vval; - } - break; - case DType.Variant: - { - object vval; - GetValue (out vval); - val = vval; - } - break; - default: - val = null; - throw new Exception ("Unhandled D-Bus type: " + dtype); - } - } - - /* - public void GetValue (out byte val) - { - BinaryReader br = new BinaryReader (stream); - - ReadPad (1); - val = br.ReadByte (); - } - - public void GetValue (out bool val) - { - uint intval; - GetValue (out intval); - - //TODO: confirm semantics of dbus boolean - val = intval == 0 ? false : true; - } - - public void GetValue (out short val) - { - BinaryReader br = new BinaryReader (stream); - - ReadPad (2); - val = br.ReadInt16 (); - } - - public void GetValue (out ushort val) - { - BinaryReader br = new BinaryReader (stream); - - ReadPad (2); - val = br.ReadUInt16 (); - } - - public void GetValue (out int val) - { - BinaryReader br = new BinaryReader (stream); - - ReadPad (4); - val = br.ReadInt32 (); - } - - public void GetValue (out uint val) - { - BinaryReader br = new BinaryReader (stream); - - ReadPad (4); - val = br.ReadUInt32 (); - } - - public void GetValue (out long val) - { - BinaryReader br = new BinaryReader (stream); - - ReadPad (8); - val = br.ReadInt64 (); - } - - public void GetValue (out ulong val) - { - BinaryReader br = new BinaryReader (stream); - - ReadPad (8); - val = br.ReadUInt64 (); - } - -#if PROTO_TYPE_SINGLE - public void GetValue (out float val) - { - BinaryReader br = new BinaryReader (stream); - - ReadPad (4); - val = br.ReadSingle (); - } -#endif - - public void GetValue (out double val) - { - BinaryReader br = new BinaryReader (stream); - - ReadPad (8); - val = br.ReadDouble (); - } - - public void GetValue (out string val) - { - BinaryReader br = new BinaryReader (stream); - - uint ln; - GetValue (out ln); - - byte[] rbytes = br.ReadBytes ((int)ln); - val = Encoding.UTF8.GetString (rbytes); - br.ReadByte (); //null string terminator - } - - public void GetValue (out ObjectPath val) - { - //exactly the same as string - GetValue (out val.Value); - } - - public void GetValue (out Signature val) - { - BinaryReader br = new BinaryReader (stream); - - //ReadPad (1); //alignment for signature is 1 - byte ln; - GetValue (out ln); - - val.Data = br.ReadBytes ((int)ln); - br.ReadByte (); //null signature terminator - } - */ - - //alternative GetValue() implementations - //needed for reading messages in machine-native format, until we do this properly - //TODO: don't ignore the endian flag in the header - - public void GetValue (out byte val) - { - val = data[pos++]; - } - - public void GetValue (out bool val) - { - uint intval; - GetValue (out intval); - - //TODO: confirm semantics of dbus boolean - val = intval == 0 ? false : true; - } - - public void GetValue (out short val) - { - ReadPad (2); - val = BitConverter.ToInt16 (data, pos); - pos += 2; - } - - public void GetValue (out ushort val) - { - ReadPad (2); - val = BitConverter.ToUInt16 (data, pos); - pos += 2; - } - - public void GetValue (out int val) - { - ReadPad (4); - val = BitConverter.ToInt32 (data, pos); - pos += 4; - } - - public void GetValue (out uint val) - { - ReadPad (4); - val = BitConverter.ToUInt32 (data, pos); - pos += 4; - } - - public void GetValue (out long val) - { - ReadPad (8); - val = BitConverter.ToInt64 (data, pos); - pos += 8; - } - - public void GetValue (out ulong val) - { - ReadPad (8); - val = BitConverter.ToUInt64 (data, pos); - pos += 8; - } - -#if PROTO_TYPE_SINGLE - public void GetValue (out float val) - { - ReadPad (4); - val = BitConverter.ToSingle (data, pos); - pos += 4; - } -#endif - - public void GetValue (out double val) - { - ReadPad (8); - val = BitConverter.ToDouble (data, pos); - pos += 8; - } - - public void GetValue (out string val) - { - uint ln; - GetValue (out ln); - - val = Encoding.UTF8.GetString (data, pos, (int)ln); - pos += (int)ln + 1; //+1 is null string terminator - } - - public void GetValue (out ObjectPath val) - { - //exactly the same as string - GetValue (out val.Value); - } - - public void GetValue (out Signature val) - { - byte ln; - GetValue (out ln); - - val.Data = new byte[ln]; - Array.Copy (data, pos, val.Data, 0, (int)ln); - pos += (int)ln + 1; //+1 is null signature terminator - } - - //variant - public void GetValue (out object val) - { - Signature sig; - GetValue (out sig); - - if (sig == Signature.Empty) { - val = null; - return; - } - - //TODO: more flexibilty needed here - if (sig.Data.Length > 1) { - throw new NotSupportedException ("Reading variants with more than one primitive value is not supported"); - } - - DType t = (DType)sig.Data[0]; - GetValue (t, out val); - } - - //not pretty or efficient but works - public void GetValueToDict (Type keyType, Type valType, System.Collections.IDictionary val) - { - uint ln; - GetValue (out ln); - - //advance to the alignment of the element - //ReadPad (Padding.GetAlignment (Signature.TypeToDType (type))); - ReadPad (8); - - int endPos = pos + (int)ln; - - //while (stream.Position != endPos) - while (pos < endPos) - { - ReadPad (8); - - object keyVal; - GetValue (keyType, out keyVal); - - object valVal; - GetValue (valType, out valVal); - - val.Add (keyVal, valVal); - } - - if (pos != endPos) - throw new Exception ("Read pos " + pos + " != ep " + endPos); - } - - //this could be made generic to avoid boxing - //restricted to primitive elements because of the DType bottleneck - public void GetValue (Type type, out Array val) - { - if (type.IsArray) - type = type.GetElementType (); - - uint ln; - GetValue (out ln); - - //advance to the alignment of the element - ReadPad (Padding.GetAlignment (Signature.TypeToDType (type))); - - int endPos = pos + (int)ln; - - //List vals = new List (); - System.Collections.ArrayList vals = new System.Collections.ArrayList (); - - //while (stream.Position != endPos) - while (pos < endPos) - { - object elem; - //GetValue (Signature.TypeToDType (type), out elem); - GetValue (type, out elem); - vals.Add (elem); - } - - if (pos != endPos) - throw new Exception ("Read pos " + pos + " != ep " + endPos); - - val = vals.ToArray (type); - //val = Array.CreateInstance (type.UnderlyingSystemType, vals.Count); - } - - //struct - //probably the wrong place for this - //there might be more elegant solutions - public void GetValue (Type type, out ValueType val) - { - System.Reflection.ConstructorInfo[] cis = type.GetConstructors (); - if (cis.Length != 0) { - System.Reflection.ConstructorInfo ci = cis[0]; - //Console.WriteLine ("ci: " + ci); - System.Reflection.ParameterInfo[] parms = ci.GetParameters (); - - /* - Type[] sig = new Type[parms.Length]; - for (int i = 0 ; i != parms.Length ; i++) - sig[i] = parms[i].ParameterType; - object retObj = ci.Invoke (null, GetDynamicValues (msg, sig)); - */ - - //TODO: use GetDynamicValues() when it's refactored to be applicable - /* - object[] vals; - vals = GetDynamicValues (msg, parms); - */ - - List vals = new List (parms.Length); - foreach (System.Reflection.ParameterInfo parm in parms) { - object arg; - GetValue (parm.ParameterType, out arg); - vals.Add (arg); - } - - //object retObj = ci.Invoke (val, vals.ToArray ()); - val = (ValueType)Activator.CreateInstance (type, vals.ToArray ()); - return; - } - - //no suitable ctor, marshal as a struct - ReadPad (8); - - val = (ValueType)Activator.CreateInstance (type); - - /* - if (type.IsGenericType && type.GetGenericTypeDefinition () == typeof (KeyValuePair<,>)) { - object elem; - - System.Reflection.PropertyInfo key_prop = type.GetProperty ("Key"); - GetValue (key_prop.PropertyType, out elem); - key_prop.SetValue (val, elem, null); - - System.Reflection.PropertyInfo val_prop = type.GetProperty ("Value"); - GetValue (val_prop.PropertyType, out elem); - val_prop.SetValue (val, elem, null); - - return; - } - */ - - System.Reflection.FieldInfo[] fis = type.GetFields (); - - foreach (System.Reflection.FieldInfo fi in fis) { - object elem; - //GetValue (Signature.TypeToDType (fi.FieldType), out elem); - GetValue (fi.FieldType, out elem); - //public virtual void SetValueDirect (TypedReference obj, object value); - fi.SetValue (val, elem); - } - } - - public void ReadNull () - { - if (data[pos++] != 0) - throw new Exception ("Read non-zero null terminator"); - } - - /* - public void ReadPad (int alignment) - { - pos = Padding.Padded (pos, alignment); - } - */ - - public void ReadPad (int alignment) - { - //make sure the pos-1 is right for the exception message when we have a test suite - while (pos != Padding.Padded (pos, alignment)) - if (data[pos++] != 0) - throw new Exception ("Read non-zero padding byte at pos " + (pos-1) + ", pad value was " + data[pos-1]); - } - } -} diff -urNad telepathy-sharp-0.0.svn.20060831/dbus-sharp/src/MessageWriter.cs telepathy-sharp-0.0.svn.20070221/dbus-sharp/src/MessageWriter.cs --- telepathy-sharp-0.0.svn.20060831/dbus-sharp/src/MessageWriter.cs 2006-09-25 20:22:03.000000000 +0200 +++ telepathy-sharp-0.0.svn.20070221/dbus-sharp/src/MessageWriter.cs 1970-01-01 01:00:00.000000000 +0100 @@ -1,340 +0,0 @@ -// Copyright 2006 Alp Toker -// This software is made available under the MIT License -// See COPYING for details - -//defined by default, since this is not a controversial extension -#define PROTO_TYPE_SINGLE - -using System; -using System.Text; -using System.Diagnostics; -using System.Collections.Generic; -using System.IO; - -namespace NDesk.DBus -{ - public class MessageWriter - { - //TODO: use endianness instead of writing the message is in native format - protected EndianFlag endianness; - protected MemoryStream stream; - protected BinaryWriter bw; - - public MessageWriter (EndianFlag endianness) - { - if (endianness != EndianFlag.Little) - throw new NotImplementedException ("Only little-endian message writing is currently supported"); - - this.endianness = endianness; - stream = new MemoryStream (); - bw = new BinaryWriter (stream); - } - - public byte[] ToArray () - { - //TODO: mark the writer locked or something here - return stream.ToArray (); - } - - public void CloseWrite () - { - int needed = Padding.PadNeeded ((int)stream.Position, 8); - for (int i = 0 ; i != needed ; i++) - stream.WriteByte (0); - } - - public void Write (byte val) - { - WritePad (1); - bw.Write (val); - } - - public void Write (bool val) - { - WritePad (4); - bw.Write ((uint) (val ? 1 : 0)); - } - - public void Write (short val) - { - WritePad (2); - bw.Write (val); - } - - public void Write (ushort val) - { - WritePad (2); - bw.Write (val); - } - - public void Write (int val) - { - WritePad (4); - bw.Write (val); - } - - public void Write (uint val) - { - - WritePad (4); - bw.Write (val); - } - - public void Write (long val) - { - WritePad (8); - bw.Write (val); - } - - public void Write (ulong val) - { - WritePad (8); - bw.Write (val); - } - -#if PROTO_TYPE_SINGLE - public void Write (float val) - { - WritePad (4); - bw.Write (val); - } -#endif - - public void Write (double val) - { - WritePad (8); - bw.Write (val); - } - - public void Write (string val) - { - byte[] utf8_data = Encoding.UTF8.GetBytes (val); - Write ((uint)utf8_data.Length); - bw.Write (utf8_data); - bw.Write ((byte)0); //NULL string terminator - } - - public void Write (ObjectPath val) - { - Write (val.Value); - } - - public void Write (Signature val) - { - WritePad (1); - Write ((byte)val.Value.Length); - bw.Write (val.Data); - bw.Write ((byte)0); //NULL signature terminator - } - - public void Write (Type type, object val) - { - if (type.IsArray) { - Write (type, (Array)val); - } else if (type.IsGenericType && (type.GetGenericTypeDefinition () == typeof (IDictionary<,>) || type.GetGenericTypeDefinition () == typeof (Dictionary<,>))) { - Type[] genArgs = type.GetGenericArguments (); - System.Collections.IDictionary idict = (System.Collections.IDictionary)val; - WriteFromDict (genArgs[0], genArgs[1], idict); - } else if (!type.IsPrimitive && type.IsValueType && !type.IsEnum) { - Write (type, (ValueType)val); - /* - } else if (type.IsGenericType && type.GetGenericTypeDefinition () == typeof (Nullable<>)) { - //is it possible to support nullable types? - Type[] genArgs = type.GetGenericArguments (); - WriteVariant (genArgs[0], val); - */ - } else { - Write (Signature.TypeToDType (type), val); - } - } - - //helper method, should not be used as it boxes needlessly - public void Write (DType dtype, object val) - { - switch (dtype) - { - case DType.Byte: - { - Write ((byte)val); - } - break; - case DType.Boolean: - { - Write ((bool)val); - } - break; - case DType.Int16: - { - Write ((short)val); - } - break; - case DType.UInt16: - { - Write ((ushort)val); - } - break; - case DType.Int32: - { - Write ((int)val); - } - break; - case DType.UInt32: - { - Write ((uint)val); - } - break; - case DType.Int64: - { - Write ((long)val); - } - break; - case DType.UInt64: - { - Write ((ulong)val); - } - break; -#if PROTO_TYPE_SINGLE - case DType.Single: - { - Write ((float)val); - } - break; -#endif - case DType.Double: - { - Write ((double)val); - } - break; - case DType.String: - { - Write ((string)val); - } - break; - case DType.ObjectPath: - { - Write ((ObjectPath)val); - } - break; - case DType.Signature: - { - Write ((Signature)val); - } - break; - case DType.Variant: - { - Write ((object)val); - } - break; - default: - throw new Exception ("Unhandled D-Bus type: " + dtype); - } - } - - //variant - public void Write (object val) - { - if (val == null) - throw new NotSupportedException ("Cannot send null variant"); - - Type type = val.GetType (); - DType t = Signature.TypeToDType (type); - - Signature sig = new Signature (t); - Write (sig); - - Write (t, val); - } - - //this requires a seekable stream for now - public void Write (Type type, Array val) - { - //if (type.IsArray) - type = type.GetElementType (); - - Write ((uint)0); - long lengthPos = stream.Position - 4; - - //advance to the alignment of the element - WritePad (Padding.GetAlignment (Signature.TypeToDType (type))); - - long startPos = stream.Position; - - foreach (object elem in val) - Write (type, elem); - - long endPos = stream.Position; - - stream.Position = lengthPos; - Write ((uint)(endPos - startPos)); - - stream.Position = endPos; - } - - public void WriteFromDict (Type keyType, Type valType, System.Collections.IDictionary val) - { - Write ((uint)0); - long lengthPos = stream.Position - 4; - - //advance to the alignment of the element - //WritePad (Padding.GetAlignment (Signature.TypeToDType (type))); - WritePad (8); - - long startPos = stream.Position; - - foreach (System.Collections.DictionaryEntry entry in val) - { - WritePad (8); - - Write (keyType, entry.Key); - Write (valType, entry.Value); - } - - long endPos = stream.Position; - - stream.Position = lengthPos; - Write ((uint)(endPos - startPos)); - - stream.Position = endPos; - } - - public void Write (Type type, ValueType val) - { - WritePad (8); //offset for structs, right? - - /* - ConstructorInfo[] cis = type.GetConstructors (); - if (cis.Length != 0) { - System.Reflection.ParameterInfo[] parms = ci.GetParameters (); - - foreach (ParameterInfo parm in parms) { - } - } - */ - if (type.IsGenericType && type.GetGenericTypeDefinition () == typeof (KeyValuePair<,>)) { - System.Reflection.PropertyInfo key_prop = type.GetProperty ("Key"); - Write (key_prop.PropertyType, key_prop.GetValue (val, null)); - - System.Reflection.PropertyInfo val_prop = type.GetProperty ("Value"); - Write (val_prop.PropertyType, val_prop.GetValue (val, null)); - - return; - } - - System.Reflection.FieldInfo[] fis = type.GetFields (); - - foreach (System.Reflection.FieldInfo fi in fis) { - object elem; - //public virtual object GetValueDirect (TypedReference obj); - elem = fi.GetValue (val); - //Write (Signature.TypeToDType (fi.FieldType), elem); - Write (fi.FieldType, elem); - } - } - - //RNGCryptoServiceProvider rng = new RNGCryptoServiceProvider (); - public void WritePad (int alignment) - { - stream.Position = Padding.Padded ((int)stream.Position, alignment); - } - } -} diff -urNad telepathy-sharp-0.0.svn.20060831/dbus-sharp/src/Protocol.cs telepathy-sharp-0.0.svn.20070221/dbus-sharp/src/Protocol.cs --- telepathy-sharp-0.0.svn.20060831/dbus-sharp/src/Protocol.cs 2006-09-25 20:22:03.000000000 +0200 +++ telepathy-sharp-0.0.svn.20070221/dbus-sharp/src/Protocol.cs 1970-01-01 01:00:00.000000000 +0100 @@ -1,249 +0,0 @@ -// Copyright 2006 Alp Toker -// This software is made available under the MIT License -// See COPYING for details - -//defined by default, since this is not a controversial extension -#define PROTO_TYPE_SINGLE - -using System; -using System.Collections.Generic; - -namespace NDesk.DBus -{ - //yyyyuua{yv} - public struct Header - { - public EndianFlag Endianness; - public MessageType MessageType; - public HeaderFlag Flags; - public byte MajorVersion; - public uint Length; - public uint Serial; - //public HeaderField[] Fields; - public IDictionary Fields; - - /* - public static DType TypeForField (FieldCode f) - { - switch (f) { - case FieldCode.Invalid: - return DType.Invalid; - case FieldCode.Path: - return DType.ObjectPath; - case FieldCode.Interface: - return DType.String; - case FieldCode.Member: - return DType.String; - case FieldCode.ErrorName: - return DType.String; - case FieldCode.ReplySerial: - return DType.UInt32; - case FieldCode.Destination: - return DType.String; - case FieldCode.Sender: - return DType.String; - case FieldCode.Signature: - return DType.Signature; -#if PROTO_REPLY_SIGNATURE - case FieldCode.ReplySignature: //note: not supported in dbus - return DType.Signature; -#endif - default: - return DType.Invalid; - } - } - */ - } - - /* - public struct HeaderField - { - //public HeaderField (FieldCode code, object value) - //{ - // this.Code = code; - // this.Value = value; - //} - - public static HeaderField Create (FieldCode code, object value) - { - HeaderField hf; - - hf.Code = code; - hf.Value = value; - - return hf; - } - - public FieldCode Code; - public object Value; - } - */ - - public enum MessageType : byte - { - //This is an invalid type. - Invalid, - //Method call. - MethodCall, - //Method reply with returned data. - MethodReturn, - //Error reply. If the first argument exists and is a string, it is an error message. - Error, - //Signal emission. - Signal, - } - - public enum FieldCode : byte - { - Invalid, - Path, - Interface, - Member, - ErrorName, - ReplySerial, - Destination, - Sender, - Signature, -#if PROTO_REPLY_SIGNATURE - ReplySignature, //note: not supported in dbus -#endif - } - - public enum EndianFlag : byte - { - Little = (byte)'l', - Big = (byte)'B', - } - - [Flags] - public enum HeaderFlag : byte - { - None = 0, - NoReplyExpected = 0x1, - NoAutoStart = 0x2, - } - - public struct ObjectPath - { - public static readonly ObjectPath Root = new ObjectPath ("/"); - - public string Value; - - public ObjectPath (string value) - { - this.Value = value; - } - - public override string ToString () - { - return Value; - } - - //this may or may not prove useful - public string[] Decomposed - { - get { - return Value.Split ('/'); - } set { - Value = String.Join ("/", value); - } - } - } - - public static class Padding - { - public static int PadNeeded (int pos, int alignment) - { - int pad = pos % alignment; - pad = pad == 0 ? 0 : alignment - pad; - - return pad; - } - - public static int Padded (int pos, int alignment) - { - int pad = pos % alignment; - if (pad != 0) - pos += alignment - pad; - - return pos; - } - - public static int GetAlignment (DType dtype) - { - switch (dtype) { - case DType.Byte: - return 1; - case DType.Boolean: - return 4; - case DType.Int16: - case DType.UInt16: - return 2; - case DType.Int32: - case DType.UInt32: - return 4; - case DType.Int64: - case DType.UInt64: - return 8; -#if PROTO_TYPE_SINGLE - case DType.Single: //Not yet supported! - return 4; -#endif - case DType.Double: - return 8; - case DType.String: - return 4; - case DType.ObjectPath: - return 4; - case DType.Signature: - return 1; - case DType.Array: - return 4; - case DType.Struct: - return 8; - case DType.Variant: - return 1; - case DType.DictEntry: - return 8; - case DType.Invalid: - default: - throw new Exception ("Cannot determine alignment of " + dtype); - } - } - } - -#if UNDOCUMENTED_IN_SPEC -/* -"org.freedesktop.DBus.Error.Failed" -"org.freedesktop.DBus.Error.NoMemory" -"org.freedesktop.DBus.Error.ServiceUnknown" -"org.freedesktop.DBus.Error.NameHasNoOwner" -"org.freedesktop.DBus.Error.NoReply" -"org.freedesktop.DBus.Error.IOError" -"org.freedesktop.DBus.Error.BadAddress" -"org.freedesktop.DBus.Error.NotSupported" -"org.freedesktop.DBus.Error.LimitsExceeded" -"org.freedesktop.DBus.Error.AccessDenied" -"org.freedesktop.DBus.Error.AuthFailed" -"org.freedesktop.DBus.Error.NoServer" -"org.freedesktop.DBus.Error.Timeout" -"org.freedesktop.DBus.Error.NoNetwork" -"org.freedesktop.DBus.Error.AddressInUse" -"org.freedesktop.DBus.Error.Disconnected" -"org.freedesktop.DBus.Error.InvalidArgs" -"org.freedesktop.DBus.Error.FileNotFound" -"org.freedesktop.DBus.Error.UnknownMethod" -"org.freedesktop.DBus.Error.TimedOut" -"org.freedesktop.DBus.Error.MatchRuleNotFound" -"org.freedesktop.DBus.Error.MatchRuleInvalid" -"org.freedesktop.DBus.Error.Spawn.ExecFailed" -"org.freedesktop.DBus.Error.Spawn.ForkFailed" -"org.freedesktop.DBus.Error.Spawn.ChildExited" -"org.freedesktop.DBus.Error.Spawn.ChildSignaled" -"org.freedesktop.DBus.Error.Spawn.Failed" -"org.freedesktop.DBus.Error.UnixProcessIdUnknown" -"org.freedesktop.DBus.Error.InvalidSignature" -"org.freedesktop.DBus.Error.SELinuxSecurityContextUnknown" -*/ -#endif -} diff -urNad telepathy-sharp-0.0.svn.20060831/dbus-sharp/src/Server.cs telepathy-sharp-0.0.svn.20070221/dbus-sharp/src/Server.cs --- telepathy-sharp-0.0.svn.20060831/dbus-sharp/src/Server.cs 2006-09-25 20:22:03.000000000 +0200 +++ telepathy-sharp-0.0.svn.20070221/dbus-sharp/src/Server.cs 1970-01-01 01:00:00.000000000 +0100 @@ -1,41 +0,0 @@ -// Copyright 2006 Alp Toker -// This software is made available under the MIT License -// See COPYING for details - -using System; -using System.IO; -using System.Net; -using System.Net.Sockets; - -namespace NDesk.DBus -{ - //TODO: complete this class - public class Server - { - public void Listen (string address) - { - this.address = address; - } - - public void Disconnect () - { - } - - public bool IsConnected - { - get { - return true; - } - } - - protected string address; - public string Address - { - get { - return address; - } - } - - //TODO: new connection event/virtual method - } -} diff -urNad telepathy-sharp-0.0.svn.20060831/dbus-sharp/src/Signature.cs telepathy-sharp-0.0.svn.20070221/dbus-sharp/src/Signature.cs --- telepathy-sharp-0.0.svn.20060831/dbus-sharp/src/Signature.cs 2006-09-25 20:22:03.000000000 +0200 +++ telepathy-sharp-0.0.svn.20070221/dbus-sharp/src/Signature.cs 1970-01-01 01:00:00.000000000 +0100 @@ -1,432 +0,0 @@ -// Copyright 2006 Alp Toker -// This software is made available under the MIT License -// See COPYING for details - -using System; -using System.Text; -using System.IO; - -using System.Collections.Generic; -//TODO: Reflection should be done at a higher level than this class -using System.Reflection; - -namespace NDesk.DBus -{ - //maybe this should be nullable? - public struct Signature - { - //TODO: this class needs some work - //Data should probably include the null terminator - - public static readonly Signature Empty = new Signature (); - - public static bool operator == (Signature a, Signature b) - { - if (a.Data == null && b.Data == null) - return true; - - if (a.Data == null || b.Data == null) - return false; - - if (a.Data.Length != b.Data.Length) - return false; - - for (int i = 0 ; i != a.Data.Length ; i++) - if (a.Data[i] != b.Data[i]) - return false; - - return true; - } - - public static bool operator != (Signature a, Signature b) - { - return !(a == b); - } - - public override bool Equals (object o) - { - if (o == null) - return false; - - if (!(o is Signature)) - return false; - - return this == (Signature)o; - } - - public override int GetHashCode () - { - return Data.GetHashCode (); - } - - public Signature (string value) - { - this.Data = Encoding.ASCII.GetBytes (value); - } - - public Signature (params DType[] value) - { - this.Data = new byte[value.Length]; - - MemoryStream ms = new MemoryStream (this.Data); - - foreach (DType t in value) - ms.WriteByte ((byte)t); - } - - public byte[] Data; - - public string Value - { - get { - return Encoding.ASCII.GetString (Data); - } set { - Data = Encoding.ASCII.GetBytes (value); - } - } - - public override string ToString () - { - StringBuilder sb = new StringBuilder (); - - foreach (byte t in Data) { - //we shouldn't rely on object mapping here, but it's an easy way to get string representations for now - Type type = DTypeToType ((DType)t); - if (type != null) - sb.Append (type.Name); - else - sb.Append ((char)t); - sb.Append (" "); - } - - return sb.ToString (); - } - - public static DType TypeCodeToDType (TypeCode typeCode) - { - switch (typeCode) - { - case TypeCode.Empty: - return DType.Invalid; - case TypeCode.Object: - return DType.Invalid; - case TypeCode.DBNull: - return DType.Invalid; - case TypeCode.Boolean: - return DType.Boolean; - case TypeCode.Char: - return DType.UInt16; - case TypeCode.SByte: - return DType.Byte; - case TypeCode.Byte: - return DType.Byte; - case TypeCode.Int16: - return DType.Int16; - case TypeCode.UInt16: - return DType.UInt16; - case TypeCode.Int32: - return DType.Int32; - case TypeCode.UInt32: - return DType.UInt32; - case TypeCode.Int64: - return DType.Int64; - case TypeCode.UInt64: - return DType.UInt64; - case TypeCode.Single: - return DType.Single; - case TypeCode.Double: - return DType.Double; - case TypeCode.Decimal: - return DType.Invalid; - case TypeCode.DateTime: - return DType.Invalid; - case TypeCode.String: - return DType.String; - default: - return DType.Invalid; - } - } - - public static DType TypeToDType (Type type) - { - //Console.WriteLine (type); - //Console.WriteLine (Type.GetTypeCode (type)); - if (type.IsPrimitive) - return TypeCodeToDType (Type.GetTypeCode (type)); - - if (type.IsEnum) - return TypeToDType (type.GetElementType ()); - - //needs work - if (type.IsArray) - return DType.Array; - - if (type == typeof (string)) - return DType.String; - - if (type == typeof (ObjectPath)) - return DType.ObjectPath; - - if (type == typeof (Signature)) - return DType.Signature; - - if (type == typeof (object)) - return DType.Variant; - - if (!type.IsPrimitive && type.IsValueType && !type.IsEnum) - return DType.Struct; - - //if (type.UnderlyingSystemType != null) - // return TypeToDType (type.UnderlyingSystemType); - - return DType.Invalid; - } - - /* - public static DType TypeToDType (Type type) - { - if (type == null) - return DType.Invalid; - else if (type == typeof (byte)) - return DType.Byte; - else if (type == typeof (bool)) - return DType.Boolean; - else if (type == typeof (short)) - return DType.Int16; - else if (type == typeof (ushort)) - return DType.UInt16; - else if (type == typeof (int)) - return DType.Int32; - else if (type == typeof (uint)) - return DType.UInt32; - else if (type == typeof (long)) - return DType.Int64; - else if (type == typeof (ulong)) - return DType.UInt64; - else if (type == typeof (float)) //FIXME: this isn't supported by DBus yet - return DType.Single; - else if (type == typeof (double)) - return DType.Double; - else if (type == typeof (string)) - return DType.String; - else if (type == typeof (ObjectPath)) - return DType.ObjectPath; - else if (type == typeof (Signature)) - return DType.Signature; - else - return DType.Invalid; - } - */ - - public static Type DTypeToType (DType dtype) - { - switch (dtype) { - case DType.Invalid: - return null; - case DType.Byte: - return typeof (byte); - case DType.Boolean: - return typeof (bool); - case DType.Int16: - return typeof (short); - case DType.UInt16: - return typeof (ushort); - case DType.Int32: - return typeof (int); - case DType.UInt32: - return typeof (uint); - case DType.Int64: - return typeof (long); - case DType.UInt64: - return typeof (ulong); - case DType.Single: //Not yet supported! - return typeof (float); - case DType.Double: - return typeof (double); - case DType.String: - return typeof (string); - case DType.ObjectPath: - return typeof (ObjectPath); - case DType.Signature: - return typeof (Signature); - case DType.Array: - return typeof (Array); - case DType.Struct: - return typeof (ValueType); - case DType.DictEntry: - return typeof (System.Collections.Generic.KeyValuePair<,>); - case DType.Variant: - return typeof (object); - default: - return null; - } - } - - public static Signature GetSig (ArgDirection dir, ParameterInfo[] parms) - { - List types = new List (); - - //TODO: consider InOut/Ref - - for (int i = 0 ; i != parms.Length ; i++) { - switch (dir) { - case ArgDirection.In: - if (parms[i].IsIn) - types.Add (parms[i].ParameterType); - break; - case ArgDirection.Out: - if (parms[i].IsOut) { - //TODO: note that IsOut is optional to the compiler, we may want to use IsByRef instead - //eg: if (parms[i].ParameterType.IsByRef) - types.Add (parms[i].ParameterType.GetElementType ()); - } - break; - } - } - - return GetSig (types.ToArray ()); - } - - public static Signature GetSig (object[] objs) - { - return GetSig (Type.GetTypeArray (objs)); - } - - public static Signature GetSig (Type[] types) - { - if (types.Length == 0) - return Signature.Empty; - - MemoryStream ms = new MemoryStream (); - - foreach (Type type in types) { - { - byte[] data = GetSig (type).Data; - ms.Write (data, 0, data.Length); - } - } - - Signature sig; - sig.Data = ms.ToArray (); - return sig; - } - - public static Signature GetSig (Type type) - { - if (type == null) - return Signature.Empty; - - MemoryStream ms = new MemoryStream (); - - if (type.IsArray) { - ms.WriteByte ((byte)DType.Array); - - Type elem_type = type.GetElementType (); - { - byte[] data = GetSig (elem_type).Data; - ms.Write (data, 0, data.Length); - } - } else if (type.IsMarshalByRef) { - //TODO: consider further what to do for remote object reference marshaling - ms.WriteByte ((byte)DType.ObjectPath); - } else if (type.IsGenericType && (type.GetGenericTypeDefinition () == typeof (IDictionary<,>) || type.GetGenericTypeDefinition () == typeof (Dictionary<,>))) { - Type[] genArgs = type.GetGenericArguments (); - - ms.WriteByte ((byte)'a'); - ms.WriteByte ((byte)'{'); - - { - byte[] data = GetSig (genArgs[0]).Data; - ms.Write (data, 0, data.Length); - } - - { - byte[] data = GetSig (genArgs[1]).Data; - ms.Write (data, 0, data.Length); - } - - ms.WriteByte ((byte)'}'); - } else if (!type.IsPrimitive && type.IsValueType && !type.IsEnum) { - if (type.IsGenericType && type.GetGenericTypeDefinition () == typeof (KeyValuePair<,>)) - ms.WriteByte ((byte)'{'); - else - ms.WriteByte ((byte)'('); - foreach (FieldInfo fi in type.GetFields ()) { - { - //there didn't seem to be a way to do this with BindingFlags at time of writing - if (fi.IsStatic) - continue; - byte[] data = GetSig (fi.FieldType).Data; - ms.Write (data, 0, data.Length); - } - } - //FIXME: the constructor hack is disabled here but still used in object mapping. the behaviour should be unified - /* - ConstructorInfo[] cis = type.GetConstructors (BindingFlags.Public); - if (cis.Length != 0) { - System.Reflection.ConstructorInfo ci = cis[0]; - System.Reflection.ParameterInfo[] parms = ci.GetParameters (); - - foreach (ParameterInfo parm in parms) { - { - byte[] data = GetSig (parm.ParameterType).Data; - ms.Write (data, 0, data.Length); - } - } - } else { - foreach (FieldInfo fi in type.GetFields ()) { - { - //there didn't seem to be a way to do this with BindingFlags at time of writing - if (fi.IsStatic) - continue; - byte[] data = GetSig (fi.FieldType).Data; - ms.Write (data, 0, data.Length); - } - } - } - */ - if (type.IsGenericType && type.GetGenericTypeDefinition () == typeof (KeyValuePair<,>)) - ms.WriteByte ((byte)'}'); - else - ms.WriteByte ((byte)')'); - } else { - DType dtype = Signature.TypeToDType (type); - ms.WriteByte ((byte)dtype); - } - - Signature sig; - sig.Data = ms.ToArray (); - return sig; - } - } - - public enum ArgDirection - { - In, - Out, - } - - public enum DType : byte - { - Invalid = (byte)'\0', - - Byte = (byte)'y', - Boolean = (byte)'b', - Int16 = (byte)'n', - UInt16 = (byte)'q', - Int32 = (byte)'i', - UInt32 = (byte)'u', - Int64 = (byte)'x', - UInt64 = (byte)'t', - Single = (byte)'f', //This is not yet supported! - Double = (byte)'d', - String = (byte)'s', - ObjectPath = (byte)'o', - Signature = (byte)'g', - - Array = (byte)'a', - Struct = (byte)'r', - DictEntry = (byte)'e', - Variant = (byte)'v' - } -} diff -urNad telepathy-sharp-0.0.svn.20060831/dbus-sharp/src/Transport.cs telepathy-sharp-0.0.svn.20070221/dbus-sharp/src/Transport.cs --- telepathy-sharp-0.0.svn.20060831/dbus-sharp/src/Transport.cs 2006-09-25 20:22:03.000000000 +0200 +++ telepathy-sharp-0.0.svn.20070221/dbus-sharp/src/Transport.cs 1970-01-01 01:00:00.000000000 +0100 @@ -1,24 +0,0 @@ -// Copyright 2006 Alp Toker -// This software is made available under the MIT License -// See COPYING for details - -using System; -using System.IO; - -namespace NDesk.DBus -{ - public interface IAuthenticator - { - string AuthString (); - } - - public abstract class Transport : IAuthenticator - { - //TODO: design this properly - - //this is just a temporary solution - public Stream Stream; - public long SocketHandle; - public abstract string AuthString (); - } -} diff -urNad telepathy-sharp-0.0.svn.20060831/dbus-sharp/src/UnixMonoTransport.cs telepathy-sharp-0.0.svn.20070221/dbus-sharp/src/UnixMonoTransport.cs --- telepathy-sharp-0.0.svn.20060831/dbus-sharp/src/UnixMonoTransport.cs 2006-09-25 20:22:03.000000000 +0200 +++ telepathy-sharp-0.0.svn.20070221/dbus-sharp/src/UnixMonoTransport.cs 1970-01-01 01:00:00.000000000 +0100 @@ -1,59 +0,0 @@ -// Copyright 2006 Alp Toker -// This software is made available under the MIT License -// See COPYING for details - -using System; -using System.IO; -using System.Net; -using System.Net.Sockets; - -using Mono.Unix; -using Mono.Unix.Native; - -namespace NDesk.DBus -{ - public class UnixMonoTransport : Transport, IAuthenticator - { - protected Socket socket; - - public UnixMonoTransport (string path, bool @abstract) - { - if (@abstract) - socket = OpenAbstractUnix (path); - else - socket = OpenUnix (path); - - socket.Blocking = true; - SocketHandle = (long)socket.Handle; - //Stream = new UnixStream ((int)socket.Handle); - Stream = new NetworkStream (socket); - } - - public override string AuthString () - { - long uid = UnixUserInfo.GetRealUserId (); - - return uid.ToString (); - } - - protected Socket OpenAbstractUnix (string path) - { - AbstractUnixEndPoint ep = new AbstractUnixEndPoint (path); - - Socket client = new Socket (AddressFamily.Unix, SocketType.Stream, 0); - client.Connect (ep); - - return client; - } - - public Socket OpenUnix (string path) - { - UnixEndPoint remoteEndPoint = new UnixEndPoint (path); - - Socket client = new Socket (AddressFamily.Unix, SocketType.Stream, 0); - client.Connect (remoteEndPoint); - - return client; - } - } -} diff -urNad telepathy-sharp-0.0.svn.20060831/dbus-sharp/src/UnixNativeTransport.cs telepathy-sharp-0.0.svn.20070221/dbus-sharp/src/UnixNativeTransport.cs --- telepathy-sharp-0.0.svn.20060831/dbus-sharp/src/UnixNativeTransport.cs 2006-09-25 20:22:03.000000000 +0200 +++ telepathy-sharp-0.0.svn.20070221/dbus-sharp/src/UnixNativeTransport.cs 1970-01-01 01:00:00.000000000 +0100 @@ -1,160 +0,0 @@ -// Copyright 2006 Alp Toker -// This software is made available under the MIT License -// See COPYING for details - -using System; -using System.IO; -using System.Text; -using System.Net; -using System.Net.Sockets; - -using System.Runtime.InteropServices; - -using Mono.Unix; -using Mono.Unix.Native; - -namespace NDesk.DBus -{ - public class UnixSocket - { - public const short AF_UNIX = 1; - - [DllImport ("libc", SetLastError=true)] - protected static extern int socket (int domain, int type, int protocol); - - [DllImport ("libc", SetLastError=true)] - protected static extern int connect (int sockfd, byte[] serv_addr, uint addrlen); - - [DllImport ("libc", SetLastError=true)] - protected static extern int bind (int sockfd, byte[] my_addr, uint addrlen); - - [DllImport ("libc", SetLastError=true)] - protected static extern int listen (int sockfd, int backlog); - - //[DllImport ("libc", SetLastError=true)] - // protected static extern int accept (int sockfd, out byte[] addr, out uint addrlen); - - public int Handle; - - public UnixSocket (int handle) - { - this.Handle = handle; - } - - public UnixSocket () - { - //TODO: don't hard-code PF_UNIX and SocketType.Stream - //AddressFamily family, SocketType type, ProtocolType proto - - int r = socket (AF_UNIX, (int)SocketType.Stream, 0); - //we should get the Exception from UnixMarshal and throw it here for a better stack trace, but the relevant API seems to be private - UnixMarshal.ThrowExceptionForLastErrorIf (r); - Handle = r; - } - - protected bool connected = false; - - //TODO: consider memory management - public void Connect (byte[] remote_end) - { - int r = connect (Handle, remote_end, (uint)remote_end.Length); - //we should get the Exception from UnixMarshal and throw it here for a better stack trace, but the relevant API seems to be private - UnixMarshal.ThrowExceptionForLastErrorIf (r); - connected = true; - } - - //assigns a name to the socket - public void Bind (byte[] local_end) - { - int r = bind (Handle, local_end, (uint)local_end.Length); - UnixMarshal.ThrowExceptionForLastErrorIf (r); - } - - public void Listen (int backlog) - { - int r = listen (Handle, backlog); - UnixMarshal.ThrowExceptionForLastErrorIf (r); - } - - /* - public UnixSocket Accept () - { - byte[] addr; - uint addrlen; - - int r = accept (Handle, out addr, out addrlen); - UnixMarshal.ThrowExceptionForLastErrorIf (r); - return new UnixSocket (); - } - */ - } - - public class UnixNativeTransport : Transport, IAuthenticator - { - protected UnixSocket socket; - - public UnixNativeTransport (string path, bool @abstract) - { - if (String.IsNullOrEmpty (path)) - throw new ArgumentException ("path"); - - if (@abstract) - socket = OpenAbstractUnix (path); - else - socket = OpenUnix (path); - - //socket.Blocking = true; - SocketHandle = (long)socket.Handle; - Stream = new UnixStream ((int)socket.Handle); - } - - public override string AuthString () - { - long uid = UnixUserInfo.GetRealUserId (); - - return uid.ToString (); - } - - protected UnixSocket OpenAbstractUnix (string path) - { - byte[] p = Encoding.Default.GetBytes (path); - - byte[] sa = new byte[2 + 1 + p.Length]; - - //we use BitConverter to stay endian-safe - byte[] afData = BitConverter.GetBytes (UnixSocket.AF_UNIX); - sa[0] = afData[0]; - sa[1] = afData[1]; - - sa[2] = 0; //null prefix for abstract domain socket addresses, see unix(7) - for (int i = 0 ; i != p.Length ; i++) - sa[3 + i] = p[i]; - - UnixSocket client = new UnixSocket (); - client.Connect (sa); - - return client; - } - - public UnixSocket OpenUnix (string path) - { - byte[] p = Encoding.Default.GetBytes (path); - - byte[] sa = new byte[2 + p.Length + 1]; - - //we use BitConverter to stay endian-safe - byte[] afData = BitConverter.GetBytes (UnixSocket.AF_UNIX); - sa[0] = afData[0]; - sa[1] = afData[1]; - - for (int i = 0 ; i != p.Length ; i++) - sa[2 + i] = p[i]; - sa[2 + p.Length] = 0; //null suffix for domain socket addresses, see unix(7) - - UnixSocket client = new UnixSocket (); - client.Connect (sa); - - return client; - } - } -} diff -urNad telepathy-sharp-0.0.svn.20060831/dbus-sharp/src/Wrapper.cs telepathy-sharp-0.0.svn.20070221/dbus-sharp/src/Wrapper.cs --- telepathy-sharp-0.0.svn.20060831/dbus-sharp/src/Wrapper.cs 2006-09-25 20:22:03.000000000 +0200 +++ telepathy-sharp-0.0.svn.20070221/dbus-sharp/src/Wrapper.cs 1970-01-01 01:00:00.000000000 +0100 @@ -1,148 +0,0 @@ -// Copyright 2006 Alp Toker -// This software is made available under the MIT License -// See COPYING for details - -using System; -using System.Collections.Generic; -using System.IO; - -namespace NDesk.DBus -{ - //TODO: complete and use these wrapper classes - //not sure exactly what I'm thinking but there seems to be sense here - - //FIXME: signature sending/receiving is currently ambiguous in this code - //FIXME: in fact, these classes are totally broken and end up doing no-op, do not use without understanding the problem - public class MethodCall - { - public Message message = new Message (); - - public MethodCall (ObjectPath path, string @interface, string member, string destination) - { - message.Header.MessageType = MessageType.MethodCall; - message.ReplyExpected = true; - message.Header.Fields[FieldCode.Path] = path; - message.Header.Fields[FieldCode.Interface] = @interface; - message.Header.Fields[FieldCode.Member] = member; - message.Header.Fields[FieldCode.Destination] = destination; - //TODO: consider setting Sender here for p2p situations - //this will allow us to remove the p2p hacks in MethodCall and Message -#if PROTO_REPLY_SIGNATURE - //TODO -#endif - } - - public MethodCall (ObjectPath path, string @interface, string member, string destination, Signature signature) : this (path, @interface, member, destination) - { - //message.Header.Fields[FieldCode.Signature] = signature; - //use the wrapper in Message because it checks for emptiness - message.Signature = signature; - } - - public MethodCall (Message message) - { - this.message = message; - Path = (ObjectPath)message.Header.Fields[FieldCode.Path]; - Interface = (string)message.Header.Fields[FieldCode.Interface]; - Member = (string)message.Header.Fields[FieldCode.Member]; - Destination = (string)message.Header.Fields[FieldCode.Destination]; - //TODO: filled by the bus so reliable, but not the case for p2p - //so we make it optional here, but this needs some more thought - if (message.Header.Fields.ContainsKey (FieldCode.Sender)) - Sender = (string)message.Header.Fields[FieldCode.Sender]; -#if PROTO_REPLY_SIGNATURE - //TODO: note that an empty ReplySignature should really be treated differently to the field not existing! - if (message.Header.Fields.ContainsKey (FieldCode.ReplySignature)) - ReplySignature = (Signature)message.Header.Fields[FieldCode.ReplySignature]; - else - ReplySignature = new Signature (); -#endif - //Signature = (Signature)message.Header.Fields[FieldCode.Signature]; - //use the wrapper in Message because it checks for emptiness - Signature = message.Signature; - } - - public ObjectPath Path; - public string Interface; - public string Member; - public string Destination; - public string Sender; -#if PROTO_REPLY_SIGNATURE - public Signature ReplySignature; -#endif - public Signature Signature; - } - - public class MethodReturn - { - public Message message = new Message (); - - public MethodReturn (uint reply_serial) - { - message.Header.MessageType = MessageType.MethodReturn; - message.ReplyExpected = false; - message.Header.Fields[FieldCode.ReplySerial] = reply_serial; - //signature optional? - //message.Header.Fields[FieldCode.Signature] = signature; - } - - public MethodReturn (Message message) - { - this.message = message; - ReplySerial = (uint)message.Header.Fields[FieldCode.ReplySerial]; - } - - public uint ReplySerial; - } - - public class Error - { - public Message message = new Message (); - - public Error (string error_name, uint reply_serial) - { - message.Header.MessageType = MessageType.Error; - message.ReplyExpected = false; - message.Header.Fields[FieldCode.ErrorName] = error_name; - message.Header.Fields[FieldCode.ReplySerial] = reply_serial; - } - - public Error (Message message) - { - this.message = message; - ErrorName = (string)message.Header.Fields[FieldCode.ErrorName]; - ReplySerial = (uint)message.Header.Fields[FieldCode.ReplySerial]; - //Signature = (Signature)message.Header.Fields[FieldCode.Signature]; - } - - public string ErrorName; - public uint ReplySerial; - //public Signature Signature; - } - - public class Signal - { - public Message message = new Message (); - - public Signal (ObjectPath path, string @interface, string member) - { - message.Header.MessageType = MessageType.Signal; - message.ReplyExpected = false; - message.Header.Fields[FieldCode.Path] = path; - message.Header.Fields[FieldCode.Interface] = @interface; - message.Header.Fields[FieldCode.Member] = member; - } - - public Signal (Message message) - { - this.message = message; - Path = (ObjectPath)message.Header.Fields[FieldCode.Path]; - Interface = (string)message.Header.Fields[FieldCode.Interface]; - Member = (string)message.Header.Fields[FieldCode.Member]; - } - - public ObjectPath Path; - public string Interface; - public string Member; - } -} diff -urNad telepathy-sharp-0.0.svn.20060831/dbus-sharp/tools/Introspect.cs telepathy-sharp-0.0.svn.20070221/dbus-sharp/tools/Introspect.cs --- telepathy-sharp-0.0.svn.20060831/dbus-sharp/tools/Introspect.cs 2006-09-25 20:22:03.000000000 +0200 +++ telepathy-sharp-0.0.svn.20070221/dbus-sharp/tools/Introspect.cs 1970-01-01 01:00:00.000000000 +0100 @@ -1,39 +0,0 @@ -// Copyright 2006 Alp Toker -// This software is made available under the MIT License -// See COPYING for details - -using System; -using System.Collections.Generic; -using System.IO; -using System.Xml; -using System.Xml.Serialization; -using NDesk.DBus; -using Schemas; - -public class test -{ - public static void Main (string[] args) - { - string fname = args[0]; - StreamReader sr = new StreamReader (fname); - XmlSerializer sz = new XmlSerializer (typeof (Interface)); - Interface iface = (Interface)sz.Deserialize (sr); - - foreach (object o in iface.Items) { - if (o is Property) { - Property prop = (Property)o; - Console.WriteLine (prop.Name); - } - - if (o is Method) { - Method meth = (Method)o; - Console.Write ("void " + meth.Name); - Console.Write (" ("); - foreach (Argument arg in meth.Arguments) - Console.Write ("[" + arg.Direction + "] " + arg.Type + " " + arg.Name + ", "); - Console.Write (");"); - Console.WriteLine (); - } - } - } -} diff -urNad telepathy-sharp-0.0.svn.20060831/dbus-sharp/tools/Makefile telepathy-sharp-0.0.svn.20070221/dbus-sharp/tools/Makefile --- telepathy-sharp-0.0.svn.20060831/dbus-sharp/tools/Makefile 2006-09-25 20:22:03.000000000 +0200 +++ telepathy-sharp-0.0.svn.20070221/dbus-sharp/tools/Makefile 1970-01-01 01:00:00.000000000 +0100 @@ -1,18 +0,0 @@ -DBUS_SHARP_PREFIX=.. - -VPATH=$(DBUS_SHARP_PREFIX)/src - -all: monitor - -monitor.exe: NDesk.DBus.dll Monitor.cs - -introspect.exe: NDesk.DBus.dll Introspect.cs IntrospectionSchema.cs - -monitor: monitor.exe - echo '#!/bin/sh' > $@ - echo 'export MONO_PATH=$(DBUS_SHARP_PREFIX)/src:$$MONO_PATH' >> $@ - echo '$(RUNTIME) $^ $$@' >> $@ - chmod +x $@ - - -include ../include.mk diff -urNad telepathy-sharp-0.0.svn.20060831/dbus-sharp/tools/Monitor.cs telepathy-sharp-0.0.svn.20070221/dbus-sharp/tools/Monitor.cs --- telepathy-sharp-0.0.svn.20060831/dbus-sharp/tools/Monitor.cs 2006-09-25 20:22:03.000000000 +0200 +++ telepathy-sharp-0.0.svn.20070221/dbus-sharp/tools/Monitor.cs 1970-01-01 01:00:00.000000000 +0100 @@ -1,98 +0,0 @@ -// Copyright 2006 Alp Toker -// This software is made available under the MIT License -// See COPYING for details - -using System; -using System.Collections.Generic; -using NDesk.DBus; -using org.freedesktop.DBus; - -public class ManagedDBusTest -{ - public static void Main (string[] args) - { - string addr = Address.SessionBus; - - if (args.Length == 1) { - string arg = args[0]; - - switch (arg) - { - case "--system": - addr = Address.SystemBus; - break; - case "--session": - addr = Address.SessionBus; - break; - default: - Console.Error.WriteLine ("Usage: monitor.exe [--system | --session] [watch expressions]"); - Console.Error.WriteLine (" If no watch expressions are provided, defaults will be used."); - return; - } - } - - Connection conn = new Connection (false); - conn.Open (addr); - conn.Authenticate (); - - ObjectPath opath = new ObjectPath ("/org/freedesktop/DBus"); - string name = "org.freedesktop.DBus"; - - Bus bus = conn.GetObject (name, opath); - - bus.NameAcquired += delegate (string acquired_name) { - Console.WriteLine ("NameAcquired: " + acquired_name); - }; - - bus.Hello (); - - //hack to process the NameAcquired signal synchronously - conn.HandleSignal (conn.ReadMessage ()); - - if (args.Length > 1) { - //install custom match rules only - for (int i = 1 ; i != args.Length ; i++) - bus.AddMatch (args[i]); - } else { - //no custom match rules, install the defaults - bus.AddMatch (MessageFilter.CreateMatchRule (MessageType.Signal)); - bus.AddMatch (MessageFilter.CreateMatchRule (MessageType.MethodCall)); - bus.AddMatch (MessageFilter.CreateMatchRule (MessageType.MethodReturn)); - bus.AddMatch (MessageFilter.CreateMatchRule (MessageType.Error)); - } - - while (true) { - Message msg = conn.ReadMessage (); - PrintMessage (msg); - Console.WriteLine (); - } - } - - public static void PrintMessage (Message msg) - { - Console.WriteLine ("Message:"); - Console.WriteLine ("\t" + "Type: " + msg.Header.MessageType); - //foreach (HeaderField hf in msg.HeaderFields) - // Console.WriteLine ("\t" + hf.Code + ": " + hf.Value); - foreach (KeyValuePair field in msg.Header.Fields) - Console.WriteLine ("\t" + field.Key + ": " + field.Value); - - if (msg.Body != null) { - Console.WriteLine ("\tBody:"); - MessageReader reader = new MessageReader (msg); - - //TODO: this needs to be done more intelligently - try { - foreach (DType dtype in msg.Signature.Data) { - if (dtype == DType.Invalid) - continue; - object arg; - reader.GetValue (dtype, out arg); - Console.WriteLine ("\t\t" + dtype + ": " + arg); - } - } catch { - Console.WriteLine ("\t\tmonitor is too dumb to decode message body"); - } - } - } -} diff -urNad telepathy-sharp-0.0.svn.20060831/dbus-sharp/Transport.cs telepathy-sharp-0.0.svn.20070221/dbus-sharp/Transport.cs --- telepathy-sharp-0.0.svn.20060831/dbus-sharp/Transport.cs 1970-01-01 01:00:00.000000000 +0100 +++ telepathy-sharp-0.0.svn.20070221/dbus-sharp/Transport.cs 2007-02-21 19:10:38.000000000 +0100 @@ -0,0 +1,24 @@ +// Copyright 2006 Alp Toker +// This software is made available under the MIT License +// See COPYING for details + +using System; +using System.IO; + +namespace NDesk.DBus.Transports +{ + public interface IAuthenticator + { + string AuthString (); + } + + public abstract class Transport : IAuthenticator + { + //TODO: design this properly + + //this is just a temporary solution + public Stream Stream; + public long SocketHandle; + public abstract string AuthString (); + } +} diff -urNad telepathy-sharp-0.0.svn.20060831/dbus-sharp/UnixMonoTransport.cs telepathy-sharp-0.0.svn.20070221/dbus-sharp/UnixMonoTransport.cs --- telepathy-sharp-0.0.svn.20060831/dbus-sharp/UnixMonoTransport.cs 1970-01-01 01:00:00.000000000 +0100 +++ telepathy-sharp-0.0.svn.20070221/dbus-sharp/UnixMonoTransport.cs 2007-02-21 19:10:38.000000000 +0100 @@ -0,0 +1,59 @@ +// Copyright 2006 Alp Toker +// This software is made available under the MIT License +// See COPYING for details + +using System; +using System.IO; +using System.Net; +using System.Net.Sockets; + +using Mono.Unix; +using Mono.Unix.Native; + +namespace NDesk.DBus.Transports +{ + public class UnixMonoTransport : Transport, IAuthenticator + { + protected Socket socket; + + public UnixMonoTransport (string path, bool @abstract) + { + if (@abstract) + socket = OpenAbstractUnix (path); + else + socket = OpenUnix (path); + + socket.Blocking = true; + SocketHandle = (long)socket.Handle; + //Stream = new UnixStream ((int)socket.Handle); + Stream = new NetworkStream (socket); + } + + public override string AuthString () + { + long uid = UnixUserInfo.GetRealUserId (); + + return uid.ToString (); + } + + protected Socket OpenAbstractUnix (string path) + { + AbstractUnixEndPoint ep = new AbstractUnixEndPoint (path); + + Socket client = new Socket (AddressFamily.Unix, SocketType.Stream, 0); + client.Connect (ep); + + return client; + } + + public Socket OpenUnix (string path) + { + UnixEndPoint remoteEndPoint = new UnixEndPoint (path); + + Socket client = new Socket (AddressFamily.Unix, SocketType.Stream, 0); + client.Connect (remoteEndPoint); + + return client; + } + } +} diff -urNad telepathy-sharp-0.0.svn.20060831/dbus-sharp/UnixNativeTransport.cs telepathy-sharp-0.0.svn.20070221/dbus-sharp/UnixNativeTransport.cs --- telepathy-sharp-0.0.svn.20060831/dbus-sharp/UnixNativeTransport.cs 1970-01-01 01:00:00.000000000 +0100 +++ telepathy-sharp-0.0.svn.20070221/dbus-sharp/UnixNativeTransport.cs 2007-02-21 19:10:38.000000000 +0100 @@ -0,0 +1,169 @@ +// Copyright 2006 Alp Toker +// This software is made available under the MIT License +// See COPYING for details + +using System; +using System.IO; +using System.Text; +using System.Net; +using System.Net.Sockets; + +using System.Runtime.InteropServices; + +using Mono.Unix; +using Mono.Unix.Native; + +namespace NDesk.DBus.Transports +{ + public class UnixSocket + { + public const short AF_UNIX = 1; + + [DllImport ("libc", SetLastError=true)] + protected static extern int socket (int domain, int type, int protocol); + + [DllImport ("libc", SetLastError=true)] + protected static extern int connect (int sockfd, byte[] serv_addr, uint addrlen); + + [DllImport ("libc", SetLastError=true)] + protected static extern int bind (int sockfd, byte[] my_addr, uint addrlen); + + [DllImport ("libc", SetLastError=true)] + protected static extern int listen (int sockfd, int backlog); + + //TODO: this prototype is probably wrong, fix it + [DllImport ("libc", SetLastError=true)] + protected static extern int accept (int sockfd, byte[] addr, ref uint addrlen); + + //TODO: confirm and make use of these functions + [DllImport ("libc", SetLastError=true)] + protected static extern int getsockopt (int s, int optname, IntPtr optval, ref uint optlen); + + [DllImport ("libc", SetLastError=true)] + protected static extern int setsockopt (int s, int optname, IntPtr optval, uint optlen); + + public int Handle; + + public UnixSocket (int handle) + { + this.Handle = handle; + } + + public UnixSocket () + { + //TODO: don't hard-code PF_UNIX and SocketType.Stream + //AddressFamily family, SocketType type, ProtocolType proto + + int r = socket (AF_UNIX, (int)SocketType.Stream, 0); + //we should get the Exception from UnixMarshal and throw it here for a better stack trace, but the relevant API seems to be private + UnixMarshal.ThrowExceptionForLastErrorIf (r); + Handle = r; + } + + protected bool connected = false; + + //TODO: consider memory management + public void Connect (byte[] remote_end) + { + int r = connect (Handle, remote_end, (uint)remote_end.Length); + //we should get the Exception from UnixMarshal and throw it here for a better stack trace, but the relevant API seems to be private + UnixMarshal.ThrowExceptionForLastErrorIf (r); + connected = true; + } + + //assigns a name to the socket + public void Bind (byte[] local_end) + { + int r = bind (Handle, local_end, (uint)local_end.Length); + UnixMarshal.ThrowExceptionForLastErrorIf (r); + } + + public void Listen (int backlog) + { + int r = listen (Handle, backlog); + UnixMarshal.ThrowExceptionForLastErrorIf (r); + } + + public UnixSocket Accept () + { + byte[] addr = new byte[110]; + uint addrlen = (uint)addr.Length; + + int r = accept (Handle, addr, ref addrlen); + UnixMarshal.ThrowExceptionForLastErrorIf (r); + //TODO: use the returned addr + //TODO: fix probable memory leak here + //string str = Encoding.Default.GetString (addr, 0, (int)addrlen); + return new UnixSocket (r); + } + } + + public class UnixNativeTransport : Transport, IAuthenticator + { + protected UnixSocket socket; + + public UnixNativeTransport (string path, bool @abstract) + { + if (String.IsNullOrEmpty (path)) + throw new ArgumentException ("path"); + + if (@abstract) + socket = OpenAbstractUnix (path); + else + socket = OpenUnix (path); + + //socket.Blocking = true; + SocketHandle = (long)socket.Handle; + Stream = new UnixStream ((int)socket.Handle); + } + + public override string AuthString () + { + long uid = UnixUserInfo.GetRealUserId (); + + return uid.ToString (); + } + + protected UnixSocket OpenAbstractUnix (string path) + { + byte[] p = Encoding.Default.GetBytes (path); + + byte[] sa = new byte[2 + 1 + p.Length]; + + //we use BitConverter to stay endian-safe + byte[] afData = BitConverter.GetBytes (UnixSocket.AF_UNIX); + sa[0] = afData[0]; + sa[1] = afData[1]; + + sa[2] = 0; //null prefix for abstract domain socket addresses, see unix(7) + for (int i = 0 ; i != p.Length ; i++) + sa[3 + i] = p[i]; + + UnixSocket client = new UnixSocket (); + client.Connect (sa); + + return client; + } + + public UnixSocket OpenUnix (string path) + { + byte[] p = Encoding.Default.GetBytes (path); + + byte[] sa = new byte[2 + p.Length + 1]; + + //we use BitConverter to stay endian-safe + byte[] afData = BitConverter.GetBytes (UnixSocket.AF_UNIX); + sa[0] = afData[0]; + sa[1] = afData[1]; + + for (int i = 0 ; i != p.Length ; i++) + sa[2 + i] = p[i]; + sa[2 + p.Length] = 0; //null suffix for domain socket addresses, see unix(7) + + UnixSocket client = new UnixSocket (); + client.Connect (sa); + + return client; + } + } +} diff -urNad telepathy-sharp-0.0.svn.20060831/dbus-sharp/Wrapper.cs telepathy-sharp-0.0.svn.20070221/dbus-sharp/Wrapper.cs --- telepathy-sharp-0.0.svn.20060831/dbus-sharp/Wrapper.cs 1970-01-01 01:00:00.000000000 +0100 +++ telepathy-sharp-0.0.svn.20070221/dbus-sharp/Wrapper.cs 2007-02-21 19:10:38.000000000 +0100 @@ -0,0 +1,144 @@ +// Copyright 2006 Alp Toker +// This software is made available under the MIT License +// See COPYING for details + +using System; +using System.Collections.Generic; +using System.IO; + +namespace NDesk.DBus +{ + //TODO: complete and use these wrapper classes + //not sure exactly what I'm thinking but there seems to be sense here + + //FIXME: signature sending/receiving is currently ambiguous in this code + //FIXME: in fact, these classes are totally broken and end up doing no-op, do not use without understanding the problem + public class MethodCall + { + public Message message = new Message (); + + public MethodCall (ObjectPath path, string @interface, string member, string destination, Signature signature) + { + message.Header.MessageType = MessageType.MethodCall; + message.ReplyExpected = true; + message.Header.Fields[FieldCode.Path] = path; + message.Header.Fields[FieldCode.Interface] = @interface; + message.Header.Fields[FieldCode.Member] = member; + message.Header.Fields[FieldCode.Destination] = destination; + //TODO: consider setting Sender here for p2p situations + //this will allow us to remove the p2p hacks in MethodCall and Message +#if PROTO_REPLY_SIGNATURE + //TODO +#endif + //message.Header.Fields[FieldCode.Signature] = signature; + //use the wrapper in Message because it checks for emptiness + message.Signature = signature; + } + + public MethodCall (Message message) + { + this.message = message; + Path = (ObjectPath)message.Header.Fields[FieldCode.Path]; + Interface = (string)message.Header.Fields[FieldCode.Interface]; + Member = (string)message.Header.Fields[FieldCode.Member]; + Destination = (string)message.Header.Fields[FieldCode.Destination]; + //TODO: filled by the bus so reliable, but not the case for p2p + //so we make it optional here, but this needs some more thought + if (message.Header.Fields.ContainsKey (FieldCode.Sender)) + Sender = (string)message.Header.Fields[FieldCode.Sender]; +#if PROTO_REPLY_SIGNATURE + //TODO: note that an empty ReplySignature should really be treated differently to the field not existing! + if (message.Header.Fields.ContainsKey (FieldCode.ReplySignature)) + ReplySignature = (Signature)message.Header.Fields[FieldCode.ReplySignature]; + else + ReplySignature = Signature.Empty; +#endif + //Signature = (Signature)message.Header.Fields[FieldCode.Signature]; + //use the wrapper in Message because it checks for emptiness + Signature = message.Signature; + } + + public ObjectPath Path; + public string Interface; + public string Member; + public string Destination; + public string Sender; +#if PROTO_REPLY_SIGNATURE + public Signature ReplySignature; +#endif + public Signature Signature; + } + + public class MethodReturn + { + public Message message = new Message (); + + public MethodReturn (uint reply_serial) + { + message.Header.MessageType = MessageType.MethodReturn; + message.Header.Flags = HeaderFlag.NoReplyExpected | HeaderFlag.NoAutoStart; + message.Header.Fields[FieldCode.ReplySerial] = reply_serial; + //signature optional? + //message.Header.Fields[FieldCode.Signature] = signature; + } + + public MethodReturn (Message message) + { + this.message = message; + ReplySerial = (uint)message.Header.Fields[FieldCode.ReplySerial]; + } + + public uint ReplySerial; + } + + public class Error + { + public Message message = new Message (); + + public Error (string error_name, uint reply_serial) + { + message.Header.MessageType = MessageType.Error; + message.Header.Flags = HeaderFlag.NoReplyExpected | HeaderFlag.NoAutoStart; + message.Header.Fields[FieldCode.ErrorName] = error_name; + message.Header.Fields[FieldCode.ReplySerial] = reply_serial; + } + + public Error (Message message) + { + this.message = message; + ErrorName = (string)message.Header.Fields[FieldCode.ErrorName]; + ReplySerial = (uint)message.Header.Fields[FieldCode.ReplySerial]; + //Signature = (Signature)message.Header.Fields[FieldCode.Signature]; + } + + public string ErrorName; + public uint ReplySerial; + //public Signature Signature; + } + + public class Signal + { + public Message message = new Message (); + + public Signal (ObjectPath path, string @interface, string member) + { + message.Header.MessageType = MessageType.Signal; + message.Header.Flags = HeaderFlag.NoReplyExpected | HeaderFlag.NoAutoStart; + message.Header.Fields[FieldCode.Path] = path; + message.Header.Fields[FieldCode.Interface] = @interface; + message.Header.Fields[FieldCode.Member] = member; + } + + public Signal (Message message) + { + this.message = message; + Path = (ObjectPath)message.Header.Fields[FieldCode.Path]; + Interface = (string)message.Header.Fields[FieldCode.Interface]; + Member = (string)message.Header.Fields[FieldCode.Member]; + } + + public ObjectPath Path; + public string Interface; + public string Member; + } +} diff -urNad telepathy-sharp-0.0.svn.20060831/debian/changelog telepathy-sharp-0.0.svn.20070221/debian/changelog --- telepathy-sharp-0.0.svn.20060831/debian/changelog 2007-02-22 22:30:46.000000000 +0100 +++ telepathy-sharp-0.0.svn.20070221/debian/changelog 2007-02-22 22:21:25.000000000 +0100 @@ -1,6 +1,14 @@ -telepathy-sharp (0.0.svn.20060831-1) unstable; urgency=low +telepathy-sharp (0.0.svn.20070221-0ubuntu2) feisty; urgency=low - * Initial release (Closes: #nnnn) + * New upstream release. + * added 01_fix_external_ndbus.patch, for use external NDbus packages. + * added 99_autoreconf.patch + + -- Riccardo Setti Wed, 21 Feb 2007 19:42:20 +0100 - -- Riccardo Setti Mon, 25 Sep 2006 20:45:15 +0200 +telepathy-sharp (0.0.svn.20061115-0ubuntu1) feisty; urgency=low + + * First Ubuntu Release. + + -- Riccardo Setti Tue, 15 Nov 2006 19:00:23 +0100 diff -urNad telepathy-sharp-0.0.svn.20060831/debian/control telepathy-sharp-0.0.svn.20070221/debian/control --- telepathy-sharp-0.0.svn.20060831/debian/control 2007-02-22 22:30:46.000000000 +0100 +++ telepathy-sharp-0.0.svn.20070221/debian/control 2007-02-22 22:21:25.000000000 +0100 @@ -2,13 +2,13 @@ Section: libs Priority: optional Maintainer: Riccardo Setti -Build-Depends: debhelper (>= 5), cdbs -Build-Depends-Indep: libmono-dev (>= 1.1.17), mono-gmcs, libmono1.0-cil, mono-mcs, cli-common-dev (>= 0.4.4) +Build-Depends: debhelper (>= 5), cdbs, +Build-Depends-Indep: libmono-dev (>= 1.1.17), mono-gmcs, libmono1.0-cil, mono-mcs, cli-common-dev (>= 0.4.0), libndesk-dbus1.0-cil Standards-Version: 3.7.2 Package: libtelepathy-cil Architecture: all -Depends: ${cli:Depends}, ${misc:Depends} +Depends: ${misc:Depends}, ${cli:Depends} Description: CLI library for Telepathy Telepathy is a D-Bus framework for unifying real time communication, including instant messaging, voice calls and video calls. It abstracts diff -urNad telepathy-sharp-0.0.svn.20060831/debian/copyright telepathy-sharp-0.0.svn.20070221/debian/copyright --- telepathy-sharp-0.0.svn.20060831/debian/copyright 2007-02-22 22:30:46.000000000 +0100 +++ telepathy-sharp-0.0.svn.20070221/debian/copyright 2007-02-22 22:21:25.000000000 +0100 @@ -12,23 +12,24 @@ License: - Permission is hereby granted, free of charge, to any person - obtaining a copy of this software and associated documentation files - (the "Software"), to deal in the Software without restriction, including - without limitation the rights to use, copy, modify, merge, publish, - distribute, sublicense, and/or sell copies of the Software, and to - permit persons to whom the Software is furnished to do so, subject - to the following conditions: + THIS FILE IS LICENSED UNDER THE MIT LICENSE AS OUTLINED IMMEDIATELY BELOW: + Permission is hereby granted, free of charge, to any person obtaining a + copy of this software and associated documentation files (the "Software"), + to deal in the Software without restriction, including without limitation + the rights to use, copy, modify, merge, publish, distribute, sublicense, + and/or sell copies of the Software, and to permit persons to whom the + Software is furnished to do so, subject to the following conditions: - The above copyright notice and this permission notice shall be included - in all copies or substantial portions of the Software. + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + DEALINGS IN THE SOFTWARE. The Debian packaging is (C) 2006, Riccardo Setti and is licensed under the GPL, see `/usr/share/common-licenses/GPL'. diff -urNad telepathy-sharp-0.0.svn.20060831/debian/patches/01_fix_external_ndbus.patch telepathy-sharp-0.0.svn.20070221/debian/patches/01_fix_external_ndbus.patch --- telepathy-sharp-0.0.svn.20060831/debian/patches/01_fix_external_ndbus.patch 1970-01-01 01:00:00.000000000 +0100 +++ telepathy-sharp-0.0.svn.20070221/debian/patches/01_fix_external_ndbus.patch 2007-02-22 22:21:25.000000000 +0100 @@ -0,0 +1,109 @@ +Index: test/Test.cs +=================================================================== +--- test/Test.cs (revision 1393) ++++ test/Test.cs (working copy) +@@ -63,7 +63,7 @@ + + conn = conn_manager.RequestConnection ("jabber", option_list); + +- Console.WriteLine ("Bus Name: " + conn.BusName + ", " + conn.ObjectPath.Value); ++ Console.WriteLine ("Bus Name: " + conn.BusName + ", " + conn.ObjectPath); + iconn = bus.GetObject (conn.BusName, conn.ObjectPath); + + iconn.StatusChanged += OnConnectionStateChanged; +Index: test/Makefile.am +=================================================================== +--- test/Makefile.am (revision 1393) ++++ test/Makefile.am (working copy) +@@ -3,9 +3,14 @@ + TEST_NAME = test + TEST = $(TEST_NAME).exe + TARGET = $(TEST) ++ ++if EXTERNAL_DBUS ++PKG_REFERENCES = $(DBUS_LIBS) -r:../telepathy/INdT.Telepathy.dll ++else + PKG_REFERENCES = \ + -r:../dbus-sharp/NDesk.DBus.dll \ + -r:../telepathy/INdT.Telepathy.dll ++endif + + test_sources = Test.cs + +Index: telepathy/Makefile.am +=================================================================== +--- telepathy/Makefile.am (revision 1393) ++++ telepathy/Makefile.am (working copy) +@@ -37,8 +37,12 @@ + + CLEANFILES = $(ASSEMBLY) $(ASSEMBLY).mdb $(ASSEMBLY).config + ++if EXTERNAL_DBUS ++PKG_REFERENCES = $(DBUS_LIBS) ++else + PKG_REFERENCES = \ + -r:$(top_srcdir)/dbus-sharp/NDesk.DBus.dll ++endif + + $(ASSEMBLY): $(SOURCES) + $(CSC) -target:library -out:$@ $(CSC_FLAGS) $(SOURCES) $(PKG_REFERENCES) +Index: configure.ac +=================================================================== +--- configure.ac (revision 1393) ++++ configure.ac (working copy) +@@ -35,6 +35,14 @@ + AC_MSG_ERROR([You need to install libmono-devel package]) + fi + ++PKG_CHECK_MODULES(DBUS, ndesk-dbus-1.0 >= 0.4 \ ++ ndesk-dbus-glib-1.0 >= 0.3, have_external_dbus="yes", have_external_dbus="no") ++if test "x$have_external_dbus" != "xyes"; then ++ AC_MSG_RESULT([using internal copy]) ++fi ++AM_CONDITIONAL(EXTERNAL_DBUS, test "x$have_external_dbus" = "xyes") ++ ++ + AC_OUTPUT([ + telepathy-sharp.pc + Makefile +Index: dbus-sharp/Makefile.am +=================================================================== +--- dbus-sharp/Makefile.am (revision 1393) ++++ dbus-sharp/Makefile.am (working copy) +@@ -1,12 +1,3 @@ +-CSC_FLAGS = -debug -unsafe +- +-ASSEMBLY_NAME = NDesk.DBus +-ASSEMBLY = $(ASSEMBLY_NAME).dll +-NDesk_DBusdir = $(pkglibdir) +-NDesk_DBus_SCRIPTS = $(ASSEMBLY) +- +-TARGET = $(ASSEMBLY) +- + SOURCES= \ + Address.cs \ + AssemblyInfo.cs \ +@@ -32,6 +23,18 @@ + UnixNativeTransport.cs \ + Wrapper.cs + ++ ++if !EXTERNAL_DBUS ++CSC_FLAGS = -debug -unsafe ++ ++ ++ASSEMBLY_NAME = NDesk.DBus ++ASSEMBLY = $(ASSEMBLY_NAME).dll ++NDesk_DBusdir = $(pkglibdir) ++NDesk_DBus_SCRIPTS = $(ASSEMBLY) ++ ++TARGET = $(ASSEMBLY) ++ + CLEANFILES = $(ASSEMBLY) $(ASSEMBLY).mdb $(ASSEMBLY).config + + PKG_REFERENCES = -r:Mono.Posix +@@ -40,3 +43,4 @@ + $(CSC) -target:library -out:$@ $(CSC_FLAGS) $(SOURCES) $(PKG_REFERENCES) + + all: $(ASSEMBLY) ++endif diff -urNad telepathy-sharp-0.0.svn.20060831/debian/patches/99_autoreconf.patch telepathy-sharp-0.0.svn.20070221/debian/patches/99_autoreconf.patch --- telepathy-sharp-0.0.svn.20060831/debian/patches/99_autoreconf.patch 1970-01-01 01:00:00.000000000 +0100 +++ telepathy-sharp-0.0.svn.20070221/debian/patches/99_autoreconf.patch 2007-02-22 22:21:25.000000000 +0100 @@ -0,0 +1,311 @@ +diff -urNad telepathy-sharp-0.0.svn.20070221/configure telepathy-sharp/configure +--- telepathy-sharp-0.0.svn.20070221/configure 2007-02-21 21:16:07.000000000 +0100 ++++ telepathy-sharp/configure 2007-02-21 21:13:53.000000000 +0100 +@@ -656,6 +656,10 @@ + MONO_DEPENDENCY_LIBS + RUNTIME + CSC ++DBUS_CFLAGS ++DBUS_LIBS ++EXTERNAL_DBUS_TRUE ++EXTERNAL_DBUS_FALSE + LIBOBJS + LTLIBOBJS' + ac_subst_files='' +@@ -664,7 +668,9 @@ + target_alias + PKG_CONFIG + MONO_DEPENDENCY_CFLAGS +-MONO_DEPENDENCY_LIBS' ++MONO_DEPENDENCY_LIBS ++DBUS_CFLAGS ++DBUS_LIBS' + + + # Initialize some variables set by options. +@@ -1252,6 +1258,8 @@ + C compiler flags for MONO_DEPENDENCY, overriding pkg-config + MONO_DEPENDENCY_LIBS + linker flags for MONO_DEPENDENCY, overriding pkg-config ++ DBUS_CFLAGS C compiler flags for DBUS, overriding pkg-config ++ DBUS_LIBS linker flags for DBUS, overriding pkg-config + + Use these variables to override the choices made by `configure' or to help + it to find libraries and programs with nonstandard names/locations. +@@ -2633,6 +2641,101 @@ + { (exit 1); exit 1; }; } + fi + ++ ++pkg_failed=no ++{ echo "$as_me:$LINENO: checking for DBUS" >&5 ++echo $ECHO_N "checking for DBUS... $ECHO_C" >&6; } ++ ++if test -n "$PKG_CONFIG"; then ++ if test -n "$DBUS_CFLAGS"; then ++ pkg_cv_DBUS_CFLAGS="$DBUS_CFLAGS" ++ else ++ if test -n "$PKG_CONFIG" && \ ++ { (echo "$as_me:$LINENO: \$PKG_CONFIG --exists --print-errors \"ndesk-dbus-1.0 >= 0.4 \\ ++ ndesk-dbus-glib-1.0 >= 0.3\"") >&5 ++ ($PKG_CONFIG --exists --print-errors "ndesk-dbus-1.0 >= 0.4 \ ++ ndesk-dbus-glib-1.0 >= 0.3") 2>&5 ++ ac_status=$? ++ echo "$as_me:$LINENO: \$? = $ac_status" >&5 ++ (exit $ac_status); }; then ++ pkg_cv_DBUS_CFLAGS=`$PKG_CONFIG --cflags "ndesk-dbus-1.0 >= 0.4 \ ++ ndesk-dbus-glib-1.0 >= 0.3" 2>/dev/null` ++else ++ pkg_failed=yes ++fi ++ fi ++else ++ pkg_failed=untried ++fi ++if test -n "$PKG_CONFIG"; then ++ if test -n "$DBUS_LIBS"; then ++ pkg_cv_DBUS_LIBS="$DBUS_LIBS" ++ else ++ if test -n "$PKG_CONFIG" && \ ++ { (echo "$as_me:$LINENO: \$PKG_CONFIG --exists --print-errors \"ndesk-dbus-1.0 >= 0.4 \\ ++ ndesk-dbus-glib-1.0 >= 0.3\"") >&5 ++ ($PKG_CONFIG --exists --print-errors "ndesk-dbus-1.0 >= 0.4 \ ++ ndesk-dbus-glib-1.0 >= 0.3") 2>&5 ++ ac_status=$? ++ echo "$as_me:$LINENO: \$? = $ac_status" >&5 ++ (exit $ac_status); }; then ++ pkg_cv_DBUS_LIBS=`$PKG_CONFIG --libs "ndesk-dbus-1.0 >= 0.4 \ ++ ndesk-dbus-glib-1.0 >= 0.3" 2>/dev/null` ++else ++ pkg_failed=yes ++fi ++ fi ++else ++ pkg_failed=untried ++fi ++ ++ ++ ++if test $pkg_failed = yes; then ++ ++if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then ++ _pkg_short_errors_supported=yes ++else ++ _pkg_short_errors_supported=no ++fi ++ if test $_pkg_short_errors_supported = yes; then ++ DBUS_PKG_ERRORS=`$PKG_CONFIG --short-errors --errors-to-stdout --print-errors "ndesk-dbus-1.0 >= 0.4 \ ++ ndesk-dbus-glib-1.0 >= 0.3"` ++ else ++ DBUS_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "ndesk-dbus-1.0 >= 0.4 \ ++ ndesk-dbus-glib-1.0 >= 0.3"` ++ fi ++ # Put the nasty error message in config.log where it belongs ++ echo "$DBUS_PKG_ERRORS" >&5 ++ ++ { echo "$as_me:$LINENO: result: no" >&5 ++echo "${ECHO_T}no" >&6; } ++ have_external_dbus="no" ++elif test $pkg_failed = untried; then ++ have_external_dbus="no" ++else ++ DBUS_CFLAGS=$pkg_cv_DBUS_CFLAGS ++ DBUS_LIBS=$pkg_cv_DBUS_LIBS ++ { echo "$as_me:$LINENO: result: yes" >&5 ++echo "${ECHO_T}yes" >&6; } ++ have_external_dbus="yes" ++fi ++if test "x$have_external_dbus" != "xyes"; then ++ { echo "$as_me:$LINENO: result: using internal copy" >&5 ++echo "${ECHO_T}using internal copy" >&6; } ++fi ++ ++ ++if test "x$have_external_dbus" = "xyes"; then ++ EXTERNAL_DBUS_TRUE= ++ EXTERNAL_DBUS_FALSE='#' ++else ++ EXTERNAL_DBUS_TRUE='#' ++ EXTERNAL_DBUS_FALSE= ++fi ++ ++ ++ + ac_config_files="$ac_config_files telepathy-sharp.pc Makefile dbus-sharp/Makefile telepathy/Makefile telepathy/AssemblyInfo.cs test/Makefile" + + cat >confcache <<\_ACEOF +@@ -2768,6 +2871,13 @@ + Usually this means the macro was only invoked conditionally." >&2;} + { (exit 1); exit 1; }; } + fi ++if test -z "${EXTERNAL_DBUS_TRUE}" && test -z "${EXTERNAL_DBUS_FALSE}"; then ++ { { echo "$as_me:$LINENO: error: conditional \"EXTERNAL_DBUS\" was never defined. ++Usually this means the macro was only invoked conditionally." >&5 ++echo "$as_me: error: conditional \"EXTERNAL_DBUS\" was never defined. ++Usually this means the macro was only invoked conditionally." >&2;} ++ { (exit 1); exit 1; }; } ++fi + + : ${CONFIG_STATUS=./config.status} + ac_clean_files_save=$ac_clean_files +@@ -3355,11 +3465,15 @@ + MONO_DEPENDENCY_LIBS!$MONO_DEPENDENCY_LIBS$ac_delim + RUNTIME!$RUNTIME$ac_delim + CSC!$CSC$ac_delim ++DBUS_CFLAGS!$DBUS_CFLAGS$ac_delim ++DBUS_LIBS!$DBUS_LIBS$ac_delim ++EXTERNAL_DBUS_TRUE!$EXTERNAL_DBUS_TRUE$ac_delim ++EXTERNAL_DBUS_FALSE!$EXTERNAL_DBUS_FALSE$ac_delim + LIBOBJS!$LIBOBJS$ac_delim + LTLIBOBJS!$LTLIBOBJS$ac_delim + _ACEOF + +- if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 81; then ++ if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 85; then + break + elif $ac_last_try; then + { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5 +diff -urNad telepathy-sharp-0.0.svn.20070221/dbus-sharp/Makefile.in telepathy-sharp/dbus-sharp/Makefile.in +--- telepathy-sharp-0.0.svn.20070221/dbus-sharp/Makefile.in 2007-02-21 21:16:16.000000000 +0100 ++++ telepathy-sharp/dbus-sharp/Makefile.in 2007-02-21 21:14:03.000000000 +0100 +@@ -60,10 +60,14 @@ + AWK = @AWK@ + CSC = @CSC@ + CYGPATH_W = @CYGPATH_W@ ++DBUS_CFLAGS = @DBUS_CFLAGS@ ++DBUS_LIBS = @DBUS_LIBS@ + DEFS = @DEFS@ + ECHO_C = @ECHO_C@ + ECHO_N = @ECHO_N@ + ECHO_T = @ECHO_T@ ++EXTERNAL_DBUS_FALSE = @EXTERNAL_DBUS_FALSE@ ++EXTERNAL_DBUS_TRUE = @EXTERNAL_DBUS_TRUE@ + INSTALL_DATA = @INSTALL_DATA@ + INSTALL_PROGRAM = @INSTALL_PROGRAM@ + INSTALL_SCRIPT = @INSTALL_SCRIPT@ +@@ -132,12 +136,6 @@ + target_cpu = @target_cpu@ + target_os = @target_os@ + target_vendor = @target_vendor@ +-CSC_FLAGS = -debug -unsafe +-ASSEMBLY_NAME = NDesk.DBus +-ASSEMBLY = $(ASSEMBLY_NAME).dll +-NDesk_DBusdir = $(pkglibdir) +-NDesk_DBus_SCRIPTS = $(ASSEMBLY) +-TARGET = $(ASSEMBLY) + SOURCES = \ + Address.cs \ + AssemblyInfo.cs \ +@@ -163,8 +161,14 @@ + UnixNativeTransport.cs \ + Wrapper.cs + +-CLEANFILES = $(ASSEMBLY) $(ASSEMBLY).mdb $(ASSEMBLY).config +-PKG_REFERENCES = -r:Mono.Posix ++@EXTERNAL_DBUS_FALSE@CSC_FLAGS = -debug -unsafe ++@EXTERNAL_DBUS_FALSE@ASSEMBLY_NAME = NDesk.DBus ++@EXTERNAL_DBUS_FALSE@ASSEMBLY = $(ASSEMBLY_NAME).dll ++@EXTERNAL_DBUS_FALSE@NDesk_DBusdir = $(pkglibdir) ++@EXTERNAL_DBUS_FALSE@NDesk_DBus_SCRIPTS = $(ASSEMBLY) ++@EXTERNAL_DBUS_FALSE@TARGET = $(ASSEMBLY) ++@EXTERNAL_DBUS_FALSE@CLEANFILES = $(ASSEMBLY) $(ASSEMBLY).mdb $(ASSEMBLY).config ++@EXTERNAL_DBUS_FALSE@PKG_REFERENCES = -r:Mono.Posix + all: all-am + + .SUFFIXES: +@@ -340,10 +344,10 @@ + uninstall-am uninstall-info-am + + +-$(ASSEMBLY): $(SOURCES) +- $(CSC) -target:library -out:$@ $(CSC_FLAGS) $(SOURCES) $(PKG_REFERENCES) ++@EXTERNAL_DBUS_FALSE@$(ASSEMBLY): $(SOURCES) ++@EXTERNAL_DBUS_FALSE@ $(CSC) -target:library -out:$@ $(CSC_FLAGS) $(SOURCES) $(PKG_REFERENCES) + +-all: $(ASSEMBLY) ++@EXTERNAL_DBUS_FALSE@all: $(ASSEMBLY) + # 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 -urNad telepathy-sharp-0.0.svn.20070221/Makefile.in telepathy-sharp/Makefile.in +--- telepathy-sharp-0.0.svn.20070221/Makefile.in 2007-02-21 21:16:23.000000000 +0100 ++++ telepathy-sharp/Makefile.in 2007-02-21 21:14:10.000000000 +0100 +@@ -89,10 +89,14 @@ + AWK = @AWK@ + CSC = @CSC@ + CYGPATH_W = @CYGPATH_W@ ++DBUS_CFLAGS = @DBUS_CFLAGS@ ++DBUS_LIBS = @DBUS_LIBS@ + DEFS = @DEFS@ + ECHO_C = @ECHO_C@ + ECHO_N = @ECHO_N@ + ECHO_T = @ECHO_T@ ++EXTERNAL_DBUS_FALSE = @EXTERNAL_DBUS_FALSE@ ++EXTERNAL_DBUS_TRUE = @EXTERNAL_DBUS_TRUE@ + INSTALL_DATA = @INSTALL_DATA@ + INSTALL_PROGRAM = @INSTALL_PROGRAM@ + INSTALL_SCRIPT = @INSTALL_SCRIPT@ +diff -urNad telepathy-sharp-0.0.svn.20070221/telepathy/Makefile.in telepathy-sharp/telepathy/Makefile.in +--- telepathy-sharp-0.0.svn.20070221/telepathy/Makefile.in 2007-02-21 21:16:18.000000000 +0100 ++++ telepathy-sharp/telepathy/Makefile.in 2007-02-21 21:14:05.000000000 +0100 +@@ -60,10 +60,14 @@ + AWK = @AWK@ + CSC = @CSC@ + CYGPATH_W = @CYGPATH_W@ ++DBUS_CFLAGS = @DBUS_CFLAGS@ ++DBUS_LIBS = @DBUS_LIBS@ + DEFS = @DEFS@ + ECHO_C = @ECHO_C@ + ECHO_N = @ECHO_N@ + ECHO_T = @ECHO_T@ ++EXTERNAL_DBUS_FALSE = @EXTERNAL_DBUS_FALSE@ ++EXTERNAL_DBUS_TRUE = @EXTERNAL_DBUS_TRUE@ + INSTALL_DATA = @INSTALL_DATA@ + INSTALL_PROGRAM = @INSTALL_PROGRAM@ + INSTALL_SCRIPT = @INSTALL_SCRIPT@ +@@ -167,9 +171,10 @@ + IStreamEngine.cs + + CLEANFILES = $(ASSEMBLY) $(ASSEMBLY).mdb $(ASSEMBLY).config +-PKG_REFERENCES = \ +- -r:$(top_srcdir)/dbus-sharp/NDesk.DBus.dll ++@EXTERNAL_DBUS_FALSE@PKG_REFERENCES = \ ++@EXTERNAL_DBUS_FALSE@ -r:$(top_srcdir)/dbus-sharp/NDesk.DBus.dll + ++@EXTERNAL_DBUS_TRUE@PKG_REFERENCES = $(DBUS_LIBS) + all: all-am + + .SUFFIXES: +diff -urNad telepathy-sharp-0.0.svn.20070221/test/Makefile.in telepathy-sharp/test/Makefile.in +--- telepathy-sharp-0.0.svn.20070221/test/Makefile.in 2007-02-21 21:16:20.000000000 +0100 ++++ telepathy-sharp/test/Makefile.in 2007-02-21 21:14:07.000000000 +0100 +@@ -56,10 +56,14 @@ + AWK = @AWK@ + CSC = @CSC@ + CYGPATH_W = @CYGPATH_W@ ++DBUS_CFLAGS = @DBUS_CFLAGS@ ++DBUS_LIBS = @DBUS_LIBS@ + DEFS = @DEFS@ + ECHO_C = @ECHO_C@ + ECHO_N = @ECHO_N@ + ECHO_T = @ECHO_T@ ++EXTERNAL_DBUS_FALSE = @EXTERNAL_DBUS_FALSE@ ++EXTERNAL_DBUS_TRUE = @EXTERNAL_DBUS_TRUE@ + INSTALL_DATA = @INSTALL_DATA@ + INSTALL_PROGRAM = @INSTALL_PROGRAM@ + INSTALL_SCRIPT = @INSTALL_SCRIPT@ +@@ -133,10 +137,11 @@ + TEST_NAME = test + TEST = $(TEST_NAME).exe + TARGET = $(TEST) +-PKG_REFERENCES = \ +- -r:../dbus-sharp/NDesk.DBus.dll \ +- -r:../telepathy/INdT.Telepathy.dll ++@EXTERNAL_DBUS_FALSE@PKG_REFERENCES = \ ++@EXTERNAL_DBUS_FALSE@ -r:../dbus-sharp/NDesk.DBus.dll \ ++@EXTERNAL_DBUS_FALSE@ -r:../telepathy/INdT.Telepathy.dll + ++@EXTERNAL_DBUS_TRUE@PKG_REFERENCES = $(DBUS_LIBS) -r:../telepathy/INdT.Telepathy.dll + test_sources = Test.cs + CLEANFILES = *.exe* + all: all-am diff -urNad telepathy-sharp-0.0.svn.20060831/debian/rules telepathy-sharp-0.0.svn.20070221/debian/rules --- telepathy-sharp-0.0.svn.20060831/debian/rules 2007-02-22 22:30:46.000000000 +0100 +++ telepathy-sharp-0.0.svn.20070221/debian/rules 2007-02-22 22:21:25.000000000 +0100 @@ -4,7 +4,6 @@ include /usr/share/cdbs/1/rules/debhelper.mk include /usr/share/cdbs/1/rules/simple-patchsys.mk - common-binary-predeb-indep:: dh_clideps -d - dh_makeclilibs -V 'libtelepathy-cil (>= 0.0.svn.20060831 )' + dh_makeclilibs -V 'libtelepathy-cil (>= 0.0.svn.20061115)' diff -urNad telepathy-sharp-0.0.svn.20060831/Makefile telepathy-sharp-0.0.svn.20070221/Makefile --- telepathy-sharp-0.0.svn.20060831/Makefile 2006-09-25 20:35:47.000000000 +0200 +++ telepathy-sharp-0.0.svn.20070221/Makefile 1970-01-01 01:00:00.000000000 +0100 @@ -1,601 +0,0 @@ -# Makefile.in generated by automake 1.9.6 from Makefile.am. -# Makefile. Generated from Makefile.in by configure. - -# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005 Free Software Foundation, Inc. -# This Makefile.in is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - - - -srcdir = . -top_srcdir = . - -pkgdatadir = $(datadir)/telepathy-sharp -pkglibdir = $(libdir)/telepathy-sharp -pkgincludedir = $(includedir)/telepathy-sharp -top_builddir = . -am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -INSTALL = /usr/bin/install -c -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 = i686-pc-linux-gnu -host_triplet = i686-pc-linux-gnu -target_triplet = i686-pc-linux-gnu -DIST_COMMON = README $(am__configure_deps) $(srcdir)/Makefile.am \ - $(srcdir)/Makefile.in $(srcdir)/telepathy-sharp.pc.in \ - $(top_srcdir)/configure AUTHORS COPYING ChangeLog INSTALL NEWS \ - TODO config.guess config.sub install-sh missing -subdir = . -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) -am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \ - configure.lineno configure.status.lineno -mkinstalldirs = $(install_sh) -d -CONFIG_CLEAN_FILES = telepathy-sharp.pc -SOURCES = -DIST_SOURCES = -RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ - html-recursive info-recursive install-data-recursive \ - install-exec-recursive install-info-recursive \ - install-recursive installcheck-recursive installdirs-recursive \ - pdf-recursive ps-recursive uninstall-info-recursive \ - uninstall-recursive -am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; -am__vpath_adj = case $$p in \ - $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ - *) f=$$p;; \ - esac; -am__strip_dir = `echo $$p | sed -e 's|^.*/||'`; -am__installdirs = "$(DESTDIR)$(pkgconfigdir)" -pkgconfigDATA_INSTALL = $(INSTALL_DATA) -DATA = $(pkgconfig_DATA) -ETAGS = etags -CTAGS = ctags -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) -distdir = $(PACKAGE)-$(VERSION) -top_distdir = $(distdir) -am__remove_distdir = \ - { test ! -d $(distdir) \ - || { find $(distdir) -type d ! -perm -200 -exec chmod u+w {} ';' \ - && rm -fr $(distdir); }; } -DIST_ARCHIVES = $(distdir).tar.gz -GZIP_ENV = --best -distuninstallcheck_listfiles = find . -type f -print -distcleancheck_listfiles = find . -type f -print -ACLOCAL = ${SHELL} /home/giskard/tmp/telepathy-sharp-0.0.svn.20060831/missing --run aclocal-1.9 -AMTAR = ${SHELL} /home/giskard/tmp/telepathy-sharp-0.0.svn.20060831/missing --run tar -ASM_VERSION = 0.1.0.* -AUTOCONF = ${SHELL} /home/giskard/tmp/telepathy-sharp-0.0.svn.20060831/missing --run autoconf -AUTOHEADER = ${SHELL} /home/giskard/tmp/telepathy-sharp-0.0.svn.20060831/missing --run autoheader -AUTOMAKE = ${SHELL} /home/giskard/tmp/telepathy-sharp-0.0.svn.20060831/missing --run automake-1.9 -AWK = gawk -CYGPATH_W = echo -DEFS = -DPACKAGE_NAME=\"\" -DPACKAGE_TARNAME=\"\" -DPACKAGE_VERSION=\"\" -DPACKAGE_STRING=\"\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE=\"telepathy-sharp\" -DVERSION=\"0.1.0\" -ECHO_C = -ECHO_N = -n -ECHO_T = -INSTALL_DATA = ${INSTALL} -m 644 -INSTALL_PROGRAM = ${INSTALL} -INSTALL_SCRIPT = ${INSTALL} -INSTALL_STRIP_PROGRAM = ${SHELL} $(install_sh) -c -s -LIBOBJS = -LIBS = -LTLIBOBJS = -MAINT = # -MAINTAINER_MODE_FALSE = -MAINTAINER_MODE_TRUE = # -MAKEINFO = ${SHELL} /home/giskard/tmp/telepathy-sharp-0.0.svn.20060831/missing --run makeinfo -MCS = /usr/bin/mcs -MONO = /usr/bin/mono -PACKAGE = telepathy-sharp -PACKAGE_BUGREPORT = -PACKAGE_NAME = -PACKAGE_STRING = -PACKAGE_TARNAME = -PACKAGE_VERSION = -PATH_SEPARATOR = : -PKG_CONFIG = /usr/bin/pkg-config -SET_MAKE = -SHELL = /bin/sh -STRIP = -VERSION = 0.1.0 -am__leading_dot = . -am__tar = ${AMTAR} chof - "$$tardir" -am__untar = ${AMTAR} xf - -bindir = ${exec_prefix}/bin -build = i686-pc-linux-gnu -build_alias = -build_cpu = i686 -build_os = linux-gnu -build_vendor = pc -datadir = ${datarootdir} -datarootdir = ${prefix}/share -docdir = ${datarootdir}/doc/${PACKAGE} -dvidir = ${docdir} -exec_prefix = ${prefix} -host = i686-pc-linux-gnu -host_alias = -host_cpu = i686 -host_os = linux-gnu -host_vendor = pc -htmldir = ${docdir} -includedir = ${prefix}/include -infodir = ${datarootdir}/info -install_sh = /home/giskard/tmp/telepathy-sharp-0.0.svn.20060831/install-sh -libdir = ${exec_prefix}/lib -libexecdir = ${exec_prefix}/libexec -localedir = ${datarootdir}/locale -localstatedir = ${prefix}/var -mandir = ${datarootdir}/man -mkdir_p = mkdir -p -- -oldincludedir = /usr/include -pdfdir = ${docdir} -prefix = /usr/local -program_transform_name = s,x,x, -psdir = ${docdir} -sbindir = ${exec_prefix}/sbin -sharedstatedir = ${prefix}/com -sysconfdir = ${prefix}/etc -target = i686-pc-linux-gnu -target_alias = -target_cpu = i686 -target_os = linux-gnu -target_vendor = pc -SUBDIRS = dbus-sharp telepathy test -DIST_SUBDIRS = \ - dbus-sharp \ - telepathy - -EXTRA_DIST = -pkgconfigdir = $(libdir)/pkgconfig -pkgconfig_DATA = telepathy-sharp.pc -all: all-recursive - -.SUFFIXES: -am--refresh: - @: -$(srcdir)/Makefile.in: # $(srcdir)/Makefile.am $(am__configure_deps) - @for dep in $?; do \ - case '$(am__configure_deps)' in \ - *$$dep*) \ - echo ' cd $(srcdir) && $(AUTOMAKE) --gnu '; \ - cd $(srcdir) && $(AUTOMAKE) --gnu \ - && exit 0; \ - exit 1;; \ - esac; \ - done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu Makefile'; \ - cd $(top_srcdir) && \ - $(AUTOMAKE) --gnu Makefile -.PRECIOUS: Makefile -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status - @case '$?' in \ - *config.status*) \ - echo ' $(SHELL) ./config.status'; \ - $(SHELL) ./config.status;; \ - *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \ - esac; - -$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) - $(SHELL) ./config.status --recheck - -$(top_srcdir)/configure: # $(am__configure_deps) - cd $(srcdir) && $(AUTOCONF) -$(ACLOCAL_M4): # $(am__aclocal_m4_deps) - cd $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS) -telepathy-sharp.pc: $(top_builddir)/config.status $(srcdir)/telepathy-sharp.pc.in - cd $(top_builddir) && $(SHELL) ./config.status $@ -uninstall-info-am: -install-pkgconfigDATA: $(pkgconfig_DATA) - @$(NORMAL_INSTALL) - test -z "$(pkgconfigdir)" || $(mkdir_p) "$(DESTDIR)$(pkgconfigdir)" - @list='$(pkgconfig_DATA)'; for p in $$list; do \ - if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ - f=$(am__strip_dir) \ - echo " $(pkgconfigDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(pkgconfigdir)/$$f'"; \ - $(pkgconfigDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(pkgconfigdir)/$$f"; \ - done - -uninstall-pkgconfigDATA: - @$(NORMAL_UNINSTALL) - @list='$(pkgconfig_DATA)'; for p in $$list; do \ - f=$(am__strip_dir) \ - echo " rm -f '$(DESTDIR)$(pkgconfigdir)/$$f'"; \ - rm -f "$(DESTDIR)$(pkgconfigdir)/$$f"; \ - done - -# This directory's subdirectories are mostly independent; you can cd -# into them and run `make' without going through this Makefile. -# To change the values of `make' variables: instead of editing Makefiles, -# (1) if the variable is set in `config.status', edit `config.status' -# (which will cause the Makefiles to be regenerated when you run `make'); -# (2) otherwise, pass the desired values on the `make' command line. -$(RECURSIVE_TARGETS): - @failcom='exit 1'; \ - for f in x $$MAKEFLAGS; do \ - case $$f in \ - *=* | --[!k]*);; \ - *k*) failcom='fail=yes';; \ - esac; \ - done; \ - dot_seen=no; \ - target=`echo $@ | sed s/-recursive//`; \ - list='$(SUBDIRS)'; for subdir in $$list; do \ - echo "Making $$target in $$subdir"; \ - if test "$$subdir" = "."; then \ - dot_seen=yes; \ - local_target="$$target-am"; \ - else \ - local_target="$$target"; \ - fi; \ - (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ - || eval $$failcom; \ - done; \ - if test "$$dot_seen" = "no"; then \ - $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ - fi; test -z "$$fail" - -mostlyclean-recursive clean-recursive distclean-recursive \ -maintainer-clean-recursive: - @failcom='exit 1'; \ - for f in x $$MAKEFLAGS; do \ - case $$f in \ - *=* | --[!k]*);; \ - *k*) failcom='fail=yes';; \ - esac; \ - done; \ - dot_seen=no; \ - case "$@" in \ - distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ - *) list='$(SUBDIRS)' ;; \ - esac; \ - rev=''; for subdir in $$list; do \ - if test "$$subdir" = "."; then :; else \ - rev="$$subdir $$rev"; \ - fi; \ - done; \ - rev="$$rev ."; \ - target=`echo $@ | sed s/-recursive//`; \ - for subdir in $$rev; do \ - echo "Making $$target in $$subdir"; \ - if test "$$subdir" = "."; then \ - local_target="$$target-am"; \ - else \ - local_target="$$target"; \ - fi; \ - (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ - || eval $$failcom; \ - done && test -z "$$fail" -tags-recursive: - list='$(SUBDIRS)'; for subdir in $$list; do \ - test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ - done -ctags-recursive: - list='$(SUBDIRS)'; for subdir in $$list; do \ - test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ - done - -ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - mkid -fID $$unique -tags: TAGS - -TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ - include_option=--etags-include; \ - empty_fix=.; \ - else \ - include_option=--include; \ - empty_fix=; \ - fi; \ - list='$(SUBDIRS)'; for subdir in $$list; do \ - if test "$$subdir" = .; then :; else \ - test ! -f $$subdir/TAGS || \ - tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \ - fi; \ - done; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ - test -n "$$unique" || unique=$$empty_fix; \ - $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - $$tags $$unique; \ - fi -ctags: CTAGS -CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - test -z "$(CTAGS_ARGS)$$tags$$unique" \ - || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ - $$tags $$unique - -GTAGS: - here=`$(am__cd) $(top_builddir) && pwd` \ - && cd $(top_srcdir) \ - && gtags -i $(GTAGS_ARGS) $$here - -distclean-tags: - -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags - -distdir: $(DISTFILES) - $(am__remove_distdir) - mkdir $(distdir) - $(mkdir_p) $(distdir)/. $(distdir)/telepathy - @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ - list='$(DISTFILES)'; for file in $$list; do \ - case $$file in \ - $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ - $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ - esac; \ - if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test "$$dir" != "$$file" && test "$$dir" != "."; then \ - dir="/$$dir"; \ - $(mkdir_p) "$(distdir)$$dir"; \ - else \ - dir=''; \ - fi; \ - if test -d $$d/$$file; then \ - if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ - fi; \ - cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ - else \ - test -f $(distdir)/$$file \ - || cp -p $$d/$$file $(distdir)/$$file \ - || exit 1; \ - fi; \ - done - list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ - if test "$$subdir" = .; then :; else \ - test -d "$(distdir)/$$subdir" \ - || $(mkdir_p) "$(distdir)/$$subdir" \ - || exit 1; \ - distdir=`$(am__cd) $(distdir) && pwd`; \ - top_distdir=`$(am__cd) $(top_distdir) && pwd`; \ - (cd $$subdir && \ - $(MAKE) $(AM_MAKEFLAGS) \ - top_distdir="$$top_distdir" \ - distdir="$$distdir/$$subdir" \ - distdir) \ - || exit 1; \ - fi; \ - done - -find $(distdir) -type d ! -perm -777 -exec chmod a+rwx {} \; -o \ - ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \ - ! -type d ! -perm -400 -exec chmod a+r {} \; -o \ - ! -type d ! -perm -444 -exec $(SHELL) $(install_sh) -c -m a+r {} {} \; \ - || chmod -R a+r $(distdir) -dist-gzip: distdir - tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz - $(am__remove_distdir) - -dist-bzip2: distdir - tardir=$(distdir) && $(am__tar) | bzip2 -9 -c >$(distdir).tar.bz2 - $(am__remove_distdir) - -dist-tarZ: distdir - tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z - $(am__remove_distdir) - -dist-shar: distdir - shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz - $(am__remove_distdir) - -dist-zip: distdir - -rm -f $(distdir).zip - zip -rq $(distdir).zip $(distdir) - $(am__remove_distdir) - -dist dist-all: distdir - tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz - $(am__remove_distdir) - -# This target untars the dist file and tries a VPATH configuration. Then -# it guarantees that the distribution is self-contained by making another -# tarfile. -distcheck: dist - case '$(DIST_ARCHIVES)' in \ - *.tar.gz*) \ - GZIP=$(GZIP_ENV) gunzip -c $(distdir).tar.gz | $(am__untar) ;;\ - *.tar.bz2*) \ - bunzip2 -c $(distdir).tar.bz2 | $(am__untar) ;;\ - *.tar.Z*) \ - uncompress -c $(distdir).tar.Z | $(am__untar) ;;\ - *.shar.gz*) \ - GZIP=$(GZIP_ENV) gunzip -c $(distdir).shar.gz | unshar ;;\ - *.zip*) \ - unzip $(distdir).zip ;;\ - esac - chmod -R a-w $(distdir); chmod a+w $(distdir) - mkdir $(distdir)/_build - mkdir $(distdir)/_inst - chmod a-w $(distdir) - dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \ - && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \ - && cd $(distdir)/_build \ - && ../configure --srcdir=.. --prefix="$$dc_install_base" \ - $(DISTCHECK_CONFIGURE_FLAGS) \ - && $(MAKE) $(AM_MAKEFLAGS) \ - && $(MAKE) $(AM_MAKEFLAGS) dvi \ - && $(MAKE) $(AM_MAKEFLAGS) check \ - && $(MAKE) $(AM_MAKEFLAGS) install \ - && $(MAKE) $(AM_MAKEFLAGS) installcheck \ - && $(MAKE) $(AM_MAKEFLAGS) uninstall \ - && $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \ - distuninstallcheck \ - && chmod -R a-w "$$dc_install_base" \ - && ({ \ - (cd ../.. && umask 077 && mkdir "$$dc_destdir") \ - && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \ - && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \ - && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \ - distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \ - } || { rm -rf "$$dc_destdir"; exit 1; }) \ - && rm -rf "$$dc_destdir" \ - && $(MAKE) $(AM_MAKEFLAGS) dist \ - && rm -rf $(DIST_ARCHIVES) \ - && $(MAKE) $(AM_MAKEFLAGS) distcleancheck - $(am__remove_distdir) - @(echo "$(distdir) archives ready for distribution: "; \ - list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \ - sed -e '1{h;s/./=/g;p;x;}' -e '$${p;x;}' -distuninstallcheck: - @cd $(distuninstallcheck_dir) \ - && test `$(distuninstallcheck_listfiles) | wc -l` -le 1 \ - || { echo "ERROR: files left after uninstall:" ; \ - if test -n "$(DESTDIR)"; then \ - echo " (check DESTDIR support)"; \ - fi ; \ - $(distuninstallcheck_listfiles) ; \ - exit 1; } >&2 -distcleancheck: distclean - @if test '$(srcdir)' = . ; then \ - echo "ERROR: distcleancheck can only run from a VPATH build" ; \ - exit 1 ; \ - fi - @test `$(distcleancheck_listfiles) | wc -l` -eq 0 \ - || { echo "ERROR: files left in build directory after distclean:" ; \ - $(distcleancheck_listfiles) ; \ - exit 1; } >&2 -check-am: all-am -check: check-recursive -all-am: Makefile $(DATA) -installdirs: installdirs-recursive -installdirs-am: - for dir in "$(DESTDIR)$(pkgconfigdir)"; do \ - test -z "$$dir" || $(mkdir_p) "$$dir"; \ - done -install: install-recursive -install-exec: install-exec-recursive -install-data: install-data-recursive -uninstall: uninstall-recursive - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am - -installcheck: installcheck-recursive -install-strip: - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - `test -z '$(STRIP)' || \ - echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install -mostlyclean-generic: - -clean-generic: - -distclean-generic: - -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) - -maintainer-clean-generic: - @echo "This command is intended for maintainers to use" - @echo "it deletes files that may require special tools to rebuild." -clean: clean-recursive - -clean-am: clean-generic mostlyclean-am - -distclean: distclean-recursive - -rm -f $(am__CONFIG_DISTCLEAN_FILES) - -rm -f Makefile -distclean-am: clean-am distclean-generic distclean-tags - -dvi: dvi-recursive - -dvi-am: - -html: html-recursive - -info: info-recursive - -info-am: - -install-data-am: install-pkgconfigDATA - -install-exec-am: - -install-info: install-info-recursive - -install-man: - -installcheck-am: - -maintainer-clean: maintainer-clean-recursive - -rm -f $(am__CONFIG_DISTCLEAN_FILES) - -rm -rf $(top_srcdir)/autom4te.cache - -rm -f Makefile -maintainer-clean-am: distclean-am maintainer-clean-generic - -mostlyclean: mostlyclean-recursive - -mostlyclean-am: mostlyclean-generic - -pdf: pdf-recursive - -pdf-am: - -ps: ps-recursive - -ps-am: - -uninstall-am: uninstall-info-am uninstall-pkgconfigDATA - -uninstall-info: uninstall-info-recursive - -.PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am am--refresh check \ - check-am clean clean-generic clean-recursive ctags \ - ctags-recursive dist dist-all dist-bzip2 dist-gzip dist-shar \ - dist-tarZ dist-zip distcheck distclean distclean-generic \ - distclean-recursive distclean-tags distcleancheck distdir \ - distuninstallcheck dvi dvi-am html html-am info info-am \ - install install-am install-data install-data-am install-exec \ - install-exec-am install-info install-info-am install-man \ - install-pkgconfigDATA install-strip installcheck \ - installcheck-am installdirs installdirs-am maintainer-clean \ - maintainer-clean-generic maintainer-clean-recursive \ - mostlyclean mostlyclean-generic mostlyclean-recursive pdf \ - pdf-am ps ps-am tags tags-recursive uninstall uninstall-am \ - uninstall-info-am uninstall-pkgconfigDATA - -# 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 -urNad telepathy-sharp-0.0.svn.20060831/Makefile.am telepathy-sharp-0.0.svn.20070221/Makefile.am --- telepathy-sharp-0.0.svn.20060831/Makefile.am 2006-09-25 20:34:04.000000000 +0200 +++ telepathy-sharp-0.0.svn.20070221/Makefile.am 2007-02-21 19:10:38.000000000 +0100 @@ -1,10 +1,12 @@ SUBDIRS = dbus-sharp telepathy test -DIST_SUBDIRS = \ - dbus-sharp \ - telepathy +EXTRA_DIST = \ + ChangeLog -EXTRA_DIST = +DIST_SUBDIRS = \ + dbus-sharp \ + telepathy \ + test pkgconfigdir = $(libdir)/pkgconfig pkgconfig_DATA= telepathy-sharp.pc diff -urNad telepathy-sharp-0.0.svn.20060831/Makefile.in telepathy-sharp-0.0.svn.20070221/Makefile.in --- telepathy-sharp-0.0.svn.20060831/Makefile.in 2006-09-25 20:34:15.000000000 +0200 +++ telepathy-sharp-0.0.svn.20070221/Makefile.in 2007-02-21 21:16:23.000000000 +0100 @@ -87,6 +87,7 @@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ +CSC = @CSC@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ ECHO_C = @ECHO_C@ @@ -103,8 +104,8 @@ MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ MAKEINFO = @MAKEINFO@ -MCS = @MCS@ -MONO = @MONO@ +MONO_DEPENDENCY_CFLAGS = @MONO_DEPENDENCY_CFLAGS@ +MONO_DEPENDENCY_LIBS = @MONO_DEPENDENCY_LIBS@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ @@ -113,6 +114,7 @@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PKG_CONFIG = @PKG_CONFIG@ +RUNTIME = @RUNTIME@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ @@ -160,11 +162,14 @@ target_os = @target_os@ target_vendor = @target_vendor@ SUBDIRS = dbus-sharp telepathy test +EXTRA_DIST = \ + ChangeLog + DIST_SUBDIRS = \ - dbus-sharp \ - telepathy + dbus-sharp \ + telepathy \ + test -EXTRA_DIST = pkgconfigdir = $(libdir)/pkgconfig pkgconfig_DATA = telepathy-sharp.pc all: all-recursive diff -urNad telepathy-sharp-0.0.svn.20060831/README telepathy-sharp-0.0.svn.20070221/README --- telepathy-sharp-0.0.svn.20060831/README 2006-09-25 19:41:10.000000000 +0200 +++ telepathy-sharp-0.0.svn.20070221/README 2007-02-21 19:10:38.000000000 +0100 @@ -1,4 +1,21 @@ -Welcome to the INdT Telepathy .NET library -========================================== += README file for Telepathy# = +== Obtaining the sources from Subversion == +To obtain the current source code of QtTelepathy, execute the following +command (requires the Subversion version control system client): + + $ svn co https://svn.sourceforge.net/svnroot/tapioca-voip/trunk/telepathy-sharp + +Once you have checked out a working copy as described above, you can update it +to the newest available sources with a mere: + + $ svn up + +== Building == + +To build the library, first make sure you have Qt4, and the CMake +build system installed, and then execute the following commands: + + $ ./autogen + $ make diff -urNad telepathy-sharp-0.0.svn.20060831/telepathy/AssemblyInfo.cs.in telepathy-sharp-0.0.svn.20070221/telepathy/AssemblyInfo.cs.in --- telepathy-sharp-0.0.svn.20060831/telepathy/AssemblyInfo.cs.in 2006-09-25 19:41:02.000000000 +0200 +++ telepathy-sharp-0.0.svn.20070221/telepathy/AssemblyInfo.cs.in 2007-02-21 19:10:37.000000000 +0100 @@ -1,32 +1,8 @@ using System.Reflection; using System.Runtime.CompilerServices; -// Information about this assembly is defined by the following -// attributes. -// -// change them to the information which is associated with the assembly -// you compile. - -[assembly: AssemblyTitle("")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("INdT")] -[assembly: AssemblyProduct("")] -[assembly: AssemblyCopyright("INdT Recife")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// The assembly version has following format : -// -// Major.Minor.Build.Revision -// -// You can specify all values by your own or you can build default build and revision -// numbers with the '*' character (the default): - -[assembly:AssemblyVersion("@ASM_VERSION@")] - -// The following attributes specify the key for the sign of your assembly. See the -// .NET Framework documentation for more information about signing. -// This is not required, if you don't want signing let these attributes like they're. -[assembly: AssemblyDelaySign(false)] -//[assembly: AssemblyKeyFileAttribute("@PACKAGE@.snk")] +[assembly: AssemblyVersion("@ASM_VERSION@")] +[assembly: AssemblyTitle("Telepathy-Sharp")] +[assembly: AssemblyDescription("Telepathy C# implementation")] +[assembly: AssemblyCopyright("Copyright (C) INdT")] +[assembly: AssemblyCompany ("INdT")] diff -urNad telepathy-sharp-0.0.svn.20060831/telepathy/Error.cs telepathy-sharp-0.0.svn.20070221/telepathy/Error.cs --- telepathy-sharp-0.0.svn.20060831/telepathy/Error.cs 2006-09-25 19:41:02.000000000 +0200 +++ telepathy-sharp-0.0.svn.20070221/telepathy/Error.cs 2007-02-21 19:10:37.000000000 +0100 @@ -1,3 +1,34 @@ +/*************************************************************************** + * Error.cs + * + * Copyright (C) 2006 INdT + * Written by + * Andre Moreira Magalhaes + * Kenneth Christiansen + * Renato Araujo Oliveira Filho + ****************************************************************************/ + +/* THIS FILE IS LICENSED UNDER THE MIT LICENSE AS OUTLINED IMMEDIATELY BELOW: + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + using System; using NDesk.DBus; diff -urNad telepathy-sharp-0.0.svn.20060831/telepathy/IChannelContactList.cs telepathy-sharp-0.0.svn.20070221/telepathy/IChannelContactList.cs --- telepathy-sharp-0.0.svn.20060831/telepathy/IChannelContactList.cs 2006-09-25 19:41:02.000000000 +0200 +++ telepathy-sharp-0.0.svn.20070221/telepathy/IChannelContactList.cs 2007-02-21 19:10:37.000000000 +0100 @@ -1,3 +1,34 @@ +/*************************************************************************** + * IChannelContactList.cs + * + * Copyright (C) 2006 INdT + * Written by + * Andre Moreira Magalhaes + * Kenneth Christiansen + * Renato Araujo Oliveira Filho + ****************************************************************************/ + +/* THIS FILE IS LICENSED UNDER THE MIT LICENSE AS OUTLINED IMMEDIATELY BELOW: + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + using System; using NDesk.DBus; using org.freedesktop.DBus; diff -urNad telepathy-sharp-0.0.svn.20060831/telepathy/IChannelContactSearch.cs telepathy-sharp-0.0.svn.20070221/telepathy/IChannelContactSearch.cs --- telepathy-sharp-0.0.svn.20060831/telepathy/IChannelContactSearch.cs 2006-09-25 19:41:02.000000000 +0200 +++ telepathy-sharp-0.0.svn.20070221/telepathy/IChannelContactSearch.cs 2007-02-21 19:10:37.000000000 +0100 @@ -1,3 +1,34 @@ +/*************************************************************************** + * IChannelContactSearch.cs + * + * Copyright (C) 2006 INdT + * Written by + * Andre Moreira Magalhaes + * Kenneth Christiansen + * Renato Araujo Oliveira Filho + ****************************************************************************/ + +/* THIS FILE IS LICENSED UNDER THE MIT LICENSE AS OUTLINED IMMEDIATELY BELOW: + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + using System; using System.Collections.Generic; using NDesk.DBus; diff -urNad telepathy-sharp-0.0.svn.20060831/telepathy/IChannel.cs telepathy-sharp-0.0.svn.20070221/telepathy/IChannel.cs --- telepathy-sharp-0.0.svn.20060831/telepathy/IChannel.cs 2006-09-25 19:41:02.000000000 +0200 +++ telepathy-sharp-0.0.svn.20070221/telepathy/IChannel.cs 2007-02-21 19:10:37.000000000 +0100 @@ -1,3 +1,34 @@ +/*************************************************************************** + * IChannel.cs + * + * Copyright (C) 2006 INdT + * Written by + * Andre Moreira Magalhaes + * Kenneth Christiansen + * Renato Araujo Oliveira Filho + ****************************************************************************/ + +/* THIS FILE IS LICENSED UNDER THE MIT LICENSE AS OUTLINED IMMEDIATELY BELOW: + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + using System; using NDesk.DBus; using org.freedesktop.DBus; diff -urNad telepathy-sharp-0.0.svn.20060831/telepathy/IChannelDTMF.cs telepathy-sharp-0.0.svn.20070221/telepathy/IChannelDTMF.cs --- telepathy-sharp-0.0.svn.20060831/telepathy/IChannelDTMF.cs 2006-09-25 19:41:02.000000000 +0200 +++ telepathy-sharp-0.0.svn.20070221/telepathy/IChannelDTMF.cs 2007-02-21 19:10:37.000000000 +0100 @@ -1,3 +1,34 @@ +/*************************************************************************** + * IChannelDTMF.cs + * + * Copyright (C) 2006 INdT + * Written by + * Andre Moreira Magalhaes + * Kenneth Christiansen + * Renato Araujo Oliveira Filho + ****************************************************************************/ + +/* THIS FILE IS LICENSED UNDER THE MIT LICENSE AS OUTLINED IMMEDIATELY BELOW: + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + using System; using NDesk.DBus; using org.freedesktop.DBus; diff -urNad telepathy-sharp-0.0.svn.20060831/telepathy/IChannelGroup.cs telepathy-sharp-0.0.svn.20070221/telepathy/IChannelGroup.cs --- telepathy-sharp-0.0.svn.20060831/telepathy/IChannelGroup.cs 2006-09-25 19:41:02.000000000 +0200 +++ telepathy-sharp-0.0.svn.20070221/telepathy/IChannelGroup.cs 2007-02-21 19:10:37.000000000 +0100 @@ -1,3 +1,34 @@ +/*************************************************************************** + * IChannelGroup.cs + * + * Copyright (C) 2006 INdT + * Written by + * Andre Moreira Magalhaes + * Kenneth Christiansen + * Renato Araujo Oliveira Filho + ****************************************************************************/ + +/* THIS FILE IS LICENSED UNDER THE MIT LICENSE AS OUTLINED IMMEDIATELY BELOW: + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + using System; using NDesk.DBus; using org.freedesktop.DBus; diff -urNad telepathy-sharp-0.0.svn.20060831/telepathy/IChannelHold.cs telepathy-sharp-0.0.svn.20070221/telepathy/IChannelHold.cs --- telepathy-sharp-0.0.svn.20060831/telepathy/IChannelHold.cs 2006-09-25 19:41:02.000000000 +0200 +++ telepathy-sharp-0.0.svn.20070221/telepathy/IChannelHold.cs 2007-02-21 19:10:37.000000000 +0100 @@ -1,3 +1,34 @@ +/*************************************************************************** + * IChannelHold.cs + * + * Copyright (C) 2006 INdT + * Written by + * Andre Moreira Magalhaes + * Kenneth Christiansen + * Renato Araujo Oliveira Filho + ****************************************************************************/ + +/* THIS FILE IS LICENSED UNDER THE MIT LICENSE AS OUTLINED IMMEDIATELY BELOW: + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + using System; using NDesk.DBus; using org.freedesktop.DBus; diff -urNad telepathy-sharp-0.0.svn.20060831/telepathy/IChannelPassword.cs telepathy-sharp-0.0.svn.20070221/telepathy/IChannelPassword.cs --- telepathy-sharp-0.0.svn.20060831/telepathy/IChannelPassword.cs 2006-09-25 19:41:02.000000000 +0200 +++ telepathy-sharp-0.0.svn.20070221/telepathy/IChannelPassword.cs 2007-02-21 19:10:37.000000000 +0100 @@ -1,3 +1,34 @@ +/*************************************************************************** + * IChannelPassword.cs + * + * Copyright (C) 2006 INdT + * Written by + * Andre Moreira Magalhaes + * Kenneth Christiansen + * Renato Araujo Oliveira Filho + ****************************************************************************/ + +/* THIS FILE IS LICENSED UNDER THE MIT LICENSE AS OUTLINED IMMEDIATELY BELOW: + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + using System; using NDesk.DBus; using org.freedesktop.DBus; diff -urNad telepathy-sharp-0.0.svn.20060831/telepathy/IChannelRoomList.cs telepathy-sharp-0.0.svn.20070221/telepathy/IChannelRoomList.cs --- telepathy-sharp-0.0.svn.20060831/telepathy/IChannelRoomList.cs 2006-09-25 19:41:02.000000000 +0200 +++ telepathy-sharp-0.0.svn.20070221/telepathy/IChannelRoomList.cs 2007-02-21 19:10:37.000000000 +0100 @@ -1,3 +1,34 @@ +/*************************************************************************** + * IChannelRoomList.cs + * + * Copyright (C) 2006 INdT + * Written by + * Andre Moreira Magalhaes + * Kenneth Christiansen + * Renato Araujo Oliveira Filho + ****************************************************************************/ + +/* THIS FILE IS LICENSED UNDER THE MIT LICENSE AS OUTLINED IMMEDIATELY BELOW: + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + using System; using System.Collections.Generic; using NDesk.DBus; @@ -11,7 +42,7 @@ public struct RoomInfo { public uint Handle; - public ChannelType ChannelType; + public string ChannelType; public IDictionary Options; } diff -urNad telepathy-sharp-0.0.svn.20060831/telepathy/IChannelStreamedMedia.cs telepathy-sharp-0.0.svn.20070221/telepathy/IChannelStreamedMedia.cs --- telepathy-sharp-0.0.svn.20060831/telepathy/IChannelStreamedMedia.cs 2006-09-25 19:41:02.000000000 +0200 +++ telepathy-sharp-0.0.svn.20070221/telepathy/IChannelStreamedMedia.cs 2007-02-21 19:10:37.000000000 +0100 @@ -1,3 +1,34 @@ +/*************************************************************************** + * IChannelStreamedMedia.cs + * + * Copyright (C) 2006 INdT + * Written by + * Andre Moreira Magalhaes + * Kenneth Christiansen + * Renato Araujo Oliveira Filho + ****************************************************************************/ + +/* THIS FILE IS LICENSED UNDER THE MIT LICENSE AS OUTLINED IMMEDIATELY BELOW: + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + using System; using NDesk.DBus; diff -urNad telepathy-sharp-0.0.svn.20060831/telepathy/IChannelText.cs telepathy-sharp-0.0.svn.20070221/telepathy/IChannelText.cs --- telepathy-sharp-0.0.svn.20060831/telepathy/IChannelText.cs 2006-09-25 19:41:02.000000000 +0200 +++ telepathy-sharp-0.0.svn.20070221/telepathy/IChannelText.cs 2007-02-21 19:10:37.000000000 +0100 @@ -1,3 +1,34 @@ +/*************************************************************************** + * IChannelText.cs + * + * Copyright (C) 2006 INdT + * Written by + * Andre Moreira Magalhaes + * Kenneth Christiansen + * Renato Araujo Oliveira Filho + ****************************************************************************/ + +/* THIS FILE IS LICENSED UNDER THE MIT LICENSE AS OUTLINED IMMEDIATELY BELOW: + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + using System; using NDesk.DBus; using org.freedesktop.DBus; diff -urNad telepathy-sharp-0.0.svn.20060831/telepathy/IChannelTransfer.cs telepathy-sharp-0.0.svn.20070221/telepathy/IChannelTransfer.cs --- telepathy-sharp-0.0.svn.20060831/telepathy/IChannelTransfer.cs 2006-09-25 19:41:02.000000000 +0200 +++ telepathy-sharp-0.0.svn.20070221/telepathy/IChannelTransfer.cs 2007-02-21 19:10:37.000000000 +0100 @@ -1,3 +1,34 @@ +/*************************************************************************** + * IChannelTransfer.cs + * + * Copyright (C) 2006 INdT + * Written by + * Andre Moreira Magalhaes + * Kenneth Christiansen + * Renato Araujo Oliveira Filho + ****************************************************************************/ + +/* THIS FILE IS LICENSED UNDER THE MIT LICENSE AS OUTLINED IMMEDIATELY BELOW: + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + using System; using NDesk.DBus; using org.freedesktop.DBus; diff -urNad telepathy-sharp-0.0.svn.20060831/telepathy/IConnectionAliasing.cs telepathy-sharp-0.0.svn.20070221/telepathy/IConnectionAliasing.cs --- telepathy-sharp-0.0.svn.20060831/telepathy/IConnectionAliasing.cs 2006-09-25 19:41:02.000000000 +0200 +++ telepathy-sharp-0.0.svn.20070221/telepathy/IConnectionAliasing.cs 2007-02-21 19:10:37.000000000 +0100 @@ -1,3 +1,34 @@ +/*************************************************************************** + * IConnectionAliasing.cs + * + * Copyright (C) 2006 INdT + * Written by + * Andre Moreira Magalhaes + * Kenneth Christiansen + * Renato Araujo Oliveira Filho + ****************************************************************************/ + +/* THIS FILE IS LICENSED UNDER THE MIT LICENSE AS OUTLINED IMMEDIATELY BELOW: + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + using System; using System.Collections.Generic; using org.freedesktop.DBus; @@ -20,6 +51,6 @@ uint GetAliasFlags (); string[] RequestAliases (uint[] contacts); - void SetAliases (IDictionary[] aliases); + void SetAliases (IDictionary aliases); } } diff -urNad telepathy-sharp-0.0.svn.20060831/telepathy/IConnectionAvatars.cs telepathy-sharp-0.0.svn.20070221/telepathy/IConnectionAvatars.cs --- telepathy-sharp-0.0.svn.20060831/telepathy/IConnectionAvatars.cs 2006-09-25 19:41:02.000000000 +0200 +++ telepathy-sharp-0.0.svn.20070221/telepathy/IConnectionAvatars.cs 2007-02-21 19:10:37.000000000 +0100 @@ -1,3 +1,34 @@ +/*************************************************************************** + * IConnectionAvatars.cs + * + * Copyright (C) 2006 INdT + * Written by + * Andre Moreira Magalhaes + * Kenneth Christiansen + * Renato Araujo Oliveira Filho + ****************************************************************************/ + +/* THIS FILE IS LICENSED UNDER THE MIT LICENSE AS OUTLINED IMMEDIATELY BELOW: + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + using System; using NDesk.DBus; using org.freedesktop.DBus; diff -urNad telepathy-sharp-0.0.svn.20060831/telepathy/IConnectionCapabilities.cs telepathy-sharp-0.0.svn.20070221/telepathy/IConnectionCapabilities.cs --- telepathy-sharp-0.0.svn.20060831/telepathy/IConnectionCapabilities.cs 2006-09-25 19:41:02.000000000 +0200 +++ telepathy-sharp-0.0.svn.20070221/telepathy/IConnectionCapabilities.cs 2007-02-21 19:10:37.000000000 +0100 @@ -1,3 +1,34 @@ +/*************************************************************************** + * IConnectionCapabilities.cs + * + * Copyright (C) 2006 INdT + * Written by + * Andre Moreira Magalhaes + * Kenneth Christiansen + * Renato Araujo Oliveira Filho + ****************************************************************************/ + +/* THIS FILE IS LICENSED UNDER THE MIT LICENSE AS OUTLINED IMMEDIATELY BELOW: + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + using System; using NDesk.DBus; using org.freedesktop.DBus; @@ -11,25 +42,31 @@ Create = 1, Invite = 2, } + + public enum ChannelMediaCapability : uint + { + Audio = 1, + Video = 2 + } public struct LocalCapabilityInfo { - public ChannelType ChannelType; - public CapabilityFlag TypeSpecificFlags; + public string ChannelType; + public ChannelMediaCapability TypeSpecificFlags; } public struct CapabilityInfo { public uint ContactHandle; - public ChannelType ChannelType; + public string ChannelType; public CapabilityFlag GenericFlags; - public CapabilityFlag TypeSpecificFlags; + public ChannelMediaCapability TypeSpecificFlags; } public struct CapabilitiesChangedInfo { public uint ContactHandle; - public ChannelType ChannelType; + public string ChannelType; public CapabilityFlag OldGenericFlags; public CapabilityFlag NewGenericFlags; public CapabilityFlag OldTypeSpecificFlags; @@ -41,7 +78,7 @@ { event CapabilitiesChangedHandler CapabilitiesChanged; - LocalCapabilityInfo[] AdvertiseCapabilities (LocalCapabilityInfo[] add, ChannelType[] remove); + LocalCapabilityInfo[] AdvertiseCapabilities (LocalCapabilityInfo[] add, string[] remove); CapabilityInfo[] GetCapabilities (uint[] handles); } } diff -urNad telepathy-sharp-0.0.svn.20060831/telepathy/IConnectionContactInfo.cs telepathy-sharp-0.0.svn.20070221/telepathy/IConnectionContactInfo.cs --- telepathy-sharp-0.0.svn.20060831/telepathy/IConnectionContactInfo.cs 2006-09-25 19:41:02.000000000 +0200 +++ telepathy-sharp-0.0.svn.20070221/telepathy/IConnectionContactInfo.cs 2007-02-21 19:10:37.000000000 +0100 @@ -1,3 +1,34 @@ +/*************************************************************************** + * IConnectionContactInfo.cs + * + * Copyright (C) 2006 INdT + * Written by + * Andre Moreira Magalhaes + * Kenneth Christiansen + * Renato Araujo Oliveira Filho + ****************************************************************************/ + +/* THIS FILE IS LICENSED UNDER THE MIT LICENSE AS OUTLINED IMMEDIATELY BELOW: + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + using System; using NDesk.DBus; using org.freedesktop.DBus; diff -urNad telepathy-sharp-0.0.svn.20060831/telepathy/IConnection.cs telepathy-sharp-0.0.svn.20070221/telepathy/IConnection.cs --- telepathy-sharp-0.0.svn.20060831/telepathy/IConnection.cs 2006-09-25 19:41:02.000000000 +0200 +++ telepathy-sharp-0.0.svn.20070221/telepathy/IConnection.cs 2007-02-21 19:10:37.000000000 +0100 @@ -1,10 +1,41 @@ +/*************************************************************************** + * IConnection.cs + * + * Copyright (C) 2006 INdT + * Written by + * Andre Moreira Magalhaes + * Kenneth Christiansen + * Renato Araujo Oliveira Filho + ****************************************************************************/ + +/* THIS FILE IS LICENSED UNDER THE MIT LICENSE AS OUTLINED IMMEDIATELY BELOW: + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + using System; using NDesk.DBus; using org.freedesktop.DBus; namespace org.freedesktop.Telepathy { - public delegate void NewChannelHandler (ObjectPath channel, ChannelType channel_type, HandleType handle_type, uint handle, bool suppress_handler); + public delegate void NewChannelHandler (ObjectPath channel, string channel_type, HandleType handle_type, uint handle, bool suppress_handler); public delegate void StatusChangedHandler (ConnectionStatus status, ConnectionStatusReason reason); public enum HandleType : uint @@ -42,17 +73,17 @@ public class ChannelType { - public const string ContactList = "org.freedesktop.Telepathy.Channel.Type.ContactList"; - public const string ContactSearch = "org.freedesktop.Telepathy.Channel.Type.ContactSearch"; - public const string StreamedMedia = "org.freedesktop.Telepathy.Channel.Type.StreamedMedia"; - public const string RoomList = "org.freedesktop.Telepathy.Channel.Type.RoomList"; - public const string Text = "org.freedesktop.Telepathy.Channel.Type.Text"; + public static readonly string ContactList = "org.freedesktop.Telepathy.Channel.Type.ContactList"; + public static readonly string ContactSearch = "org.freedesktop.Telepathy.Channel.Type.ContactSearch"; + public static readonly string StreamedMedia = "org.freedesktop.Telepathy.Channel.Type.StreamedMedia"; + public static readonly string RoomList = "org.freedesktop.Telepathy.Channel.Type.RoomList"; + public static readonly string Text = "org.freedesktop.Telepathy.Channel.Type.Text"; } public struct ChannelInfo { public ObjectPath ObjectPath; - public ChannelType InterfaceName; + public string InterfaceName; public HandleType HandleType; public uint Handle; } diff -urNad telepathy-sharp-0.0.svn.20060831/telepathy/IConnectionForwarding.cs telepathy-sharp-0.0.svn.20070221/telepathy/IConnectionForwarding.cs --- telepathy-sharp-0.0.svn.20060831/telepathy/IConnectionForwarding.cs 2006-09-25 19:41:02.000000000 +0200 +++ telepathy-sharp-0.0.svn.20070221/telepathy/IConnectionForwarding.cs 2007-02-21 19:10:37.000000000 +0100 @@ -1,3 +1,34 @@ +/*************************************************************************** + * IConnectionForwarding.cs + * + * Copyright (C) 2006 INdT + * Written by + * Andre Moreira Magalhaes + * Kenneth Christiansen + * Renato Araujo Oliveira Filho + ****************************************************************************/ + +/* THIS FILE IS LICENSED UNDER THE MIT LICENSE AS OUTLINED IMMEDIATELY BELOW: + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + using System; using NDesk.DBus; using org.freedesktop.DBus; diff -urNad telepathy-sharp-0.0.svn.20060831/telepathy/IConnectionManager.cs telepathy-sharp-0.0.svn.20070221/telepathy/IConnectionManager.cs --- telepathy-sharp-0.0.svn.20060831/telepathy/IConnectionManager.cs 2006-09-25 19:41:02.000000000 +0200 +++ telepathy-sharp-0.0.svn.20070221/telepathy/IConnectionManager.cs 2007-02-21 19:10:37.000000000 +0100 @@ -1,3 +1,34 @@ +/*************************************************************************** + * IConnectionManager.cs + * + * Copyright (C) 2006 INdT + * Written by + * Andre Moreira Magalhaes + * Kenneth Christiansen + * Renato Araujo Oliveira Filho + ****************************************************************************/ + +/* THIS FILE IS LICENSED UNDER THE MIT LICENSE AS OUTLINED IMMEDIATELY BELOW: + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + using System; using System.Collections.Generic; using NDesk.DBus; diff -urNad telepathy-sharp-0.0.svn.20060831/telepathy/IConnectionPresence.cs telepathy-sharp-0.0.svn.20070221/telepathy/IConnectionPresence.cs --- telepathy-sharp-0.0.svn.20060831/telepathy/IConnectionPresence.cs 2006-09-25 19:41:02.000000000 +0200 +++ telepathy-sharp-0.0.svn.20070221/telepathy/IConnectionPresence.cs 2007-02-21 19:10:37.000000000 +0100 @@ -1,3 +1,34 @@ +/*************************************************************************** + * IConnectionPresence.cs + * + * Copyright (C) 2006 INdT + * Written by + * Andre Moreira Magalhaes + * Kenneth Christiansen + * Renato Araujo Oliveira Filho + ****************************************************************************/ + +/* THIS FILE IS LICENSED UNDER THE MIT LICENSE AS OUTLINED IMMEDIATELY BELOW: + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + using System; using System.Collections.Generic; using NDesk.DBus; @@ -41,7 +72,7 @@ void RemoveStatus (string status); void RequestPresence (uint[] contacts); void SetLastActivityTime (uint time); - void SetStatus (IDictionary>> statuses); + void SetStatus (IDictionary> statuses); } } diff -urNad telepathy-sharp-0.0.svn.20060831/telepathy/IConnectionPrivacy.cs telepathy-sharp-0.0.svn.20070221/telepathy/IConnectionPrivacy.cs --- telepathy-sharp-0.0.svn.20060831/telepathy/IConnectionPrivacy.cs 2006-09-25 19:41:02.000000000 +0200 +++ telepathy-sharp-0.0.svn.20070221/telepathy/IConnectionPrivacy.cs 2007-02-21 19:10:37.000000000 +0100 @@ -1,3 +1,34 @@ +/*************************************************************************** + * IConnectionPrivacy.cs + * + * Copyright (C) 2006 INdT + * Written by + * Andre Moreira Magalhaes + * Kenneth Christiansen + * Renato Araujo Oliveira Filho + ****************************************************************************/ + +/* THIS FILE IS LICENSED UNDER THE MIT LICENSE AS OUTLINED IMMEDIATELY BELOW: + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + using System; using NDesk.DBus; using org.freedesktop.DBus; diff -urNad telepathy-sharp-0.0.svn.20060831/telepathy/IConnectionRenaming.cs telepathy-sharp-0.0.svn.20070221/telepathy/IConnectionRenaming.cs --- telepathy-sharp-0.0.svn.20060831/telepathy/IConnectionRenaming.cs 2006-09-25 19:41:02.000000000 +0200 +++ telepathy-sharp-0.0.svn.20070221/telepathy/IConnectionRenaming.cs 2007-02-21 19:10:37.000000000 +0100 @@ -1,3 +1,34 @@ +/*************************************************************************** + * IConnectionRenaming.cs + * + * Copyright (C) 2006 INdT + * Written by + * Andre Moreira Magalhaes + * Kenneth Christiansen + * Renato Araujo Oliveira Filho + ****************************************************************************/ + +/* THIS FILE IS LICENSED UNDER THE MIT LICENSE AS OUTLINED IMMEDIATELY BELOW: + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + using System; using NDesk.DBus; using org.freedesktop.DBus; diff -urNad telepathy-sharp-0.0.svn.20060831/telepathy/IProperties.cs telepathy-sharp-0.0.svn.20070221/telepathy/IProperties.cs --- telepathy-sharp-0.0.svn.20060831/telepathy/IProperties.cs 2006-09-25 19:41:02.000000000 +0200 +++ telepathy-sharp-0.0.svn.20070221/telepathy/IProperties.cs 2007-02-21 19:10:37.000000000 +0100 @@ -1,3 +1,34 @@ +/*************************************************************************** + * IProperties.cs + * + * Copyright (C) 2006 INdT + * Written by + * Andre Moreira Magalhaes + * Kenneth Christiansen + * Renato Araujo Oliveira Filho + ****************************************************************************/ + +/* THIS FILE IS LICENSED UNDER THE MIT LICENSE AS OUTLINED IMMEDIATELY BELOW: + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + using System; using NDesk.DBus; using org.freedesktop.DBus; diff -urNad telepathy-sharp-0.0.svn.20060831/telepathy/ISessionHandler.cs telepathy-sharp-0.0.svn.20070221/telepathy/ISessionHandler.cs --- telepathy-sharp-0.0.svn.20060831/telepathy/ISessionHandler.cs 2006-09-25 19:41:02.000000000 +0200 +++ telepathy-sharp-0.0.svn.20070221/telepathy/ISessionHandler.cs 2007-02-21 19:10:37.000000000 +0100 @@ -1,3 +1,34 @@ +/*************************************************************************** + * ISessionHandler.cs + * + * Copyright (C) 2006 INdT + * Written by + * Andre Moreira Magalhaes + * Kenneth Christiansen + * Renato Araujo Oliveira Filho + ****************************************************************************/ + +/* THIS FILE IS LICENSED UNDER THE MIT LICENSE AS OUTLINED IMMEDIATELY BELOW: + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + using System; using NDesk.DBus; using org.freedesktop.DBus; diff -urNad telepathy-sharp-0.0.svn.20060831/telepathy/IStreamEngine.cs telepathy-sharp-0.0.svn.20070221/telepathy/IStreamEngine.cs --- telepathy-sharp-0.0.svn.20060831/telepathy/IStreamEngine.cs 1970-01-01 01:00:00.000000000 +0100 +++ telepathy-sharp-0.0.svn.20070221/telepathy/IStreamEngine.cs 2007-02-21 19:10:37.000000000 +0100 @@ -0,0 +1,58 @@ +/*************************************************************************** + * IStreamEngine.cs + * + * Copyright (C) 2006 INdT + * Written by + * Renato Araujo Oliveira Filho + ****************************************************************************/ + +/* THIS FILE IS LICENSED UNDER THE MIT LICENSE AS OUTLINED IMMEDIATELY BELOW: + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + +using System; +using NDesk.DBus; +using org.freedesktop.DBus; + +namespace org.freedesktop.Telepathy +{ + public delegate void ReceivingHandler (ObjectPath channel_path, uint stream_id, bool state); + + [Interface ("org.freedesktop.Telepathy.ChannelHandler")] + public interface IChannelHandler : Introspectable + { + void HandleChannel (string bus_name, ObjectPath connection, string channel_type, ObjectPath channel, uint handle_type, uint handle); + } + + + [Interface ("org.freedesktop.Telepathy.StreamEngine")] + public interface IStreamEngine : Introspectable + { + event ReceivingHandler Receiving; + + void SetOutputVolume (ObjectPath channel_path, uint stream_id, uint volume); + void MuteInput (ObjectPath channel_path, uint stream_id, bool mute_state); + void MuteOutput (ObjectPath channel_path, uint stream_id, bool mute_state); + void SetOutputWindow (ObjectPath channel_path, uint stream_id, uint window); + void AddPreviewWindow (uint window); + void RemovePreviewWindow (uint window); + void Shutdown (); + } +} diff -urNad telepathy-sharp-0.0.svn.20060831/telepathy/Makefile.am telepathy-sharp-0.0.svn.20070221/telepathy/Makefile.am --- telepathy-sharp-0.0.svn.20060831/telepathy/Makefile.am 2006-09-25 21:31:43.000000000 +0200 +++ telepathy-sharp-0.0.svn.20070221/telepathy/Makefile.am 2007-02-21 19:41:44.000000000 +0100 @@ -1,5 +1,4 @@ -MCS = gmcs -MCS_FLAGS = -debug +CSC_FLAGS = -debug ASSEMBLY_NAME = INdT.Telepathy ASSEMBLY = $(ASSEMBLY_NAME).dll @@ -7,7 +6,6 @@ INdT_Telepathy_SCRIPTS = $(ASSEMBLY) TARGET = $(ASSEMBLY) -#SNK = $(PACKAGE).snk SOURCES=\ AssemblyInfo.cs \ @@ -34,24 +32,16 @@ IConnectionPrivacy.cs \ IConnectionRenaming.cs \ IProperties.cs \ - ISessionHandler.cs + ISessionHandler.cs \ + IStreamEngine.cs CLEANFILES = $(ASSEMBLY) $(ASSEMBLY).mdb $(ASSEMBLY).config PKG_REFERENCES = \ - -r:../dbus-sharp/src/NDesk.DBus.dll + -r:$(top_srcdir)/dbus-sharp/NDesk.DBus.dll $(ASSEMBLY): $(SOURCES) - $(MCS) -target:library -out:$@ $(MCS_FLAGS) $(SOURCES) $(PKG_REFERENCES) - -#$(SNK): $(top_srcdir)/$(SNK) -# cp $(top_srcdir)/$(SNK) . + $(CSC) -target:library -out:$@ $(CSC_FLAGS) $(SOURCES) $(PKG_REFERENCES) all: $(ASSEMBLY) -#install-data-hook: $(ASSEMBLY) -# $(GACUTIL) /i $(ASSEMBLY) /package $(PACKAGE) /gacdir $(libdir) /root $(DESTDIR)$(libdir) -# -#uninstall-hook: $(ASSEMBLY) -# $(GACUTIL) /u $(PACKAGE) /package $(PACKAGE) /gacdir $(libdir) /root $(DESTDIR)$(libdir) - diff -urNad telepathy-sharp-0.0.svn.20060831/telepathy/Makefile.in telepathy-sharp-0.0.svn.20070221/telepathy/Makefile.in --- telepathy-sharp-0.0.svn.20060831/telepathy/Makefile.in 2006-09-25 21:31:58.000000000 +0200 +++ telepathy-sharp-0.0.svn.20070221/telepathy/Makefile.in 2007-02-21 21:16:18.000000000 +0100 @@ -58,6 +58,7 @@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ +CSC = @CSC@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ ECHO_C = @ECHO_C@ @@ -74,8 +75,8 @@ MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ MAKEINFO = @MAKEINFO@ -MCS = gmcs -MONO = @MONO@ +MONO_DEPENDENCY_CFLAGS = @MONO_DEPENDENCY_CFLAGS@ +MONO_DEPENDENCY_LIBS = @MONO_DEPENDENCY_LIBS@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ @@ -84,6 +85,7 @@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PKG_CONFIG = @PKG_CONFIG@ +RUNTIME = @RUNTIME@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ @@ -130,13 +132,12 @@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ -MCS_FLAGS = -debug +CSC_FLAGS = -debug ASSEMBLY_NAME = INdT.Telepathy ASSEMBLY = $(ASSEMBLY_NAME).dll INdT_Telepathydir = $(pkglibdir) INdT_Telepathy_SCRIPTS = $(ASSEMBLY) TARGET = $(ASSEMBLY) -#SNK = $(PACKAGE).snk SOURCES = \ AssemblyInfo.cs \ Error.cs \ @@ -162,11 +163,12 @@ IConnectionPrivacy.cs \ IConnectionRenaming.cs \ IProperties.cs \ - ISessionHandler.cs + ISessionHandler.cs \ + IStreamEngine.cs CLEANFILES = $(ASSEMBLY) $(ASSEMBLY).mdb $(ASSEMBLY).config PKG_REFERENCES = \ - -r:../dbus-sharp/src/NDesk.DBus.dll + -r:$(top_srcdir)/dbus-sharp/NDesk.DBus.dll all: all-am @@ -346,18 +348,9 @@ $(ASSEMBLY): $(SOURCES) - $(MCS) -target:library -out:$@ $(MCS_FLAGS) $(SOURCES) $(PKG_REFERENCES) - -#$(SNK): $(top_srcdir)/$(SNK) -# cp $(top_srcdir)/$(SNK) . + $(CSC) -target:library -out:$@ $(CSC_FLAGS) $(SOURCES) $(PKG_REFERENCES) all: $(ASSEMBLY) - -#install-data-hook: $(ASSEMBLY) -# $(GACUTIL) /i $(ASSEMBLY) /package $(PACKAGE) /gacdir $(libdir) /root $(DESTDIR)$(libdir) -# -#uninstall-hook: $(ASSEMBLY) -# $(GACUTIL) /u $(PACKAGE) /package $(PACKAGE) /gacdir $(libdir) /root $(DESTDIR)$(libdir) # 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 -urNad telepathy-sharp-0.0.svn.20060831/telepathy-sharp.pc.in telepathy-sharp-0.0.svn.20070221/telepathy-sharp.pc.in --- telepathy-sharp-0.0.svn.20060831/telepathy-sharp.pc.in 2006-09-26 13:05:52.000000000 +0200 +++ telepathy-sharp-0.0.svn.20070221/telepathy-sharp.pc.in 2007-02-21 19:10:38.000000000 +0100 @@ -7,3 +7,4 @@ Version: @VERSION@ Cflags: Libs: -r:${libdir}/telepathy-sharp/INdT.Telepathy.dll -r:${libdir}/telepathy-sharp/NDesk.DBus.dll +Requires: diff -urNad telepathy-sharp-0.0.svn.20060831/test/Makefile telepathy-sharp-0.0.svn.20070221/test/Makefile --- telepathy-sharp-0.0.svn.20060831/test/Makefile 2006-09-25 20:35:47.000000000 +0200 +++ telepathy-sharp-0.0.svn.20070221/test/Makefile 1970-01-01 01:00:00.000000000 +0100 @@ -1,295 +0,0 @@ -# Makefile.in generated by automake 1.9.6 from Makefile.am. -# test/Makefile. Generated from Makefile.in by configure. - -# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005 Free Software Foundation, Inc. -# This Makefile.in is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - - -srcdir = . -top_srcdir = .. - -pkgdatadir = $(datadir)/telepathy-sharp -pkglibdir = $(libdir)/telepathy-sharp -pkgincludedir = $(includedir)/telepathy-sharp -top_builddir = .. -am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -INSTALL = /usr/bin/install -c -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 = i686-pc-linux-gnu -host_triplet = i686-pc-linux-gnu -target_triplet = i686-pc-linux-gnu -subdir = test -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_CLEAN_FILES = -SOURCES = -DIST_SOURCES = -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) -ACLOCAL = ${SHELL} /home/giskard/tmp/telepathy-sharp-0.0.svn.20060831/missing --run aclocal-1.9 -AMTAR = ${SHELL} /home/giskard/tmp/telepathy-sharp-0.0.svn.20060831/missing --run tar -ASM_VERSION = 0.1.0.* -AUTOCONF = ${SHELL} /home/giskard/tmp/telepathy-sharp-0.0.svn.20060831/missing --run autoconf -AUTOHEADER = ${SHELL} /home/giskard/tmp/telepathy-sharp-0.0.svn.20060831/missing --run autoheader -AUTOMAKE = ${SHELL} /home/giskard/tmp/telepathy-sharp-0.0.svn.20060831/missing --run automake-1.9 -AWK = gawk -CYGPATH_W = echo -DEFS = -DPACKAGE_NAME=\"\" -DPACKAGE_TARNAME=\"\" -DPACKAGE_VERSION=\"\" -DPACKAGE_STRING=\"\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE=\"telepathy-sharp\" -DVERSION=\"0.1.0\" -ECHO_C = -ECHO_N = -n -ECHO_T = -INSTALL_DATA = ${INSTALL} -m 644 -INSTALL_PROGRAM = ${INSTALL} -INSTALL_SCRIPT = ${INSTALL} -INSTALL_STRIP_PROGRAM = ${SHELL} $(install_sh) -c -s -LIBOBJS = -LIBS = -LTLIBOBJS = -MAINT = # -MAINTAINER_MODE_FALSE = -MAINTAINER_MODE_TRUE = # -MAKEINFO = ${SHELL} /home/giskard/tmp/telepathy-sharp-0.0.svn.20060831/missing --run makeinfo -MCS = gmcs -MONO = /usr/bin/mono -PACKAGE = telepathy-sharp -PACKAGE_BUGREPORT = -PACKAGE_NAME = -PACKAGE_STRING = -PACKAGE_TARNAME = -PACKAGE_VERSION = -PATH_SEPARATOR = : -PKG_CONFIG = /usr/bin/pkg-config -SET_MAKE = -SHELL = /bin/sh -STRIP = -VERSION = 0.1.0 -am__leading_dot = . -am__tar = ${AMTAR} chof - "$$tardir" -am__untar = ${AMTAR} xf - -bindir = ${exec_prefix}/bin -build = i686-pc-linux-gnu -build_alias = -build_cpu = i686 -build_os = linux-gnu -build_vendor = pc -datadir = ${datarootdir} -datarootdir = ${prefix}/share -docdir = ${datarootdir}/doc/${PACKAGE} -dvidir = ${docdir} -exec_prefix = ${prefix} -host = i686-pc-linux-gnu -host_alias = -host_cpu = i686 -host_os = linux-gnu -host_vendor = pc -htmldir = ${docdir} -includedir = ${prefix}/include -infodir = ${datarootdir}/info -install_sh = /home/giskard/tmp/telepathy-sharp-0.0.svn.20060831/install-sh -libdir = ${exec_prefix}/lib -libexecdir = ${exec_prefix}/libexec -localedir = ${datarootdir}/locale -localstatedir = ${prefix}/var -mandir = ${datarootdir}/man -mkdir_p = mkdir -p -- -oldincludedir = /usr/include -pdfdir = ${docdir} -prefix = /usr/local -program_transform_name = s,x,x, -psdir = ${docdir} -sbindir = ${exec_prefix}/sbin -sharedstatedir = ${prefix}/com -sysconfdir = ${prefix}/etc -target = i686-pc-linux-gnu -target_alias = -target_cpu = i686 -target_os = linux-gnu -target_vendor = pc -MCS_FLAGS = -debug -TEST_NAME = test -TEST = $(TEST_NAME).exe -TARGET = $(TEST) -PKG_REFERENCES = -r:../dbus-sharp/NDesk.DBus.dll -r:../telepathy/INdT.Telepathy.dll -test_sources = Test.cs -CLEANFILES = *.exe -all: all-am - -.SUFFIXES: -$(srcdir)/Makefile.in: # $(srcdir)/Makefile.am $(am__configure_deps) - @for dep in $?; do \ - case '$(am__configure_deps)' in \ - *$$dep*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ - && exit 0; \ - exit 1;; \ - esac; \ - done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu test/Makefile'; \ - cd $(top_srcdir) && \ - $(AUTOMAKE) --gnu test/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 -uninstall-info-am: -tags: TAGS -TAGS: - -ctags: CTAGS -CTAGS: - - -distdir: $(DISTFILES) - @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ - list='$(DISTFILES)'; for file in $$list; do \ - case $$file in \ - $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ - $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ - esac; \ - if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test "$$dir" != "$$file" && test "$$dir" != "."; then \ - dir="/$$dir"; \ - $(mkdir_p) "$(distdir)$$dir"; \ - else \ - dir=''; \ - fi; \ - if test -d $$d/$$file; then \ - if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ - fi; \ - cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ - else \ - test -f $(distdir)/$$file \ - || cp -p $$d/$$file $(distdir)/$$file \ - || exit 1; \ - fi; \ - done -check-am: all-am -check: check-am -all-am: Makefile all-local -installdirs: -install: install-am -install-exec: install-exec-am -install-data: install-data-am -uninstall: uninstall-am - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am - -installcheck: installcheck-am -install-strip: - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - `test -z '$(STRIP)' || \ - echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install -mostlyclean-generic: - -clean-generic: - -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) - -distclean-generic: - -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) - -maintainer-clean-generic: - @echo "This command is intended for maintainers to use" - @echo "it deletes files that may require special tools to rebuild." -clean: clean-am - -clean-am: clean-generic mostlyclean-am - -distclean: distclean-am - -rm -f Makefile -distclean-am: clean-am distclean-generic - -dvi: dvi-am - -dvi-am: - -html: html-am - -info: info-am - -info-am: - -install-data-am: - -install-exec-am: - -install-info: install-info-am - -install-man: - -installcheck-am: - -maintainer-clean: maintainer-clean-am - -rm -f Makefile -maintainer-clean-am: distclean-am maintainer-clean-generic - -mostlyclean: mostlyclean-am - -mostlyclean-am: mostlyclean-generic - -pdf: pdf-am - -pdf-am: - -ps: ps-am - -ps-am: - -uninstall-am: uninstall-info-am - -.PHONY: all all-am all-local check check-am clean clean-generic \ - distclean distclean-generic distdir dvi dvi-am html html-am \ - info info-am install install-am install-data install-data-am \ - install-exec install-exec-am install-info install-info-am \ - install-man install-strip installcheck installcheck-am \ - installdirs maintainer-clean maintainer-clean-generic \ - mostlyclean mostlyclean-generic pdf pdf-am ps ps-am uninstall \ - uninstall-am uninstall-info-am - - -all-local: $(TARGET) - -$(TARGET): $(test_sources) - $(MCS) $(MCS_FLAGS) $(PKG_REFERENCES) $(test_sources) \ - -target:exe -out:"$@" -# 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 -urNad telepathy-sharp-0.0.svn.20060831/test/Makefile.am telepathy-sharp-0.0.svn.20070221/test/Makefile.am --- telepathy-sharp-0.0.svn.20060831/test/Makefile.am 2006-09-25 21:45:29.000000000 +0200 +++ telepathy-sharp-0.0.svn.20070221/test/Makefile.am 2007-02-21 19:10:32.000000000 +0100 @@ -3,7 +3,9 @@ TEST_NAME = test TEST = $(TEST_NAME).exe TARGET = $(TEST) -PKG_REFERENCES = -r:../dbus-sharp/src/NDesk.DBus.dll -r:../telepathy/INdT.Telepathy.dll +PKG_REFERENCES = \ + -r:../dbus-sharp/NDesk.DBus.dll \ + -r:../telepathy/INdT.Telepathy.dll test_sources = Test.cs @@ -13,4 +15,4 @@ $(MCS) $(MCS_FLAGS) $(PKG_REFERENCES) $(test_sources) \ -target:exe -out:"$@" -CLEANFILES = *.exe +CLEANFILES = *.exe* diff -urNad telepathy-sharp-0.0.svn.20060831/test/Makefile.in telepathy-sharp-0.0.svn.20070221/test/Makefile.in --- telepathy-sharp-0.0.svn.20060831/test/Makefile.in 2006-09-25 21:45:15.000000000 +0200 +++ telepathy-sharp-0.0.svn.20070221/test/Makefile.in 2007-02-21 21:16:20.000000000 +0100 @@ -54,6 +54,7 @@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ +CSC = @CSC@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ ECHO_C = @ECHO_C@ @@ -70,8 +71,8 @@ MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ MAKEINFO = @MAKEINFO@ -MCS = gmcs -MONO = @MONO@ +MONO_DEPENDENCY_CFLAGS = @MONO_DEPENDENCY_CFLAGS@ +MONO_DEPENDENCY_LIBS = @MONO_DEPENDENCY_LIBS@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ @@ -80,6 +81,7 @@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PKG_CONFIG = @PKG_CONFIG@ +RUNTIME = @RUNTIME@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ @@ -126,13 +128,17 @@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ +MCS = gmcs MCS_FLAGS = -debug TEST_NAME = test TEST = $(TEST_NAME).exe TARGET = $(TEST) -PKG_REFERENCES = -r:../dbus-sharp/src/NDesk.DBus.dll -r:../telepathy/INdT.Telepathy.dll +PKG_REFERENCES = \ + -r:../dbus-sharp/NDesk.DBus.dll \ + -r:../telepathy/INdT.Telepathy.dll + test_sources = Test.cs -CLEANFILES = *.exe +CLEANFILES = *.exe* all: all-am .SUFFIXES: diff -urNad telepathy-sharp-0.0.svn.20060831/test/Test.cs telepathy-sharp-0.0.svn.20070221/test/Test.cs --- telepathy-sharp-0.0.svn.20060831/test/Test.cs 2006-09-25 19:40:59.000000000 +0200 +++ telepathy-sharp-0.0.svn.20070221/test/Test.cs 2007-02-21 19:10:31.000000000 +0100 @@ -1,8 +1,7 @@ using System; using System.Collections; using System.Collections.Generic; -using DConnection = NDesk.DBus.Connection; -using ObjectPath = NDesk.DBus.ObjectPath; +using NDesk.DBus; using org.freedesktop.DBus; using org.freedesktop.Telepathy; @@ -10,7 +9,8 @@ { static IConnection iconn; static ConnectionInfo conn; - static DConnection dconn; + static Bus bus = Bus.Session; + static bool running = true; public static void OnConnectionStateChanged (ConnectionStatus status, ConnectionStatusReason reason) { @@ -21,51 +21,55 @@ string[] args = {"subscribe"}; uint[] handles = iconn.RequestHandles (HandleType.List, args); ObjectPath object_path = iconn.RequestChannel (ChannelType.ContactList, HandleType.List, handles[0], true); - IChannelContactList contact_list = dconn.GetObject (conn.BusName, object_path); + IChannelGroup contact_list = bus.GetObject (conn.BusName, object_path); uint[] members = contact_list.Members; string[] members_str = iconn.InspectHandles (HandleType.Contact, members); foreach (string member in members_str) Console.WriteLine ("Member: {0}", member); + + iconn.Disconnect (); } + + if (status == ConnectionStatus.Disconnected) + running = false; } public static void Main (string [] args) { - if (args.Length < 2) + if (args.Length < 2) { + Console.WriteLine ("Invalid Args"); return; + } - dconn = new DConnection (); - - Bus bus = dconn.GetObject ("org.freedesktop.DBus", new ObjectPath ("/org/freedesktop/DBus")); - bus.Hello (); //get connection manager from dbus - IConnectionManager conn_manager = dconn.GetObject ("org.freedesktop.Telepathy.ConnectionManager.gabble", new ObjectPath ("/org/freedesktop/Telepathy/ConnectionManager/gabble")); + IConnectionManager conn_manager = bus.GetObject ("org.freedesktop.Telepathy.ConnectionManager.gabble", + new ObjectPath ("/org/freedesktop/Telepathy/ConnectionManager/gabble")); + + if (conn_manager == null) { + Console.WriteLine ("Erro on get cm"); + return; + } + Console.WriteLine ("Account: {0}\nPassowrd: ?\nServer: {1}\nPort: {2}", args[0], args[2], UInt32.Parse (args[3])); Dictionary option_list = new Dictionary(); option_list.Add ("account", args[0]); option_list.Add ("password", args[1]); - - if (args[0].EndsWith ("@gmail.com") || args[0].EndsWith ("@googlemail.com")) - { - option_list.Add ("server", "talk.google.com"); - option_list.Add ("old-ssl", true); - option_list.Add ("ignore-ssl-errors", true); - option_list.Add ("port", (uint) 5223); - } else { - option_list.Add ("server", args[2]); - option_list.Add ("port", (uint) UInt32.Parse (args[3])); - } + option_list.Add ("server", args[2]); + option_list.Add ("port", (uint) UInt32.Parse (args[3])); + option_list.Add ("old-ssl", true); + option_list.Add ("ignore-ssl-errors", true); conn = conn_manager.RequestConnection ("jabber", option_list); Console.WriteLine ("Bus Name: " + conn.BusName + ", " + conn.ObjectPath.Value); - iconn = dconn.GetObject (conn.BusName, conn.ObjectPath); + iconn = bus.GetObject (conn.BusName, conn.ObjectPath); + iconn.StatusChanged += OnConnectionStateChanged; iconn.Connect (); - while (true) - dconn.Iterate (); + while (running) + bus.Iterate (); } }