diff options
200 files changed, 1729 insertions, 9092 deletions
diff --git a/.gitignore b/.gitignore index bb2a5bed8..a6bc6e49f 100644 --- a/.gitignore +++ b/.gitignore @@ -38,11 +38,11 @@ _gen /configure.lineno core /data/gabble.manager -/data/org.freedesktop.Telepathy.ConnectionManager.gabble.service +/data/im.telepathy.v1.ConnectionManager.gabble.service /debian /depcomp /docs/*.html -/docs/telepathy-gabble.8 +/docs/telepathy-gabble-1.8 /extensions/extensions.html /gtk-doc.make /install-sh @@ -68,7 +68,7 @@ core /src/gabble-enumtypes.c /src/media-session-enumtypes.c /src/media-session-enumtypes.h -/src/telepathy-gabble +/src/telepathy-gabble-1 /src/write-mgr-file /stamp-h1 tags diff --git a/configure.ac b/configure.ac index 317be2008..d9d0b50c4 100644 --- a/configure.ac +++ b/configure.ac @@ -8,8 +8,8 @@ AC_PREREQ([2.60]) # set gabble_nano_version to 0. m4_define([gabble_major_version], [0]) -m4_define([gabble_minor_version], [18]) -m4_define([gabble_micro_version], [999]) +m4_define([gabble_minor_version], [99]) +m4_define([gabble_micro_version], [6]) m4_define([gabble_nano_version], [1]) # Some magic @@ -176,7 +176,7 @@ if test x$installed_tests = xyes; then fi AM_CONDITIONAL([ENABLE_INSTALLED_TESTS], [test "x$installed_tests" = xyes]) -gabbletestsdir=${libdir}/telepathy-gabble-tests +gabbletestsdir=${libdir}/telepathy-gabble-1-tests AC_SUBST(gabbletestsdir) AC_ARG_ENABLE([is-a-phone], @@ -234,12 +234,12 @@ AC_SUBST(GLIB_GENMARSHAL) # # Private directory for Wocky and the gabble-plugins library if test "x$pluginexeclibdir" = x; then - pluginexeclibdir='${libdir}/telepathy/gabble-0/lib' + pluginexeclibdir='${libdir}/telepathy/gabble-1' fi AC_ARG_VAR([pluginexeclibdir]) # The actual plugins if test "x$pluginexecdir" = x; then - pluginexecdir='${libdir}/telepathy/gabble-0/plugins' + pluginexecdir='${libdir}/telepathy/gabble-1/plugins' fi AC_ARG_VAR([pluginexecdir]) @@ -257,7 +257,7 @@ if test x$enable_plugins = xyes; then [install headers for third-party plugins (experimental)]), [ enable_plugin_api=$enableval - wocky_install_headers_dir="${includedir}/telepathy-gabble-0" + wocky_install_headers_dir="${includedir}/telepathy-gabble-1" ], [enable_plugin_api=no]) fi @@ -278,9 +278,9 @@ AC_SUBST(DBUS_LIBS) AC_DEFINE(TP_SEAL_ENABLE, [], [Prevent to use sealed variables]) AC_DEFINE(TP_DISABLE_SINGLE_INCLUDE, [], [Disable single header include]) -AC_DEFINE([TP_VERSION_MIN_REQUIRED], [TP_VERSION_0_24], [Ignore post 0.24 deprecations]) -AC_DEFINE([TP_VERSION_MAX_ALLOWED], [TP_VERSION_0_24], [Prevent post 0.24 APIs]) -PKG_CHECK_MODULES(TP_GLIB, [telepathy-glib >= 0.23]) +AC_DEFINE([TP_VERSION_MIN_REQUIRED], [TP_VERSION_1_0], [Ignore post 1.0 deprecations]) +AC_DEFINE([TP_VERSION_MAX_ALLOWED], [TP_VERSION_1_0], [Prevent post 1.0 APIs]) +PKG_CHECK_MODULES(TP_GLIB, [telepathy-glib-1 >= 0.99.7, telepathy-glib-1-dbus >= 0.99.7]) AC_SUBST(TP_GLIB_CFLAGS) AC_SUBST(TP_GLIB_LIBS) @@ -425,8 +425,8 @@ AC_OUTPUT( Makefile \ lib/gibber/Makefile \ plugins/Makefile \ gabble/Makefile \ - gabble/telepathy-gabble-uninstalled.pc \ - gabble/telepathy-gabble.pc + gabble/telepathy-gabble-1-uninstalled.pc \ + gabble/telepathy-gabble-1.pc ) if test false != "$TEST_PYTHON"; then diff --git a/data/Makefile.am b/data/Makefile.am index cf48bc115..9a987a43d 100644 --- a/data/Makefile.am +++ b/data/Makefile.am @@ -1,15 +1,15 @@ EXTRA_DIST = gabble.service.in -managerdir = $(datadir)/telepathy/managers +managerdir = $(datadir)/telepathy-1/managers manager_DATA = gabble.manager servicedir = $(datadir)/dbus-1/services -service_DATA = org.freedesktop.Telepathy.ConnectionManager.gabble.service +service_DATA = im.telepathy.v1.ConnectionManager.gabble.service # We don't use the full filename for the .in because > 99 character filenames # in tarballs are non-portable (and automake 1.8 doesn't let us build # non-archaic tarballs) -org.freedesktop.Telepathy.ConnectionManager.gabble.service: gabble.service.in \ +im.telepathy.v1.ConnectionManager.gabble.service: gabble.service.in \ Makefile $(AM_V_GEN)sed -e "s|[@]libexecdir[@]|$(libexecdir)|" $< > $@ diff --git a/data/gabble.service.in b/data/gabble.service.in index 925e7a8b8..406350979 100644 --- a/data/gabble.service.in +++ b/data/gabble.service.in @@ -1,3 +1,3 @@ [D-BUS Service] -Name=org.freedesktop.Telepathy.ConnectionManager.gabble -Exec=@libexecdir@/telepathy-gabble +Name=im.telepathy.v1.ConnectionManager.gabble +Exec=@libexecdir@/telepathy-gabble-1 diff --git a/docs/Makefile.am b/docs/Makefile.am index 485c2d8b0..e2df34cdf 100644 --- a/docs/Makefile.am +++ b/docs/Makefile.am @@ -3,9 +3,8 @@ tools_dir = $(top_srcdir)/tools # htmldir is not defined by autoconf < 2.59c htmldir = $(if $(filter-out @%@,@htmldir@),@htmldir@,$(datadir)/doc/$(PACKAGE)) -man_MANS = telepathy-gabble.8 +man_MANS = telepathy-gabble-1.8 html_DATA = \ - olpc.html \ muc-bytestream.html \ si-multiple.html \ tubes.html diff --git a/docs/olpc.xml b/docs/olpc.xml deleted file mode 100644 index 515b30358..000000000 --- a/docs/olpc.xml +++ /dev/null @@ -1,797 +0,0 @@ -<?xml version='1.0' encoding='UTF-8'?> -<!DOCTYPE xep [ - <!ENTITY NS_OLPC_ACTIVITIES "http://laptop.org/xmpp/activities"> - <!ENTITY NS_OLPC_ACTIVITY_PROPS "http://laptop.org/xmpp/activity-properties"> - <!ENTITY NS_OLPC_BUDDY_PROPS "http://laptop.org/xmpp/buddy-properties"> - <!ENTITY NS_OLPC_CURRENT_ACTIVITY "http://laptop.org/xmpp/current-activity"> -]> -<?xml-stylesheet type='text/xsl' href='xep.xsl'?> -<xep> -<header> - <title>OLPC-specific properties, version 1.0</title> - <abstract>Properties for the Activity and Buddy abstractions used in the - One Laptop per Child's Sugar environment.</abstract> - <legal>Copyright (c) 2007 Collabora Limited. This document may be - distributed under the same terms as the Telepathy specification.</legal> - <number>proto-olpc1.0</number> - <status>ProtoXEP</status> - <type>Extension</type> - <sig>Standards</sig> - <approver>Telepathy project</approver> - <dependencies> - <spec>XMPP Core</spec> - <spec>XEP-0045</spec> - <spec>XEP-proto-clique</spec> - </dependencies> - <supersedes/> - <supersededby/> - <shortname>NOT YET ASSIGNED</shortname> - <author> - <firstname>Simon</firstname> - <surname>McVittie</surname> - <email>simon.mcvittie@collabora.co.uk</email> - <jid>simon.mcvittie@collabora.co.uk</jid> - </author> - <revision> - <version>0.0.1</version> - <date>2007-10-01</date> - <initials>smcv</initials> - <remark><p>First draft.</p></remark> - </revision> -</header> -<section1 topic='Introduction' anchor='intro'> - <p>This document describes the protocol used to transfer OLPC-specific - buddy (contact) and activity (chat room) information.</p> -</section1> -<section1 topic='Requirements' anchor='reqs'> - <p>The OLPC Sugar environment has the abstractions of a Buddy (corresponding - to a child and/or their laptop (XO), represented in XMPP by a JID and in - link-local XMPP by a _presence._tcp record) and an Activity (corresponding to - a shared activity, represented in XMPP by a MUC and in link-local XMPP by a - llmuc chatroom). The API requires that various properties can be browsed for - (without joining any activities or chatrooms).</p> -</section1> - -<section1 topic='Use Cases' anchor='usecases'> - <section2 topic='Buddy properties'> - - <p>Buddy properties are published in PEP. As currently implemented, - all XOs subscribe to the presence and buddy properties of all other - XOs on the same server.</p> - - <p>The buddy properties currently supported are ip4-address, key and - color.</p> - - <example caption='Publishing buddy properties'> - <![CDATA[ - <iq type="set" id="345265478350" - from='1111111111111111111111111111111111111111@jabber.laptop.org'> - <pubsub xmlns="http://jabber.org/protocol/pubsub"> - <publish node="http://laptop.org/xmpp/buddy-properties"> - <item> - <properties xmlns="http://laptop.org/xmpp/buddy-properties"> - <property type="str" name="ip4-address">10.0.0.123</property> - <property type="bytes" name="key">Base64Base64...</property> - <property type="str" name="color">#005FE4,#00A0FF</property> - </properties> - </item> - </publish> - </pubsub> - </iq> - ]]> - </example> - - <p>Subscribers receive the change notification, as usual for PEP. - (For all the other PEP nodes described in this document, the process - is the same, and has been omitted from this document for - conciseness.)</p> - - <example caption='Subscriber receives buddy properties notification'> - <![CDATA[ - <message - from='1111111111111111111111111111111111111111@jabber.laptop.org' - to='2222222222222222222222222222222222222222@jabber.laptop.org/Telepathy'> - <event xmlns='http://jabber.org/protocol/pubsub#event'> - <items node='http://laptop.org/xmpp/current-activity'> - <item> - <properties xmlns="http://laptop.org/xmpp/buddy-properties"> - <property type="str" name="ip4-address">10.0.0.123</property> - <property type="bytes" name="key">Base64Base64...</property> - <property type="str" name="color">#005FE4,#00A0FF</property> - </properties> - </item> - </items> - </event> - </message> - ]]> - </example> - - <section3 topic='Buddy properties in link-local XMPP'> - <p>In link-local XMPP, none of this happens. Instead, the ip4-address - property is implicitly available, and the key and color properties - are encoded in the _presence._tcp TXT record.</p> - - <p>The 'color' property is mapped to the 'olpc-color' TXT record key:</p> - - <code> - 11111@xo-12-34-56._presence._tcp.local. IN TXT "olpc-color=#005FE4,#00A0FF" - </code> - - <p>The 'key' property is mapped to the 'olpc-key-part0', - 'olpc-key-part1', ... properties, split as necessary to fit in - the 255-byte limit for TXT records. Because mDNS TXT records - are 8-bit-clean, the segments contain raw binary rather than - the Base64 binary used in XMPP:</p> - - <code> - 11111@xo-12-34-56._presence._tcp.local. IN TXT "olpc-key-part0=binarybinary..." - 11111@xo-12-34-56._presence._tcp.local. IN TXT "olpc-key-part1=binarybinary..." - 11111@xo-12-34-56._presence._tcp.local. IN TXT "olpc-key-part2=binarybinary..." - </code> - - <p>(As currently implemented, the "raw binary" is in fact *also* - Base64, so the data seen in XMPP is doubly Base64'd. However, this - is not guaranteed to remain the case, so the protocols need to - assume the underlying byte array for the key can contain - anything.)</p> - - <p>Implementors must be careful to ensure that there is no key - in the TXT record for the key segment 1 greater than the last one - they need (in this case, olpc-key-part3 must be removed if - present).</p> - </section3> - - </section2> - - <section2 topic='Current activity'> - - <p>The Neighbourhood view on the OLPC groups XO icons by their - current activity, so XOs must notify each other of current-activity - changes.</p> - - <p>As currently implemented, this is done for both public and private - activities, which represents an information leak. (FIXME)</p> - - <p>Note that the 'type' attribute is in fact the activity ID; the name is - for historical reasons.</p> - - <example caption='Publishing current activity'> - <![CDATA[ - <iq type="set" id="364923889843" - from='1111111111111111111111111111111111111111@jabber.laptop.org'> - <pubsub xmlns="http://jabber.org/protocol/pubsub"> - <publish node="http://laptop.org/xmpp/current-activity"> - <item> - <activity xmlns="http://laptop.org/xmpp/current-activity"> - room="aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa@conference.jabber.laptop.org" - type="aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"/> - </item> - </publish> - </pubsub> - </iq> - ]]> - </example> - - <section3 topic='Current activity in link-local XMPP'> - <p>In link-local XMPP, the current activity is mapped to a pair of - keys in the TXT record: olpc-current-activity (the activity ID) - and olpc-current-activity-room (the Salut rMulticast chat room - name).</p> - - <code> - 11111@xo-12-34-56._presence._tcp.local. IN TXT "olpc-current-activity=aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" - 11111@xo-12-34-56._presence._tcp.local. IN TXT "olpc-current-activity-room=aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" - </code> - </section3> - - </section2> - - <section2 topic='Public activity properties'> - - <p>For activities to be handled by the Sugar environment, certain - properties are needed. Because there is no server-side storage - corresponding to a chat room and accessible by all participants, - participants each publish the properties of all their activities.</p> - - <p>To keep participants' idea of the activity properties in sync, - when the properties change, the participant making the change MUST - send a broadcast message to the chatroom, notifying other participants - of the new properties.</p> - - <p>This <message/> MUST be sent before updating the PEP node - with the activity properties.</p> - - <example caption='Notifying the chatroom of a properties change'> - <![CDATA[ - <message type="groupchat" - from='aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa@conference.jabber.laptop.org/1111111111111111111111111111111111111111'> - to='aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa@conference.jabber.laptop.org'> - <properties xmlns="http://laptop.org/xmpp/activity-properties" - activity="aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" - room="aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa@conference.jabber.laptop.org"> - <property type="str" name="type">org.laptop.Connect</property> - <property type="str" name="name">Connect Activity</property> - <property type="str" name="tags"></property> - <property type="str" name="color">#005FE4,#00A0FF</property> - <property type="bool" name="private">0</property> - </properties> - </message> - ]]> - </example> - - <p>For public activities, the participants all announce all their - activities and their properties in a PEP node.</p> - - <p>When an activity becomes private, the participants all delete it - from their activity-properties PEP nodes.</p> - - <example caption='Publishing activity properties'> - <![CDATA[ - <iq type="set" id="275828931562" - from='1111111111111111111111111111111111111111@jabber.laptop.org'> - <pubsub xmlns="http://jabber.org/protocol/pubsub"> - <publish node="http://laptop.org/xmpp/activity-properties"> - <item> - <activities xmlns="http://laptop.org/xmpp/activity-properties"> - <properties - xmlns="http://laptop.org/xmpp/activity-properties" - activity="aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" - room="aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa@conference.jabber.laptop.org"> - <property type="str" name="type">org.laptop.Connect</property> - <property type="str" name="name">Connect Activity</property> - <property type="str" name="tags"></property> - <property type="str" name="color">#005FE4,#00A0FF</property> - <property type="bool" name="private">0</property> - </properties> - <properties - xmlns="http://laptop.org/xmpp/activity-properties" - activity="bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb" - room="bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb@conference.jabber.laptop.org"> - <property type="str" name="type">org.laptop.HelloMesh</property> - <property type="str" name="name">Example Activity</property> - <property type="str" name="tags"></property> - <property type="str" name="color">#005FE4,#00A0FF</property> - <property type="bool" name="private">0</property> - </properties> - </activities> - </item> - </publish> - </pubsub> - </iq> - ]]> - </example> - - <p>The participants all announce all their list of activities in yet - another PEP node, for backwards compatibility. This mechanism - will be removed in a future version of this protocol.</p> - - <p>Note that again, the 'type' attribute is in fact the activity ID; - the name is for historical reasons.</p> - - <example caption='Publishing public activity list'> - <![CDATA[ - <iq type="set" id="116108118099"> - <pubsub xmlns="http://jabber.org/protocol/pubsub"> - <publish node="http://laptop.org/xmpp/activities"> - <item> - <activities xmlns="http://laptop.org/xmpp/activities"> - <activity - room="aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa@conference.jabber.laptop.org" - type="aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"/> - <activity - room="bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb@conference.jabber.laptop.org" - type="bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb"/> - </activities> - </item> - </publish> - </pubsub> - </iq> - ]]> - </example> - - <section3 topic='Activity properties in link-local XMPP'> - <p>In link-local XMPP, the activity properties are mapped to - the _olpc-activity1._udp record. Each participant in each public - activity publishes an mDNS service named - <em>chatroomname</em>:<em>publishedname</em>@<em>hostname</em>, - like so:</p> - - <code> - ; Advertised by 11111... - aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa:11111@xo-12-34-56._olpc-activity1._udp.local. IN SRV 0 xo-12-34-56.local. - _olpc-activity1._udp.local. IN PTR aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa:11111@xo-12-34-56._olpc-activity1._udp.local. - aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa:11111@xo-12-34-56._olpc-activity1._udp.local IN TXT "txtvers=0" - aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa:11111@xo-12-34-56._olpc-activity1._udp.local IN TXT "room=aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" - aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa:11111@xo-12-34-56._olpc-activity1._udp.local IN TXT "activity-id=aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" - aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa:11111@xo-12-34-56._olpc-activity1._udp.local IN TXT "name=Connect Activity" - aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa:11111@xo-12-34-56._olpc-activity1._udp.local IN TXT "color=#005FE4,#00A0FF" - aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa:11111@xo-12-34-56._olpc-activity1._udp.local IN TXT "type=org.laptop.ConnectActivity" - aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa:11111@xo-12-34-56._olpc-activity1._udp.local IN TXT "tags=" - bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb:11111@xo-12-34-56._olpc-activity1._udp.local. IN SRV 0 xo-12-34-56.local. - _olpc-activity1._udp.local. IN PTR bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb:11111@xo-12-34-56._olpc-activity1._udp.local. - bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb:11111@xo-12-34-56._olpc-activity1._udp.local IN TXT "txtvers=0" - bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb:11111@xo-12-34-56._olpc-activity1._udp.local IN TXT "room=bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb" - bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb:11111@xo-12-34-56._olpc-activity1._udp.local IN TXT "activity-id=bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb" - bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb:11111@xo-12-34-56._olpc-activity1._udp.local IN TXT "name=Example Activity" - bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb:11111@xo-12-34-56._olpc-activity1._udp.local IN TXT "color=#005FE4,#00A0FF" - bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb:11111@xo-12-34-56._olpc-activity1._udp.local IN TXT "type=org.laptop.HelloMesh" - bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb:11111@xo-12-34-56._olpc-activity1._udp.local IN TXT "tags=" - - ; Advertised by 22222... - suppose here that 22222... is in the activity - ; aaaaa... but not in bbbbb... - aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa:22222@xo-22-22-22._olpc-activity1._udp.local. IN SRV 0 xo-22-22-22.local. - _olpc_activity._udp.local. IN PTR aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa:22222@xo-22-22-22._olpc-activity1._udp.local. - aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa:22222@xo-22-22-22._olpc-activity1._udp.local IN TXT "txtvers=0" - aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa:22222@xo-22-22-22._olpc-activity1._udp.local IN TXT "room=aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" - aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa:22222@xo-22-22-22._olpc-activity1._udp.local IN TXT "activity-id=aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" - aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa:22222@xo-22-22-22._olpc-activity1._udp.local IN TXT "name=Connect Activity" - aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa:22222@xo-22-22-22._olpc-activity1._udp.local IN TXT "color=#005FE4,#00A0FF" - aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa:22222@xo-22-22-22._olpc-activity1._udp.local IN TXT "type=org.laptop.ConnectActivity" - aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa:22222@xo-22-22-22._olpc-activity1._udp.local IN TXT "tags=" - </code> - - <p>The <message/> sent to the chat room with the updated - properties is much the same as for XMPP:</p> - - <example caption='Notifying the chatroom of a properties change (link-local)'> - <![CDATA[ - <!-- Sent via chatroom aaaaa... using rMulticast --> - <message type="groupchat" - from='11111@xo-12-34-56' - to='aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'> - <properties xmlns="http://laptop.org/xmpp/activity-properties" - activity="aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" - room="aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"> - <property type="str" name="type">org.laptop.Connect</property> - <property type="str" name="name">Connect Activity</property> - <property type="str" name="tags"></property> - <property type="str" name="color">#005FE4,#00A0FF</property> - <property type="bool" name="private">0</property> - </properties> - </message> - ]]> - </example> - - </section3> - - </section2> - - <section2 topic='Private activities'> - - <p>When an activity becomes private, the participants all delete it - from their activity-properties and activities PEP nodes. In - this example, the XO whose JID starts with 11111 makes the activity - whose ID starts with aaaaa private, and removes it from their PEP nodes; - the XO whose JID starts with 22222 responds by removing it from - their PEP nodes too.</p> - - <p>To a third XO observing the PEP nodes, this is indistinguishable from - both XOs leaving the activity simultaneously, which is what we want.</p> - - <example caption='Making an activity private'> - <![CDATA[ - <message type="groupchat" - from='aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa@conference.jabber.laptop.org/1111111111111111111111111111111111111111'> - to='aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa@conference.jabber.laptop.org'> - <properties xmlns="http://laptop.org/xmpp/activity-properties" - activity="aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" - room="aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa@conference.jabber.laptop.org"> - <property type="str" name="type">org.laptop.Connect</property> - <property type="str" name="name">Connect Activity</property> - <property type="str" name="tags"></property> - <property type="str" name="color">#005FE4,#00A0FF</property> - <property type="bool" name="private">1</property> - </properties> - </message> - - <iq type="set" id="275828931562" - from='1111111111111111111111111111111111111111@jabber.laptop.org'> - <pubsub xmlns="http://jabber.org/protocol/pubsub"> - <publish node="http://laptop.org/xmpp/activity-properties"> - <item> - <activities xmlns="http://laptop.org/xmpp/activity-properties"> - <properties - xmlns="http://laptop.org/xmpp/activity-properties" - activity="bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb" - room="bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb@conference.jabber.laptop.org"> - <property type="str" name="type">org.laptop.HelloMesh</property> - <property type="str" name="name">Example Activity</property> - <property type="str" name="tags"></property> - <property type="str" name="color">#005FE4,#00A0FF</property> - <property type="bool" name="private">0</property> - </properties> - </activities> - </item> - </publish> - </pubsub> - </iq> - - <iq type="set" id="116108118099"> - <pubsub xmlns="http://jabber.org/protocol/pubsub"> - <publish node="http://laptop.org/xmpp/activities"> - <item> - <activities xmlns="http://laptop.org/xmpp/activities"> - <activity - room="bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb@conference.jabber.laptop.org" - type="bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb"/> - </activities> - </item> - </publish> - </pubsub> - </iq> - - <!-- 22222... receives the above <message/>, and responds by deleting - activity aaaaa... from their PEP records. We assume here that 22222 - is not in any other public activity. --> - - <iq type="set" id="103874931562" - from='2222222222222222222222222222222222222222@jabber.laptop.org'> - <pubsub xmlns="http://jabber.org/protocol/pubsub"> - <publish node="http://laptop.org/xmpp/activity-properties"> - <item> - <activities xmlns="http://laptop.org/xmpp/activity-properties"> - </activities> - </item> - </publish> - </pubsub> - </iq> - - <iq type="set" id="116108239899"> - <pubsub xmlns="http://jabber.org/protocol/pubsub"> - <publish node="http://laptop.org/xmpp/activities"> - <item> - <activities xmlns="http://laptop.org/xmpp/activities"> - </activities> - </item> - </publish> - </pubsub> - </iq> - ]]> - </example> - - <section3 topic='Private activities in link-local XMPP'> - <p>Instead of deleting activities from their PEP records, - link-local peers delete them from their mDNS records.</p> - - <p>The <message/> sent to the chat room with the updated - properties is, again, much the same as for XMPP.</p> - </section3> - - </section2> - - <section2 topic='Invitations'> - - <p>Before inviting a buddy to an activity, OLPC users are expected to - send them the activity properties. These are sent in a <message/> - stanza referred to as a "pseudo-invitation". If the activity - is private, then this is the only opportunity the invitee has to - get the activity properties.</p> - - <example caption='Inviting a buddy to an activity'> - <![CDATA[ - <!-- 11111 sends pseudo-invitation directly to 33333 --> - <message - from='1111111111111111111111111111111111111111@jabber.laptop.org/Telepathy' - to='3333333333333333333333333333333333333333@jabber.laptop.org'> - <properties xmlns='http://laptop.org/xmpp/activity-properties' - activity='aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' - room='aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa@conference.jabber.laptop.org'> - <property type='str' name='type'>org.laptop.Connect</property> - <property type='str' name='name'>Connect Activity</property> - <property type='str' name='tags'/> - <property type='str' name='color'>#0d1c38,#49bce4</property> - <property type='bool' name='private'>1</property> - </properties> - </message> - - <!-- 11111 sends invitation to 33333 via MUC service --> - <message - to='aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa@conference.jabber.laptop.org'> - <x xmlns="http://jabber.org/protocol/muc#user"> - <invite to="3333333333333333333333333333333333333333@jabber.laptop.org"/> - </x> - </message> - - <!-- MUC service relays invitation to 33333 --> - <message type='normal' - from='aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa@conference.jabber.laptop.org' - to='3333333333333333333333333333333333333333@jabber.laptop.org'> - <x xmlns='http://jabber.org/protocol/muc#user'> - <invite from='1111111111111111111111111111111111111111@jabber.laptop.org/Telepathy'> - <reason/> - </invite> - </x> - <x xmlns='jabber:x:conference' jid='aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa@conference.jabber.laptop.org'/> - </message> - ]]> - </example> - - <p>If the activity properties change before the invitee joins the - activity, the inviter must notify the invitee by re-sending the - pseudo-invitation (only).</p> - - <example caption='Updating a buddy on activity properties'> - <![CDATA[ - <message - from='1111111111111111111111111111111111111111@jabber.laptop.org/Telepathy' - to='3333333333333333333333333333333333333333@jabber.laptop.org'> - <properties xmlns='http://laptop.org/xmpp/activity-properties' - activity='aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' - room='aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa@conference.jabber.laptop.org'> - <property type='str' name='type'>org.laptop.Connect</property> - <property type='str' name='name'>this name changed</property> - <property type='str' name='tags'/> - <property type='str' name='color'>#0d1c38,#49bce4</property> - <property type='bool' name='private'>1</property> - </properties> - </message> - ]]> - </example> - - <p>If the inviter leaves the activity before the invitee joins, the - invitee can no longer rely on being notified about any changes; - if the activity was private, the invitee can't even rely on being - able to see whether it exists. Accordingly, the inviter should cancel - their invitation; if all invitations to a private activity have been - cancelled, the invitee should assume that the activity has - disappeared.</p> - - <example caption='Cancelling an invitation'> - <![CDATA[ - <message - from='1111111111111111111111111111111111111111@jabber.laptop.org/Telepathy' - to='3333333333333333333333333333333333333333@jabber.laptop.org'> - <uninvite xmlns='http://laptop.org/xmpp/activity-properties' - id='aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' - room='aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa@conference.jabber.laptop.org'/> - </message> - ]]> - </example> - </section2> - - <section3 topic='Invitations in link-local XMPP'> - <p>There isn't the concept of sending an invitation via the MUC service - in link-local XMPP, so the process can be made somewhat simpler.</p> - - <example caption='Inviting a buddy to an activity (link-local)'> - <![CDATA[ - <!-- Sent over unicast TCP connection between xo-12-34-56.local. - and xo-33-33-33.local. --> - <message from='11111@xo-12-34-56' to='33333@xo-33-33-33'> - <x xmlns='http://collabora.co.uk/protocol/llmuc'> - <invite protocol='rmulticast'> - <roomname>aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa</roomname> - <address>224.0.0.1</address> - <port>23453</port> - <properties xmlns='http://laptop.org/xmpp/activity-properties' - activity='aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' - room='aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'> - <property type='str' name='type'>org.laptop.Connect</property> - <property type='str' name='name'>Connect Activity</property> - <property type='str' name='tags'/> - <property type='str' name='color'>#0d1c38,#49bce4</property> - <property type='bool' name='private'>1</property> - </properties> - </invite> - </x> - </message> - ]]> - </example> - - <example caption='Updating a buddy on activity properties (link-local)'> - <![CDATA[ - <!-- Sent over unicast TCP connection between xo-12-34-56.local. - and xo-33-33-33.local. We just re-send the invitation. --> - - <message from='11111@xo-12-34-56' to='33333@xo-33-33-33'> - <x xmlns='http://collabora.co.uk/protocol/llmuc'> - <invite protocol='rmulticast'> - <roomname>aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa</roomname> - <address>224.0.0.1</address> - <port>23453</port> - <properties xmlns='http://laptop.org/xmpp/activity-properties' - activity='aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' - room='aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'> - <property type='str' name='type'>org.laptop.Connect</property> - <property type='str' name='name'>The name changed</property> - <property type='str' name='tags'/> - <property type='str' name='color'>#0d1c38,#49bce4</property> - <property type='bool' name='private'>1</property> - </properties> - </invite> - </x> - </message> - ]]> - </example> - - <example caption='Cancelling an invitation (link-local)'> - <![CDATA[ - <!-- Sent over unicast TCP connection between xo-12-34-56.local. - and xo-33-33-33.local. --> - <message from='11111@xo-12-34-56' to='33333@xo-33-33-33'> - <uninvite xmlns='http://laptop.org/xmpp/activity-properties' - id='aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' - room='aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'/> - </message> - ]]> - </example> - - </section3> - -</section1> -<section1 topic='Business Rules' anchor='rules'> - <p>Properties have the same syntax and semantics as the "parameters" in - XEP-proto-tubes.</p> -</section1> -<section1 topic='Security Considerations' anchor='security'> - <p>Putting the current activity in a PEP node, even if it's private, - leaks the room name.</p> -</section1> -<section1 topic='IANA Considerations' anchor='iana'> - <p>None.</p> -</section1> -<section1 topic='XMPP Registrar Considerations' anchor='registrar'> - <p>None.</p> -</section1> -<section1 topic='XML Schema' anchor='schema'> - <code> - <![CDATA[ - <!-- Buddy properties --> - <xs:schema - xmlns:xs='http://www.w3.org/2001/XMLSchema' - targetNamespace='http://laptop.org/xmpp/buddy-properties' - xmlns='http://laptop.org/xmpp/buddy-properties' - elementFormDefault='qualified'> - - <!-- Published in the PEP node of the same namespace --> - <xs:element name='properties'> - <xs:complexType> - <xs:sequence> - <xs:element name='property' minOccurs='0' maxOccurs='unbounded' - type='name-value-pair'/> - </xs:sequence> - </xs:complexType> - </xs:element> - - <!-- A name-value pair (the same format as Tubes parameters, as it - happens) --> - <xs:complexType name='name-value-pair'> - <xs:simpleContent> - <xs:extension base='xs:string'> - <xs:attribute name='name' type='xs:string'/> - <xs:attribute name='type'> - <xs:simpleType> - <xs:restriction base='xs:NCName'> - <xs:enumeration value='bool'/> - <xs:enumeration value='str'/> - <xs:enumeration value='bytes'/> - <xs:enumeration value='int'/> - <xs:enumeration value='uint'/> - </xs:restriction> - </xs:simpleType> - </xs:attribute> - </xs:extension> - </xs:simpleContent> - </xs:complexType> - </xs:schema> - ]]> - <![CDATA[ - <!-- Activity properties --> - <xs:schema - xmlns:xs='http://www.w3.org/2001/XMLSchema' - targetNamespace='http://laptop.org/xmpp/activity-properties' - xmlns='http://laptop.org/xmpp/activity-properties' - elementFormDefault='qualified'> - - <!-- Sent in pseudo-invitations, published in the PEP node - of the same namespace, and sent in chatrooms --> - <xs:element name='properties'> - <xs:complexType> - <!-- XMPP MUC's (bare) JID --> - <xs:attribute name='room' use='required' type='xs:string'/> - <!-- OLPC Activity ID (a 40-character hex string, as of Trial-3) --> - <xs:attribute name='activity' use='required' type='xs:string'/> - - <xs:element name='property' minOccurs='0' maxOccurs='unbounded' - type='name-value-pair'/> - </xs:complexType> - </xs:element> - - <!-- Sent to cancel invitations --> - <xs:element name='uninvite'> - <xs:complexType> - <xs:attribute name='room' use='required' type='xs:string'/> - <xs:attribute name='id' use='required' type='xs:string'/> - </xs:complexType> - </xs:element> - - <!-- A name-value pair (the same format as Tubes parameters, as it - happens) --> - <xs:complexType name='name-value-pair'> - <xs:simpleContent> - <xs:extension base='xs:string'> - <xs:attribute name='name' type='xs:string'/> - <xs:attribute name='type'> - <xs:simpleType> - <xs:restriction base='xs:NCName'> - <xs:enumeration value='bool'/> - <xs:enumeration value='str'/> - <xs:enumeration value='bytes'/> - <xs:enumeration value='int'/> - <xs:enumeration value='uint'/> - </xs:restriction> - </xs:simpleType> - </xs:attribute> - </xs:extension> - </xs:simpleContent> - </xs:complexType> - - <xs:simpleType name='empty'> - <xs:restriction base='xs:string'> - <xs:enumeration value=''/> - </xs:restriction> - </xs:simpleType> - </xs:schema> - ]]> - <![CDATA[ - <!-- Buddy's Activities list --> - <xs:schema - xmlns:xs='http://www.w3.org/2001/XMLSchema' - targetNamespace='http://laptop.org/xmpp/activities' - xmlns='http://laptop.org/xmpp/activities' - elementFormDefault='qualified'> - - <!-- Published in the PEP node of the same namespace --> - <xs:element name='activities'> - <xs:complexType> - <xs:sequence> - <xs:element name='activity'> - <xs:complexType> - <!-- Despite its name, this attribute is actually the - OLPC activity ID! Historical reasons... --> - <xs:attribute name='type' type='xs:string'/> - <!-- XMPP MUC (bare) JID --> - <xs:attribute name='room' type='xs:string'/> - </xs:complexType> - </xs:element> - </xs:sequence> - </xs:complexType> - </xs:element> - - <xs:simpleType name='empty'> - <xs:restriction base='xs:string'> - <xs:enumeration value=''/> - </xs:restriction> - </xs:simpleType> - </xs:schema> - ]]> - <![CDATA[ - <!-- Buddy's current activity --> - <xs:schema - xmlns:xs='http://www.w3.org/2001/XMLSchema' - targetNamespace='http://laptop.org/xmpp/current-activity' - xmlns='http://laptop.org/xmpp/current-activity' - elementFormDefault='qualified'> - - <!-- Published in the PEP node of the same namespace --> - <xs:element name='activity'> - <xs:complexType> - <!-- Despite its name, this attribute is actually the - OLPC activity ID! Historical reasons... - Empty if no current activity. --> - <xs:attribute name='type' type='xs:string'/> - <!-- XMPP MUC (bare) JID, or empty if no current activity --> - <xs:attribute name='room' type='xs:string'/> - </xs:complexType> - </xs:element> - - <xs:simpleType name='empty'> - <xs:restriction base='xs:string'> - <xs:enumeration value=''/> - </xs:restriction> - </xs:simpleType> - </xs:schema> - ]]> - </code> -</section1> -</xep> diff --git a/docs/telepathy-gabble.8.in b/docs/telepathy-gabble-1.8.in index 2dc96a0fb..46e69f426 100644 --- a/docs/telepathy-gabble.8.in +++ b/docs/telepathy-gabble-1.8.in @@ -1,12 +1,12 @@ -.TH TELEPATHY-GABBLE "8" "October 2007" "Telepathy" "D-Bus services" +.TH TELEPATHY-GABBLE-1 "8" "October 2007" "Telepathy" "D-Bus services" \" This man page was written by Simon McVittie for the Debian project, \" but may be used by others. \" Copyright © 2007 Collabora Ltd. <http://www.collabora.co.uk/> \" It may be distributed under the same terms as telepathy-gabble itself. .SH NAME -telepathy-gabble \- Telepathy connection manager for XMPP (Jabber) +telepathy-gabble-1 \- Telepathy connection manager for XMPP (Jabber) .SH SYNOPSIS -\fB@libexecdir@/telepathy\-gabble\fR +\fB@libexecdir@/telepathy\-gabble\-1\fR .SH DESCRIPTION Gabble implements the Telepathy D-Bus specification for XMPP (Jabber), allowing Telepathy clients like diff --git a/extensions/Connection_Interface_Gabble_Decloak.xml b/extensions/Connection_Interface_Gabble_Decloak.xml deleted file mode 100644 index 6157a2a38..000000000 --- a/extensions/Connection_Interface_Gabble_Decloak.xml +++ /dev/null @@ -1,113 +0,0 @@ -<?xml version="1.0" ?> -<node name="/Connection_Interface_Gabble_Decloak" xmlns:tp="http://telepathy.freedesktop.org/wiki/DbusSpec#extensions-v0"> - <tp:copyright>Copyright © 2010 Collabora Ltd.</tp:copyright> - <tp:license xmlns="http://www.w3.org/1999/xhtml"> - <p>This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version.</p> - - <p>This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details.</p> - - <p>You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, - USA.</p> - </tp:license> - - <interface name="org.freedesktop.Telepathy.Connection.Interface.Gabble.Decloak" - tp:causes-havoc="experimental"> - <tp:added version="Gabble 0.9.4">(Gabble-specific)</tp:added> - <tp:requires interface="org.freedesktop.Telepathy.Connection"/> - - <tp:docstring xmlns="http://www.w3.org/1999/xhtml"> - A simple D-Bus API for <a - href="http://xmpp.org/extensions/xep-0276.html">XEP-0276 Temporary - Presence Sharing</a>. See the XEP for more details. - </tp:docstring> - - <property name="DecloakAutomatically" - tp:name-for-bindings="Decloak_Automatically" - type="b" access="readwrite"> - <tp:docstring xmlns="http://www.w3.org/1999/xhtml"> - <p>If true, the connection manager will automatically disclose the - local user's capabilities (and hence the fact that they are online, - but no further presence information) on request from any remote XMPP - user.</p> - - <tp:rationale> - <p>This is necessary to allow incoming calls from arbitrary - users.</p> - </tp:rationale> - - <p>This property SHOULD also be available as a connection manager - parameter, with the DBus_Property flag. The default SHOULD be false - since this constitutes a deliberate presence leak.</p> - </tp:docstring> - </property> - - <signal name="DecloakRequested" tp:name-for-bindings="Decloak_Requested"> - <tp:docstring> - Emitted when a remote contact asks for the local user's capabilities - and basic presence to be disclosed. - </tp:docstring> - - <arg name="Contact" type="u" tp:type="Contact_Handle"> - <tp:docstring> - The contact asking for presence disclosure - </tp:docstring> - </arg> - - <arg name="Reason" type="s"> - <tp:docstring> - A code indicating the reason that decloaking is requested, or the - empty string if no reason code was given. As per the proto-XEP, - well-known values are 'media' (remote contact wants to call local - user), 'text' (remote contact wants to establish a text messaging - session, perhaps end-to-end encrypted), and 'file' (remote contact - wants to send the local user a file). - </tp:docstring> - </arg> - - <arg name="Decloaked" type="b"> - <tp:docstring> - If true, the connection manager automatically disclosed the local user's - capabilities and basic presence in response to the request, and this - signal is merely for information. If false, presence was not - automatically disclosed; a user interface MAY respond by calling - <tp:member-ref>SendDirectedPresence</tp:member-ref>. - </tp:docstring> - </arg> - </signal> - - <method name="SendDirectedPresence" - tp:name-for-bindings="Send_Directed_Presence"> - <tp:docstring> - Send directed presence to a contact. This MAY be called at any time, - but will typically be used as a response to - <tp:member-ref>DecloakRequested</tp:member-ref> - </tp:docstring> - - <arg direction="in" name="Contact" type="u" tp:type="Contact_Handle"> - <tp:docstring> - The contact to send directed presence to. - </tp:docstring> - </arg> - - <arg direction="in" name="Full" type="b"> - <tp:docstring> - If true, full presence (status, message, avatar hash etc.) will be - directed to the specified contact. If false, only capabilities and - the fact that the user is online at all will be directed to the - specified contact (the local user will appear to that contact as - being in 'available' status). - </tp:docstring> - </arg> - </method> - - </interface> -</node> -<!-- vim:set sw=2 sts=2 et ft=xml: --> diff --git a/extensions/Gabble_Plugin_Console.xml b/extensions/Gabble_Plugin_Console.xml index a2d94ca0c..fe9efde5f 100644 --- a/extensions/Gabble_Plugin_Console.xml +++ b/extensions/Gabble_Plugin_Console.xml @@ -19,7 +19,7 @@ USA.</p> </tp:license> - <interface name="org.freedesktop.Telepathy.Gabble.Plugin.Console"> + <interface name="im.telepathy.v1.Gabble.Plugin.Console"> <annotation name="org.freedesktop.DBus.Property.EmitsChangedSignal" value="true"/> <tp:docstring xmlns="http://www.w3.org/1999/xhtml"> diff --git a/extensions/Gabble_Plugin_Gateways.xml b/extensions/Gabble_Plugin_Gateways.xml index 4f1f50d55..3b630fb59 100644 --- a/extensions/Gabble_Plugin_Gateways.xml +++ b/extensions/Gabble_Plugin_Gateways.xml @@ -19,7 +19,7 @@ USA.</p> </tp:license> - <interface name="org.freedesktop.Telepathy.Gabble.Plugin.Gateways"> + <interface name="im.telepathy.v1.Gabble.Plugin.Gateways"> <tp:docstring xmlns="http://www.w3.org/1999/xhtml"> <p>A sidecar interface to register with XEP-0100 gateways.</p> </tp:docstring> @@ -63,10 +63,10 @@ </arg> <tp:possible-errors> - <tp:error name="org.freedesktop.Telepathy.Error.NetworkError"/> - <tp:error name="org.freedesktop.Telepathy.Error.NotAvailable"/> - <tp:error name="org.freedesktop.Telepathy.Error.NotImplemented"/> - <tp:error name="org.freedesktop.Telepathy.Error.PermissionDenied"/> + <tp:error name="im.telepathy.v1.Error.NetworkError"/> + <tp:error name="im.telepathy.v1.Error.NotAvailable"/> + <tp:error name="im.telepathy.v1.Error.NotImplemented"/> + <tp:error name="im.telepathy.v1.Error.PermissionDenied"/> </tp:possible-errors> </method> diff --git a/extensions/Gabble_Plugin_Test.xml b/extensions/Gabble_Plugin_Test.xml index a9d756981..7a37e1a9d 100644 --- a/extensions/Gabble_Plugin_Test.xml +++ b/extensions/Gabble_Plugin_Test.xml @@ -17,7 +17,7 @@ Lesser General Public License for more details.</p> License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.</p> </tp:license> - <interface name="org.freedesktop.Telepathy.Gabble.Plugin.Test"> + <interface name="im.telepathy.v1.Gabble.Plugin.Test"> <tp:docstring xmlns="http://www.w3.org/1999/xhtml"> <p>A sidecar interface implemented by a plugin used by the test suite.</p> diff --git a/extensions/Makefile.am b/extensions/Makefile.am index 70210adf8..f9469f0fc 100644 --- a/extensions/Makefile.am +++ b/extensions/Makefile.am @@ -2,12 +2,9 @@ tools_dir = $(top_srcdir)/tools EXTRA_DIST = \ all.xml \ - Connection_Interface_Gabble_Decloak.xml \ Gabble_Plugin_Console.xml \ Gabble_Plugin_Gateways.xml \ Gabble_Plugin_Test.xml \ - OLPC_Activity_Properties.xml \ - OLPC_Buddy_Info.xml \ $(NULL) noinst_LTLIBRARIES = libgabble-extensions.la diff --git a/extensions/OLPC_Activity_Properties.xml b/extensions/OLPC_Activity_Properties.xml deleted file mode 100644 index d1ea2afa5..000000000 --- a/extensions/OLPC_Activity_Properties.xml +++ /dev/null @@ -1,124 +0,0 @@ -<?xml version="1.0" ?> -<node name="/OLPC_Activity_Properties" xmlns:tp="http://telepathy.freedesktop.org/wiki/DbusSpec#extensions-v0"> - <tp:copyright> Copyright (C) 2007 Collabora Limited </tp:copyright> - <tp:license xmlns="http://www.w3.org/1999/xhtml"> - <p>This library is free software; you can redistribute it and/or -modify it under the terms of the GNU Lesser General Public -License as published by the Free Software Foundation; either -version 2.1 of the License, or (at your option) any later version.</p> - -<p>This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -Lesser General Public License for more details.</p> - -<p>You should have received a copy of the GNU Lesser General Public -License along with this library; if not, write to the Free Software -Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA</p> - </tp:license> - <interface name="org.laptop.Telepathy.ActivityProperties"> - <tp:requires interface="org.freedesktop.Telepathy.Connection"/> - - <method name="SetProperties" tp:name-for-bindings="Set_Properties"> - <arg direction="in" name="room" type="u"> - <tp:docstring> - An integer handle representing the room of the activity - </tp:docstring> - </arg> - <arg direction="in" name="properties" type="a{sv}"> - <tp:docstring> - A dictionary mapping properties names to the desired values - </tp:docstring> - </arg> - <tp:docstring> - Set the properties of the activity associated to the given room for this connection. - You have to be the owner of this activity. - </tp:docstring> - <tp:possible-errors> - <tp:error name="org.freedesktop.Telepathy.Error.Disconnected"/> - <tp:error name="org.freedesktop.Telepathy.Error.InvalidArgument"/> - <tp:error name="org.freedesktop.Telepathy.Error.PermissionDenied"/> - </tp:possible-errors> - </method> - - <method name="GetProperties" tp:name-for-bindings="Get_Properties"> - <arg direction="in" name="room" type="u"> - <tp:docstring> - An integer handle for the activity's room to request his properties for - </tp:docstring> - </arg> - <arg direction="out" name="properties" type="a{sv}"> - <tp:docstring> - A dictionary mapping properties names to their values - </tp:docstring> - </arg> - <tp:docstring> - Get the properties of a particular activity. - </tp:docstring> - <tp:possible-errors> - <tp:error name="org.freedesktop.Telepathy.Error.Disconnected"/> - <tp:error name="org.freedesktop.Telepathy.Error.InvalidArgument"/> - </tp:possible-errors> - </method> - - <method name="GetActivity" tp:name-for-bindings="Get_Activity"> - <arg direction="in" name="activity_id" type="s"> - <tp:docstring> - An activity id - </tp:docstring> - </arg> - <arg direction="out" name="room" type="u"> - <tp:docstring> - A room handle - </tp:docstring> - </arg> - <tp:docstring> - Returns the handle of the room associated with this activity - <tp:rationale> - <p>When an activity starts up, it knows its activity_id but doesn't - know yet if it's shared or not, much less the room.</p> - </tp:rationale> - </tp:docstring> - <tp:possible-errors> - <tp:error name="org.freedesktop.Telepathy.Error.Disconnected"/> - <tp:error name="org.freedesktop.Telepathy.Error.InvalidArgument"/> - </tp:possible-errors> - </method> - - <signal name="ActivityPropertiesChanged" - tp:name-for-bindings="Activity_Properties_Changed"> - <arg name="room" type="u"> - <tp:docstring> - An integer handle representing the room of the activity - </tp:docstring> - </arg> - <arg name="properties" type="a{sv}"> - <tp:docstring> - A dictionary mapping properties names to their new values - </tp:docstring> - </arg> - <tp:docstring> - Signal emitted when the properties of an activity are changed. - </tp:docstring> - </signal> - - <tp:docstring xmlns="http://www.w3.org/1999/xhtml"> - <p>An interface on connections to associate OLPC activity properties - with rooms.</p> - - <p>The following types and names are used to request and set properties:</p> - <dl> - <dt>s:color</dt> - <dd>The color of the activity. Format used is #RRGGBB,#RRGGBB (stroke,fill).</dd> - - <dt>s:name</dt> - <dd>The name of the activity.</dd> - - <dt>s:type</dt> - <dd>The type of the activity.</dd> - </dl> - - </tp:docstring> - </interface> -</node> -<!-- vim:set sw=2 sts=2 et ft=xml: --> diff --git a/extensions/OLPC_Buddy_Info.xml b/extensions/OLPC_Buddy_Info.xml deleted file mode 100644 index 7caf35c01..000000000 --- a/extensions/OLPC_Buddy_Info.xml +++ /dev/null @@ -1,285 +0,0 @@ -<?xml version="1.0" ?> -<node name="/OLPC_Buddy_Info" xmlns:tp="http://telepathy.freedesktop.org/wiki/DbusSpec#extensions-v0"> - <tp:copyright> Copyright (C) 2007 Collabora Limited </tp:copyright> - <tp:license xmlns="http://www.w3.org/1999/xhtml"> - <p>This library is free software; you can redistribute it and/or -modify it under the terms of the GNU Lesser General Public -License as published by the Free Software Foundation; either -version 2.1 of the License, or (at your option) any later version.</p> - -<p>This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -Lesser General Public License for more details.</p> - -<p>You should have received a copy of the GNU Lesser General Public -License along with this library; if not, write to the Free Software -Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA</p> - </tp:license> - <interface name="org.laptop.Telepathy.BuddyInfo"> - <tp:requires interface="org.freedesktop.Telepathy.Connection"/> - - <method name="SetProperties" tp:name-for-bindings="Set_Properties"> - <arg direction="in" name="properties" type="a{sv}"> - <tp:docstring> - A dictionary mapping information names to the desired values. - This replaces any existing buddy properties completely: any keys - which were previously present, but are not present in this dictionary, - are deleted. - </tp:docstring> - </arg> - <tp:docstring xmlns="http://www.w3.org/1999/xhtml"> - <p>Set the information of the local user for this connection.</p> - <p>This method may be called before Connect(), in which case the given - properties will be advertised as soon as possible after connection - (possibly immediately).</p> - </tp:docstring> - <tp:possible-errors> - <tp:error name="org.freedesktop.Telepathy.Error.InvalidArgument"/> - </tp:possible-errors> - </method> - - <method name="GetProperties" tp:name-for-bindings="Get_Properties"> - <arg direction="in" name="contact" type="u"> - <tp:docstring> - An integer handle for the contact to request his properties for - </tp:docstring> - </arg> - <arg direction="out" name="properties" type="a{sv}"> - <tp:docstring> - A dictionary mapping information names to their values - </tp:docstring> - </arg> - <tp:docstring> - Get the properties of a particular contact. - </tp:docstring> - <tp:possible-errors> - <tp:error name="org.freedesktop.Telepathy.Error.Disconnected"/> - <tp:error name="org.freedesktop.Telepathy.Error.InvalidArgument"/> - </tp:possible-errors> - </method> - - <signal name="PropertiesChanged" tp:name-for-bindings="Properties_Changed"> - <arg name="contact" type="u"> - <tp:docstring> - An integer handle representing the contact - </tp:docstring> - </arg> - <arg name="properties" type="a{sv}"> - <tp:docstring> - A dictionary mapping property names to their new values. All - properties are included, not just those that have changed. - </tp:docstring> - </arg> - <tp:docstring> - Signal emitted when the properties of a contact from your 'subscribe' - contact list are changed. - </tp:docstring> - </signal> - - - <tp:struct name="Activity" array-name="Activity_List"> - <tp:docstring>A struct containing: - <ul> - <li>the identifier of the activity</li> - <li>the room handle of the activity channel</li> - </ul> - </tp:docstring> - <tp:member type="s" name="id"/> - <tp:member type="u" tp:type="Room_Handle" name="room"/> - </tp:struct> - - <method name="SetActivities" tp:name-for-bindings="Set_Activities"> - <arg direction="in" name="activities" type="a(su)" tp:type="Activity[]"> - <tp:docstring xmlns="http://www.w3.org/1999/xhtml"> - An array of structs containing: - <ul> - <li>the identifier of the activity</li> - <li>the room handle of the activity channel</li> - </ul> - </tp:docstring> - </arg> - <tp:docstring> - Set the activities of the local user for this connection. - </tp:docstring> - <tp:possible-errors> - <tp:error name="org.freedesktop.Telepathy.Error.Disconnected"/> - <tp:error name="org.freedesktop.Telepathy.Error.InvalidArgument"/> - </tp:possible-errors> - </method> - - <method name="AddActivity" tp:name-for-bindings="Add_Activity"> - <arg direction="in" name="id" type="s"> - <tp:docstring> - An activity id - </tp:docstring> - </arg> - <arg direction="in" name="handle" type="u"> - <tp:docstring> - A room handle - </tp:docstring> - </arg> - <tp:docstring> - Advertise an activity associated to a muc room - <tp:rationale> - <p>Once an activity shares itself, needs to be advertised if it's not - private. SetActivities could be used for this but it would mean that - the activity would need to call GetActivities then add itself.</p> - </tp:rationale> - </tp:docstring> - <tp:possible-errors> - <tp:error name="org.freedesktop.Telepathy.Error.Disconnected"/> - <tp:error name="org.freedesktop.Telepathy.Error.InvalidArgument"/> - </tp:possible-errors> - </method> - - <method name="GetActivities" tp:name-for-bindings="Get_Activities"> - <arg direction="in" name="contact" type="u"> - <tp:docstring> - An integer handle for the contact whose activities are to be returned - </tp:docstring> - </arg> - <arg direction="out" name="activities" type="a(su)" tp:type="Activity[]"> - <tp:docstring xmlns="http://www.w3.org/1999/xhtml"> - An array of structs containing: - <ul> - <li>the identifier of the activity</li> - <li>the room handle of the activity channel</li> - </ul> - </tp:docstring> - </arg> - <tp:docstring> - Get the activities of a particular contact. - </tp:docstring> - <tp:possible-errors> - <tp:error name="org.freedesktop.Telepathy.Error.Disconnected"/> - <tp:error name="org.freedesktop.Telepathy.Error.InvalidArgument"/> - </tp:possible-errors> - </method> - - <signal name="ActivitiesChanged" tp:name-for-bindings="Activities_Changed"> - <arg name="contact" type="u"> - <tp:docstring> - An integer handle representing the contact - </tp:docstring> - </arg> - <arg name="activities" type="a(su)" tp:type="Activity[]"> - <tp:docstring xmlns="http://www.w3.org/1999/xhtml"> - An array of structs containing: - <ul> - <li>the identifier of the activity</li> - <li>the handle of the activity channel</li> - </ul> - </tp:docstring> - </arg> - <tp:docstring> - Signal emitted when the activities of a contact from your 'subscribe' - contact list are changed. - </tp:docstring> - </signal> - - <method name="SetCurrentActivity" - tp:name-for-bindings="Set_Current_Activity"> - <arg direction="in" name="activity" type="s"> - <tp:docstring> - The identifier of the activity, or the empty string if there is no - current activity - </tp:docstring> - </arg> - <arg direction="in" name="channel" type="u"> - <tp:docstring> - The room handle of the activity channel, or 0 if there is no current - activity - </tp:docstring> - </arg> - <tp:docstring> - Set the current activity of the local user for this connection. - </tp:docstring> - <tp:possible-errors> - <tp:error name="org.freedesktop.Telepathy.Error.Disconnected"/> - <tp:error name="org.freedesktop.Telepathy.Error.InvalidArgument"/> - </tp:possible-errors> - </method> - - <method name="GetCurrentActivity" - tp:name-for-bindings="Get_Current_Activity"> - <arg direction="in" name="contact" type="u"> - <tp:docstring> - An integer handle for the contact whose current activity is to be - returned - </tp:docstring> - </arg> - <arg direction="out" name="activity" type="s"> - <tp:docstring> - The identifier of the activity, or "" if there is no current activity - </tp:docstring> - </arg> - <arg direction="out" name="channel" type="u"> - <tp:docstring> - The room handle of the activity, or 0 if there is no current activity - </tp:docstring> - </arg> - <tp:docstring> - Get the current activity of a particular contact. - </tp:docstring> - <tp:possible-errors> - <tp:error name="org.freedesktop.Telepathy.Error.Disconnected"/> - <tp:error name="org.freedesktop.Telepathy.Error.InvalidArgument"/> - </tp:possible-errors> - </method> - - <signal name="CurrentActivityChanged" - tp:name-for-bindings="Current_Activity_Changed"> - <arg name="contact" type="u"> - <tp:docstring> - An integer handle representing the contact - </tp:docstring> - </arg> - <arg name="activity" type="s"> - <tp:docstring> - The identifier of the activity, or "" if there is no current activity - </tp:docstring> - </arg> - <arg name="channel" type="u"> - <tp:docstring> - The room handle of the activity channel, or 0 if there is no current - activity - </tp:docstring> - </arg> - <tp:docstring> - Signal emitted when the current activity of a contact from your 'subscribe' - contact list is changed. - </tp:docstring> - </signal> - - <tp:docstring xmlns="http://www.w3.org/1999/xhtml"> - <p>An interface on connections to associate OLPC buddy information - with contacts, providing methods for the user to set their own - information and retrieve information of contacts. - The user is automatically notified when information of contacts that - are in his 'subscribe' contact list change.</p> - - <p>The following types and names are used to request and set information - (except for activities):</p> - <dl> - <dt>s:color</dt> - <dd>The color name of the buddy. Format used is #RRGGBB,#RRGGBB - (stroke,fill). - </dd> - - <dt>ay:key</dt> - <dd>The public key of the buddy.</dd> - - <dt>s:jid</dt> - <dd>For link-local connections, the JID of the buddy's server account.</dd> - </dl> - - <p>Activities are represented by a struct containing:</p> - <ul> - <li>the identifier of the activity</li> - <li>the handle of the activity channel</li> - </ul> - </tp:docstring> - </interface> -</node> -<!-- vim:set sw=2 sts=2 et ft=xml: --> diff --git a/extensions/all.xml b/extensions/all.xml index b7c317422..300b2d08e 100644 --- a/extensions/all.xml +++ b/extensions/all.xml @@ -33,11 +33,6 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA</p> from="Telepathy specification"/> </tp:generic-types> -<xi:include href="OLPC_Buddy_Info.xml"/> -<xi:include href="OLPC_Activity_Properties.xml"/> - -<xi:include href="Connection_Interface_Gabble_Decloak.xml"/> - <xi:include href="Gabble_Plugin_Console.xml"/> <xi:include href="Gabble_Plugin_Gateways.xml"/> <xi:include href="Gabble_Plugin_Test.xml"/> diff --git a/gabble/Makefile.am b/gabble/Makefile.am index 1e729a0ca..b9728a635 100644 --- a/gabble/Makefile.am +++ b/gabble/Makefile.am @@ -3,7 +3,7 @@ if ENABLE_PLUGIN_API pkgconfigdir = $(libdir)/pkgconfig pkgconfig_DATA = telepathy-gabble.pc -gabbleincludedir = $(includedir)/telepathy-gabble-0/gabble +gabbleincludedir = $(includedir)/telepathy-gabble-1/gabble gabbleinclude_HEADERS = $(headers) else diff --git a/gabble/capabilities.h b/gabble/capabilities.h index dd0a0c901..8cc91aeea 100644 --- a/gabble/capabilities.h +++ b/gabble/capabilities.h @@ -45,7 +45,6 @@ const GabbleCapabilitySet *gabble_capabilities_get_any_google_av (void); const GabbleCapabilitySet *gabble_capabilities_get_any_jingle_av (void); const GabbleCapabilitySet *gabble_capabilities_get_any_transport (void); const GabbleCapabilitySet *gabble_capabilities_get_geoloc_notify (void); -const GabbleCapabilitySet *gabble_capabilities_get_olpc_notify (void); /* XEP-0115 version 1.3: * diff --git a/gabble/telepathy-gabble-uninstalled.pc.in b/gabble/telepathy-gabble-1-uninstalled.pc.in index f5d027fa0..639d53d1c 100644 --- a/gabble/telepathy-gabble-uninstalled.pc.in +++ b/gabble/telepathy-gabble-1-uninstalled.pc.in @@ -6,12 +6,12 @@ libdir=@libdir@ pluginexecdir=@pluginexecdir@ pluginexeclibdir=@pluginexeclibdir@ -gabblepath=@abs_top_builddir@/src/telepathy-gabble # For plugins' tests +gabblepath=@abs_top_builddir@/src/telepathy-gabble-1 # For plugins' tests Name: Telepathy-Gabble Description: XMPP backend for the Telepathy framework Version: @VERSION@ Requires: pkg-config >= 0.21 -Requires.private: glib-2.0 >= 2.32, gobject-2.0, gio-2.0, telepathy-glib >= 0.19.9 +Requires.private: glib-2.0 >= 2.32, gobject-2.0, gio-2.0, telepathy-glib-1, telepathy-glib-1-dbus Libs: ${abs_top_builddir}/src/libgabble-plugins.la Cflags: -I${abs_top_srcdir} -I${abs_top_srcdir}/lib/ext/wocky diff --git a/gabble/telepathy-gabble.pc.in b/gabble/telepathy-gabble-1.pc.in index 013ddbb55..0cd1108bb 100644 --- a/gabble/telepathy-gabble.pc.in +++ b/gabble/telepathy-gabble-1.pc.in @@ -5,12 +5,12 @@ includedir=@includedir@ libexecdir=@libexecdir@ pluginexecdir=@pluginexecdir@ pluginexeclibdir=@pluginexeclibdir@ -gabblepath=${libexecdir}/telepathy-gabble # For plugins' tests +gabblepath=${libexecdir}/telepathy-gabble-1 # For plugins' tests Name: Telepathy-Gabble Description: XMPP backend for the Telepathy framework Version: @VERSION@ Requires: pkg-config >= 0.21 -Requires.private: glib-2.0 >= 2.32, gobject-2.0, gio-2.0, telepathy-glib >= 0.19.9 +Requires.private: glib-2.0 >= 2.32, gobject-2.0, gio-2.0, telepathy-glib-1, telepathy-glib-1-dbus Libs: -L${pluginexeclibdir} -lgabble-plugins -lwocky -Cflags: -I${includedir}/telepathy-gabble-0 +Cflags: -I${includedir}/telepathy-gabble-1 diff --git a/plugins/Makefile.am b/plugins/Makefile.am index 2b0007901..536f49de9 100644 --- a/plugins/Makefile.am +++ b/plugins/Makefile.am @@ -30,14 +30,14 @@ if ENABLE_PLUGINS pluginexec_LTLIBRARIES = $(installable_plugins) dist_bin_SCRIPTS = \ - telepathy-gabble-xmpp-console + telepathy-gabble-1-xmpp-console else # we still compile the plugin (just to make sure it compiles!) but we don't # install it noinst_LTLIBRARIES += $(installable_plugins) EXTRA_DIST = \ - telepathy-gabble-xmpp-console + telepathy-gabble-1-xmpp-console endif AM_LDFLAGS = -avoid-version -shared -no-undefined diff --git a/plugins/console/channel-manager.c b/plugins/console/channel-manager.c index 2f4955225..b36c40541 100644 --- a/plugins/console/channel-manager.c +++ b/plugins/console/channel-manager.c @@ -173,7 +173,7 @@ gabble_console_channel_manager_class_init (GabbleConsoleChannelManagerClass *kla static const gchar * const allowed[] = { TP_PROP_CHANNEL_CHANNEL_TYPE, - TP_PROP_CHANNEL_TARGET_HANDLE_TYPE, + TP_PROP_CHANNEL_TARGET_ENTITY_TYPE, NULL }; @@ -184,7 +184,7 @@ gabble_console_channel_manager_type_foreach_channel_class (GType type, { GHashTable *table = tp_asv_new ( TP_PROP_CHANNEL_CHANNEL_TYPE, G_TYPE_STRING, GABBLE_IFACE_GABBLE_PLUGIN_CONSOLE, - TP_PROP_CHANNEL_TARGET_HANDLE_TYPE, G_TYPE_UINT, TP_HANDLE_TYPE_NONE, + TP_PROP_CHANNEL_TARGET_ENTITY_TYPE, G_TYPE_UINT, TP_ENTITY_TYPE_NONE, NULL); func (type, table, NULL, user_data); @@ -200,7 +200,7 @@ console_channel_closed_cb ( { GabbleConsoleChannelManager *self = GABBLE_CONSOLE_CHANNEL_MANAGER (user_data); - tp_channel_manager_emit_channel_closed_for_object (self, + tp_channel_manager_emit_channel_closed_for_object (TP_CHANNEL_MANAGER (self), TP_EXPORTABLE_CHANNEL (channel)); if (g_queue_remove (&self->console_channels, channel)) @@ -213,14 +213,14 @@ console_channel_closed_cb ( static gboolean gabble_console_channel_manager_create_channel ( TpChannelManager *manager, - gpointer request_token, + TpChannelManagerRequest *request, GHashTable *request_properties) { GabbleConsoleChannelManager *self = GABBLE_CONSOLE_CHANNEL_MANAGER (manager); GabblePluginConnection *connection; TpBaseChannel *channel = NULL; GError *error = NULL; - GSList *request_tokens; + GSList *requests; if (tp_strdiff (tp_asv_get_string (request_properties, TP_IFACE_CHANNEL ".ChannelType"), @@ -228,7 +228,7 @@ gabble_console_channel_manager_create_channel ( return FALSE; if (tp_asv_get_uint32 (request_properties, - TP_IFACE_CHANNEL ".TargetHandleType", NULL) != 0) + TP_IFACE_CHANNEL ".TargetEntityType", NULL) != 0) { g_set_error (&error, TP_ERROR, TP_ERROR_NOT_IMPLEMENTED, "Console channels can't have a target handle"); @@ -252,17 +252,17 @@ gabble_console_channel_manager_create_channel ( self); g_queue_push_tail (&self->console_channels, channel); - request_tokens = g_slist_prepend (NULL, request_token); - tp_channel_manager_emit_new_channel (self, - TP_EXPORTABLE_CHANNEL (channel), request_tokens); - g_slist_free (request_tokens); + requests = g_slist_prepend (NULL, request); + tp_channel_manager_emit_new_channel (TP_CHANNEL_MANAGER (self), + TP_EXPORTABLE_CHANNEL (channel), requests); + g_slist_free (requests); g_object_unref (connection); return TRUE; error: - tp_channel_manager_emit_request_failed (self, request_token, - error->domain, error->code, error->message); + tp_channel_manager_emit_request_failed (TP_CHANNEL_MANAGER (self), + request, error->domain, error->code, error->message); g_error_free (error); return TRUE; } diff --git a/plugins/telepathy-gabble-xmpp-console b/plugins/telepathy-gabble-1-xmpp-console index a72c92b55..ea5831563 100755 --- a/plugins/telepathy-gabble-xmpp-console +++ b/plugins/telepathy-gabble-1-xmpp-console @@ -31,7 +31,7 @@ from gi.repository import TelepathyGLib as Tp PADDING = 6 -CONSOLE_IFACE = "org.freedesktop.Telepathy.Gabble.Plugin.Console" +CONSOLE_IFACE = "im.telepathy.v1.Gabble.Plugin.Console" class StanzaViewer(Gtk.ScrolledWindow): def __init__(self): diff --git a/plugins/test.c b/plugins/test.c index e084b00e2..01c312dc3 100644 --- a/plugins/test.c +++ b/plugins/test.c @@ -25,7 +25,7 @@ static void plugin_iface_init ( gpointer g_iface, gpointer data); -#define IFACE_TEST "org.freedesktop.Telepathy.Gabble.Plugin.Test" +#define IFACE_TEST "im.telepathy.v1.Gabble.Plugin.Test" #define IFACE_TEST_PROPS IFACE_TEST ".Props" #define IFACE_TEST_BUGGY IFACE_TEST ".Buggy" #define IFACE_TEST_IQ IFACE_TEST ".IQ" @@ -613,7 +613,7 @@ test_channel_manager_type_foreach_channel_class (GType type, { GHashTable *table = tp_asv_new ( TP_PROP_CHANNEL_CHANNEL_TYPE, G_TYPE_STRING, "com.jonnylamb.lolbags", - TP_PROP_CHANNEL_TARGET_HANDLE_TYPE, G_TYPE_UINT, TP_HANDLE_TYPE_NONE, + TP_PROP_CHANNEL_TARGET_ENTITY_TYPE, G_TYPE_UINT, TP_ENTITY_TYPE_NONE, NULL); const gchar * const chock_a_block_full_of_strings[] = { "com.jonnylamb.omg", "com.jonnylamb.brokethebuild", NULL }; @@ -691,7 +691,6 @@ channel_manager_iface_init (gpointer g_iface, /* not requestable. */ iface->ensure_channel = NULL; iface->create_channel = NULL; - iface->request_channel = NULL; iface->foreach_channel_class = NULL; } diff --git a/src/Makefile.am b/src/Makefile.am index 6f5b47c71..76bb226bd 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -9,7 +9,7 @@ CLEANFILES = $(BUILT_SOURCES) EXTRA_DIST = -libexec_PROGRAMS=telepathy-gabble +libexec_PROGRAMS = telepathy-gabble-1 noinst_PROGRAMS = write-mgr-file libgabble_convenience_la_SOURCES = \ @@ -45,8 +45,6 @@ libgabble_convenience_la_SOURCES = \ conn-contact-info.c \ conn-location.h \ conn-location.c \ - conn-olpc.h \ - conn-olpc.c \ conn-power-saving.h \ conn-power-saving.c \ conn-presence.h \ @@ -84,8 +82,6 @@ libgabble_convenience_la_SOURCES = \ muc-tube-stream.h \ muc-tube-stream.c \ namespaces.h \ - olpc-activity.h \ - olpc-activity.c \ plugin-loader.h \ plugin-loader.c \ presence.h \ @@ -189,19 +185,19 @@ write_mgr_file_SOURCES = write-mgr-file.c write_mgr_file_LDADD = libgabble-convenience.la -telepathy_gabble_SOURCES = \ +telepathy_gabble_1_SOURCES = \ main.c check_c_sources = \ - $(telepathy_gabble_SOURCES) \ + $(telepathy_gabble_1_SOURCES) \ $(libgabble_convenience_la_SOURCES) \ $(write_mgr_file_SOURCES) include $(top_srcdir)/tools/check-coding-style.mk check-local: check-coding-style -telepathy_gabble_LDADD = libgabble-convenience.la +telepathy_gabble_1_LDADD = libgabble-convenience.la -telepathy_gabble_LDFLAGS = -export-dynamic +telepathy_gabble_1_LDFLAGS = -export-dynamic noinst_LTLIBRARIES = libgabble-convenience.la @@ -297,12 +293,12 @@ Android.mk: Makefile.am $(BUILT_SOURCES) -:CPPFLAGS $(CPPFLAGS) $(AM_CPPFLAGS) \ -:LDFLAGS $(libgabble_plugins_la_LDFLAGS) \ $(libgabble_plugins_la_LIBADD) \ - -:SHARED telepathy-gabble -:TAGS eng debug \ + -:SHARED telepathy-gabble-1 -:TAGS eng debug \ -:SOURCES $(libgabble_convenience_la_SOURCES) \ $(nodist_libgabble_convenience_la_SOURCES) main.c \ -:CFLAGS $(DEFS) $(CFLAGS) $(DEFAULT_INCLUDES) $(INCLUDES) \ $(AM_CFLAGS) -DBUILD_AS_ANDROID_SERVICE \ - -:CPPFLAGS $(CPPFLAGS) $(AM_CPPFLAGS) $(telepathy_gabble_LDFLAGS) \ - -:LDFLAGS $(telepathy_gabble_LDADD) $(libgabble_convenience_la_LIBADD) \ + -:CPPFLAGS $(CPPFLAGS) $(AM_CPPFLAGS) $(telepathy_gabble_1_LDFLAGS) \ + -:LDFLAGS $(telepathy_gabble_1_LDADD) $(libgabble_convenience_la_LIBADD) \ $(lib_LTLIBRARIES) \ > $@ diff --git a/src/auth-manager.c b/src/auth-manager.c index ad60d0883..a46d9937a 100644 --- a/src/auth-manager.c +++ b/src/auth-manager.c @@ -114,7 +114,7 @@ auth_channel_closed_cb (GabbleServerSaslChannel *channel, { SavedError tmp = { NULL, NULL, 0, NULL }; - tp_channel_manager_emit_channel_closed_for_object (self, + tp_channel_manager_emit_channel_closed_for_object (TP_CHANNEL_MANAGER (self), TP_EXPORTABLE_CHANNEL (channel)); g_assert (self->priv->channel == channel); @@ -371,7 +371,7 @@ gabble_auth_manager_start_auth_async (WockyAuthRegistry *registry, (TpBaseChannel *) self->priv->channel)); g_assert (tp_base_channel_is_registered ( (TpBaseChannel *) self->priv->channel)); - tp_channel_manager_emit_new_channel (self, + tp_channel_manager_emit_new_channel (TP_CHANNEL_MANAGER (self), TP_EXPORTABLE_CHANNEL (self->priv->channel), NULL); } else @@ -661,7 +661,6 @@ channel_manager_iface_init (gpointer g_iface, /* These channels are not requestable. */ iface->ensure_channel = NULL; iface->create_channel = NULL; - iface->request_channel = NULL; iface->foreach_channel_class = NULL; } diff --git a/src/bytestream-factory.c b/src/bytestream-factory.c index b3d50fc2a..44aa621fc 100644 --- a/src/bytestream-factory.c +++ b/src/bytestream-factory.c @@ -811,7 +811,7 @@ remove_bytestream (GabbleBytestreamFactory *self, "peer-handle-type", &handle_type, NULL); - if (handle_type == TP_HANDLE_TYPE_ROOM) + if (handle_type == TP_ENTITY_TYPE_ROOM) { table = priv->muc_bytestreams; } @@ -1123,9 +1123,9 @@ bytestream_factory_iq_si_cb ( GabbleBytestreamFactoryPrivate *priv = GABBLE_BYTESTREAM_FACTORY_GET_PRIVATE (self); TpHandleRepoIface *contact_repo = tp_base_connection_get_handles ( - (TpBaseConnection *) priv->conn, TP_HANDLE_TYPE_CONTACT); + (TpBaseConnection *) priv->conn, TP_ENTITY_TYPE_CONTACT); TpHandleRepoIface *room_repo = tp_base_connection_get_handles ( - (TpBaseConnection *) priv->conn, TP_HANDLE_TYPE_ROOM); + (TpBaseConnection *) priv->conn, TP_ENTITY_TYPE_ROOM); WockyNode *si; TpHandle peer_handle = 0, room_handle; GabbleBytestreamIface *bytestream = NULL; @@ -2009,9 +2009,9 @@ streaminit_reply_cb ( WockyNode *si; const gchar *from; TpHandleRepoIface *contact_repo = tp_base_connection_get_handles ( - (TpBaseConnection *) conn, TP_HANDLE_TYPE_CONTACT); + (TpBaseConnection *) conn, TP_ENTITY_TYPE_CONTACT); TpHandleRepoIface *room_repo = tp_base_connection_get_handles ( - (TpBaseConnection *) conn, TP_HANDLE_TYPE_ROOM); + (TpBaseConnection *) conn, TP_ENTITY_TYPE_ROOM); TpHandle peer_handle = 0; TpHandle room_handle; gboolean success = FALSE; diff --git a/src/bytestream-ibb.c b/src/bytestream-ibb.c index c413beb6a..4ec83c5ca 100644 --- a/src/bytestream-ibb.c +++ b/src/bytestream-ibb.c @@ -185,7 +185,7 @@ gabble_bytestream_ibb_get_property (GObject *object, g_value_set_uint (value, priv->peer_handle); break; case PROP_PEER_HANDLE_TYPE: - g_value_set_uint (value, TP_HANDLE_TYPE_CONTACT); + g_value_set_uint (value, TP_ENTITY_TYPE_CONTACT); break; case PROP_STREAM_ID: g_value_set_string (value, priv->stream_id); @@ -279,7 +279,7 @@ gabble_bytestream_ibb_constructor (GType type, g_assert (priv->stream_id != NULL); contact_repo = tp_base_connection_get_handles ( - (TpBaseConnection *) priv->conn, TP_HANDLE_TYPE_CONTACT); + (TpBaseConnection *) priv->conn, TP_ENTITY_TYPE_CONTACT); jid = tp_handle_inspect (contact_repo, priv->peer_handle); diff --git a/src/bytestream-iface.c b/src/bytestream-iface.c index 1788dceb7..4b35dcbd3 100644 --- a/src/bytestream-iface.c +++ b/src/bytestream-iface.c @@ -93,7 +93,7 @@ gabble_bytestream_iface_base_init (gpointer klass) param_spec = g_param_spec_uint ( "peer-handle-type", "Peer handle type", - "The TpHandleType of the remote peer's associated handle", + "The TpEntityType of the remote peer's associated handle", 0, G_MAXUINT32, 0, G_PARAM_READABLE | G_PARAM_STATIC_STRINGS); g_object_interface_install_property (klass, param_spec); diff --git a/src/bytestream-muc.c b/src/bytestream-muc.c index 6c0d28e47..edf5d3fd1 100644 --- a/src/bytestream-muc.c +++ b/src/bytestream-muc.c @@ -66,7 +66,7 @@ struct _GabbleBytestreamMucPrivate { GabbleConnection *conn; TpHandle peer_handle; - TpHandleType peer_handle_type; + TpEntityType peer_handle_type; gchar *stream_id; GabbleBytestreamState state; const gchar *peer_jid; @@ -149,7 +149,7 @@ gabble_bytestream_muc_get_property (GObject *object, g_value_set_uint (value, priv->peer_handle); break; case PROP_PEER_HANDLE_TYPE: - g_value_set_uint (value, TP_HANDLE_TYPE_ROOM); + g_value_set_uint (value, TP_ENTITY_TYPE_ROOM); break; case PROP_STREAM_ID: g_value_set_string (value, priv->stream_id); @@ -222,7 +222,7 @@ gabble_bytestream_muc_constructor (GType type, room_repo = tp_base_connection_get_handles ( - (TpBaseConnection *) priv->conn, TP_HANDLE_TYPE_ROOM); + (TpBaseConnection *) priv->conn, TP_ENTITY_TYPE_ROOM); priv->peer_jid = tp_handle_inspect (room_repo, priv->peer_handle); @@ -401,7 +401,7 @@ gabble_bytestream_muc_receive (GabbleBytestreamMuc *self, { GabbleBytestreamMucPrivate *priv = GABBLE_BYTESTREAM_MUC_GET_PRIVATE (self); TpHandleRepoIface *contact_repo = tp_base_connection_get_handles ( - (TpBaseConnection *) priv->conn, TP_HANDLE_TYPE_CONTACT); + (TpBaseConnection *) priv->conn, TP_ENTITY_TYPE_CONTACT); const gchar *from; WockyNode *data; GString *str; @@ -575,7 +575,7 @@ gabble_bytestream_muc_send_to (GabbleBytestreamMuc *self, { GabbleBytestreamMucPrivate *priv = GABBLE_BYTESTREAM_MUC_GET_PRIVATE (self); TpHandleRepoIface *contact_repo = tp_base_connection_get_handles ( - (TpBaseConnection *) priv->conn, TP_HANDLE_TYPE_CONTACT); + (TpBaseConnection *) priv->conn, TP_ENTITY_TYPE_CONTACT); const gchar *to; to = tp_handle_inspect (contact_repo, contact); diff --git a/src/bytestream-multiple.c b/src/bytestream-multiple.c index 49bdc5907..97ea44d46 100644 --- a/src/bytestream-multiple.c +++ b/src/bytestream-multiple.c @@ -155,7 +155,7 @@ gabble_bytestream_multiple_get_property (GObject *object, g_value_set_uint (value, priv->peer_handle); break; case PROP_PEER_HANDLE_TYPE: - g_value_set_uint (value, TP_HANDLE_TYPE_CONTACT); + g_value_set_uint (value, TP_ENTITY_TYPE_CONTACT); break; case PROP_STREAM_ID: g_value_set_string (value, priv->stream_id); @@ -258,7 +258,7 @@ gabble_bytestream_multiple_constructor (GType type, g_assert (priv->stream_id != NULL); contact_repo = tp_base_connection_get_handles ( - (TpBaseConnection *) priv->conn, TP_HANDLE_TYPE_CONTACT); + (TpBaseConnection *) priv->conn, TP_ENTITY_TYPE_CONTACT); jid = tp_handle_inspect (contact_repo, priv->peer_handle); diff --git a/src/bytestream-socks5.c b/src/bytestream-socks5.c index 48686d35f..25df58434 100644 --- a/src/bytestream-socks5.c +++ b/src/bytestream-socks5.c @@ -292,7 +292,7 @@ gabble_bytestream_socks5_get_property (GObject *object, g_value_set_uint (value, priv->peer_handle); break; case PROP_PEER_HANDLE_TYPE: - g_value_set_uint (value, TP_HANDLE_TYPE_CONTACT); + g_value_set_uint (value, TP_ENTITY_TYPE_CONTACT); break; case PROP_STREAM_ID: g_value_set_string (value, priv->stream_id); @@ -392,9 +392,9 @@ gabble_bytestream_socks5_constructor (GType type, base_conn = TP_BASE_CONNECTION (priv->conn); contact_repo = tp_base_connection_get_handles (base_conn, - TP_HANDLE_TYPE_CONTACT); + TP_ENTITY_TYPE_CONTACT); room_repo = tp_base_connection_get_handles (base_conn, - TP_HANDLE_TYPE_ROOM); + TP_ENTITY_TYPE_ROOM); jid = tp_handle_inspect (contact_repo, priv->peer_handle); diff --git a/src/call-channel.c b/src/call-channel.c index 6e247aa0d..e39d7c555 100644 --- a/src/call-channel.c +++ b/src/call-channel.c @@ -214,7 +214,7 @@ gabble_call_channel_class_init ( object_class->dispose = gabble_call_channel_dispose; object_class->finalize = gabble_call_channel_finalize; - base_channel_class->target_handle_type = TP_HANDLE_TYPE_CONTACT; + base_channel_class->target_entity_type = TP_ENTITY_TYPE_CONTACT; tp_base_call_class->add_content = call_channel_add_content; @@ -403,7 +403,7 @@ contact_is_media_capable (GabbleCallChannel *self, GabblePresence *presence; TpHandleRepoIface *contact_handles = tp_base_connection_get_handles (base_conn, - TP_HANDLE_TYPE_CONTACT); + TP_ENTITY_TYPE_CONTACT); gboolean wait = FALSE; presence = gabble_presence_cache_get (conn->presence_cache, handle); diff --git a/src/call-content.c b/src/call-content.c index 827dc2445..da9494d1d 100644 --- a/src/call-content.c +++ b/src/call-content.c @@ -237,7 +237,7 @@ call_content_local_media_description_updated (GabbleCallContent *self, WockyJingleMediaDescription *md = wocky_jingle_media_description_new (); md->codecs = codec_array_to_list (tp_asv_get_boxed (properties, - TP_PROP_CALL_CONTENT_MEDIA_DESCRIPTION_CODECS, + TP_PROP_CALL1_CONTENT_MEDIA_DESCRIPTION_CODECS, TP_ARRAY_TYPE_CODEC_LIST)); for (l = self->priv->contents; l != NULL; l = g_list_next (l)) @@ -313,7 +313,7 @@ call_content_setup_jingle (GabbleCallContent *self, if (tp_md != NULL) { md->codecs = codec_array_to_list (tp_asv_get_boxed (tp_md, - TP_PROP_CALL_CONTENT_MEDIA_DESCRIPTION_CODECS, + TP_PROP_CALL1_CONTENT_MEDIA_DESCRIPTION_CODECS, TP_ARRAY_TYPE_CODEC_LIST)); } diff --git a/src/call-muc-channel.c b/src/call-muc-channel.c index 1dbf3b23c..cd9a7e80b 100644 --- a/src/call-muc-channel.c +++ b/src/call-muc-channel.c @@ -58,7 +58,7 @@ static void call_muc_channel_close (TpBaseChannel *base); G_DEFINE_TYPE_WITH_CODE (GabbleCallMucChannel, gabble_call_muc_channel, GABBLE_TYPE_BASE_CALL_CHANNEL, G_IMPLEMENT_INTERFACE (G_TYPE_ASYNC_INITABLE, async_initable_iface_init); - G_IMPLEMENT_INTERFACE (TP_TYPE_SVC_CHANNEL_INTERFACE_GROUP, + G_IMPLEMENT_INTERFACE (TP_TYPE_SVC_CHANNEL_INTERFACE_GROUP1, tp_external_group_mixin_iface_init)); typedef enum @@ -222,7 +222,7 @@ gabble_call_muc_channel_class_init ( object_class->dispose = gabble_call_muc_channel_dispose; object_class->finalize = gabble_call_muc_channel_finalize; - base_channel_class->target_handle_type = TP_HANDLE_TYPE_ROOM; + base_channel_class->target_entity_type = TP_ENTITY_TYPE_ROOM; base_channel_class->close = call_muc_channel_close; base_call_class->add_content = call_muc_channel_add_content; @@ -292,7 +292,7 @@ call_muc_channel_got_codecs (GabbleCallMucChannel *self) tp_md = tp_base_media_call_content_get_local_media_description (content, 0); codecs = tp_asv_get_boxed (tp_md, - TP_PROP_CALL_CONTENT_MEDIA_DESCRIPTION_CODECS, + TP_PROP_CALL1_CONTENT_MEDIA_DESCRIPTION_CODECS, TP_ARRAY_TYPE_CODEC_LIST); if (codecs == NULL) @@ -555,7 +555,7 @@ call_muc_channel_send_new_state (GabbleCallMucChannel *self) tp_md = tp_base_media_call_content_get_local_media_description ( TP_BASE_MEDIA_CALL_CONTENT (content), 0); codecs = tp_asv_get_boxed (tp_md, - TP_PROP_CALL_CONTENT_MEDIA_DESCRIPTION_CODECS, + TP_PROP_CALL1_CONTENT_MEDIA_DESCRIPTION_CODECS, TP_ARRAY_TYPE_CODEC_LIST); for (i = 0; i < codecs->len; i++) { @@ -707,7 +707,7 @@ call_muc_channel_got_participant_presence (GabbleCallMucChannel *self, GabbleCallMucChannelPrivate *priv = self->priv; TpHandleRepoIface *contact_repo = tp_base_connection_get_handles ( tp_base_channel_get_connection (TP_BASE_CHANNEL (self)), - TP_HANDLE_TYPE_CONTACT); + TP_ENTITY_TYPE_CONTACT); GabbleCallMember *call_member; TpHandle handle; WockyNode *muji; @@ -796,7 +796,7 @@ call_muc_channel_left_cb (GObject *source, GabbleCallMucChannel *self = GABBLE_CALL_MUC_CHANNEL (user_data); TpHandleRepoIface *contact_repo = tp_base_connection_get_handles ( tp_base_channel_get_connection (TP_BASE_CHANNEL (self)), - TP_HANDLE_TYPE_CONTACT); + TP_ENTITY_TYPE_CONTACT); TpHandle handle; GabbleCallMember *call_member; @@ -1064,14 +1064,14 @@ gabble_call_muc_channel_new_async (GabbleConnection *connection, if (request != NULL) { initial_audio = tp_asv_get_boolean (request, - TP_PROP_CHANNEL_TYPE_CALL_INITIAL_AUDIO, NULL); + TP_PROP_CHANNEL_TYPE_CALL1_INITIAL_AUDIO, NULL); initial_video = tp_asv_get_boolean (request, - TP_PROP_CHANNEL_TYPE_CALL_INITIAL_VIDEO, NULL); + TP_PROP_CHANNEL_TYPE_CALL1_INITIAL_VIDEO, NULL); initial_audio_name = tp_asv_get_string (request, - TP_PROP_CHANNEL_TYPE_CALL_INITIAL_AUDIO_NAME); + TP_PROP_CHANNEL_TYPE_CALL1_INITIAL_AUDIO_NAME); initial_video_name = tp_asv_get_string (request, - TP_PROP_CHANNEL_TYPE_CALL_INITIAL_VIDEO_NAME); + TP_PROP_CHANNEL_TYPE_CALL1_INITIAL_VIDEO_NAME); } g_async_initable_new_async (GABBLE_TYPE_CALL_MUC_CHANNEL, @@ -1113,7 +1113,7 @@ gabble_call_muc_channel_incoming_session (GabbleCallMucChannel *self, GabbleCallMember *member; TpHandleRepoIface *contact_repo = tp_base_connection_get_handles ( tp_base_channel_get_connection (TP_BASE_CHANNEL (self)), - TP_HANDLE_TYPE_CONTACT); + TP_ENTITY_TYPE_CONTACT); const gchar *jid = wocky_jingle_session_get_peer_jid (session); TpHandle peer = tp_handle_ensure (contact_repo, jid, NULL, NULL); diff --git a/src/call-stream.c b/src/call-stream.c index 4653ff626..fc64d5018 100644 --- a/src/call-stream.c +++ b/src/call-stream.c @@ -388,7 +388,7 @@ gabble_call_stream_update_member_states (GabbleCallStream *self) TpSendingState remote_state; TpBaseConnection *conn = tp_base_call_stream_get_connection (base); TpHandleRepoIface *contact_repo = tp_base_connection_get_handles ( - conn, TP_HANDLE_TYPE_CONTACT); + conn, TP_ENTITY_TYPE_CONTACT); TpHandle peer; g_object_get (priv->content, "state", &state, NULL); diff --git a/src/capabilities.c b/src/capabilities.c index 1c4801fd8..d3b0ce48e 100644 --- a/src/capabilities.c +++ b/src/capabilities.c @@ -38,7 +38,6 @@ struct _Feature enum { FEATURE_FIXED, FEATURE_OPTIONAL, - FEATURE_OLPC } feature_type; gchar *ns; }; @@ -84,11 +83,6 @@ static const Feature self_advertised_features[] = { FEATURE_OPTIONAL, NS_JINGLE_RTP_VIDEO }, #endif - { FEATURE_OLPC, NS_OLPC_BUDDY_PROPS "+notify" }, - { FEATURE_OLPC, NS_OLPC_ACTIVITIES "+notify" }, - { FEATURE_OLPC, NS_OLPC_CURRENT_ACTIVITY "+notify" }, - { FEATURE_OLPC, NS_OLPC_ACTIVITY_PROPS "+notify" }, - { FEATURE_OPTIONAL, NS_GEOLOC "+notify" }, { 0, NULL } @@ -112,7 +106,6 @@ static GabbleCapabilitySet *any_jingle_av_caps = NULL; static GabbleCapabilitySet *any_transport_caps = NULL; static GabbleCapabilitySet *fixed_caps = NULL; static GabbleCapabilitySet *geoloc_caps = NULL; -static GabbleCapabilitySet *olpc_caps = NULL; const GabbleCapabilitySet * gabble_capabilities_get_legacy (void) @@ -192,12 +185,6 @@ gabble_capabilities_get_geoloc_notify (void) return geoloc_caps; } -const GabbleCapabilitySet * -gabble_capabilities_get_olpc_notify (void) -{ - return olpc_caps; -} - static gboolean omits_content_creators (WockyNode *identity) { @@ -256,7 +243,7 @@ gabble_capabilities_init (gpointer conn) /* TpDynamicHandleRepo wants a handle type, which isn't relevant here * (we're just using it as a string pool). Use an arbitrary handle type * to shut it up. */ - feature_handles = tp_dynamic_handle_repo_new (TP_HANDLE_TYPE_CONTACT, + feature_handles = tp_dynamic_handle_repo_new (TP_ENTITY_TYPE_CONTACT, NULL, NULL); /* make the pre-cooked bundles */ @@ -318,14 +305,6 @@ gabble_capabilities_init (gpointer conn) geoloc_caps = gabble_capability_set_new (); gabble_capability_set_add (geoloc_caps, NS_GEOLOC "+notify"); - - olpc_caps = gabble_capability_set_new (); - - for (feat = self_advertised_features; feat->ns != NULL; feat++) - { - if (feat->feature_type == FEATURE_OLPC) - gabble_capability_set_add (olpc_caps, feat->ns); - } } g_assert (feature_handles != NULL); @@ -355,7 +334,6 @@ gabble_capabilities_finalize (gpointer conn) #endif gabble_capability_set_free (fixed_caps); gabble_capability_set_free (geoloc_caps); - gabble_capability_set_free (olpc_caps); legacy_caps = NULL; share_v1_caps = NULL; @@ -370,7 +348,6 @@ gabble_capabilities_finalize (gpointer conn) any_transport_caps = NULL; fixed_caps = NULL; geoloc_caps = NULL; - olpc_caps = NULL; tp_clear_object (&feature_handles); } diff --git a/src/conn-addressing.c b/src/conn-addressing.c index 60431159d..834446fe6 100644 --- a/src/conn-addressing.c +++ b/src/conn-addressing.c @@ -34,58 +34,54 @@ static const char *assumed_interfaces[] = { TP_IFACE_CONNECTION, - TP_IFACE_CONNECTION_INTERFACE_ADDRESSING, + TP_IFACE_CONNECTION_INTERFACE_ADDRESSING1, NULL }; - -static void -_fill_contact_attributes (TpHandleRepoIface *contact_repo, +gboolean +conn_addressing_fill_contact_attributes (GabbleConnection *self, + const gchar *dbus_interface, TpHandle contact, - GHashTable *attributes_hash) + TpContactAttributeMap *attributes) { - gchar **uris = gabble_uris_for_handle (contact_repo, contact); - GHashTable *addresses = gabble_vcard_addresses_for_handle (contact_repo, contact); + TpHandleRepoIface *contact_repo; + gchar **uris; + GHashTable *addresses; - tp_contacts_mixin_set_contact_attribute (attributes_hash, - contact, TP_TOKEN_CONNECTION_INTERFACE_ADDRESSING_URIS, - tp_g_value_slice_new_take_boxed (G_TYPE_STRV, uris)); + if (tp_strdiff (dbus_interface, TP_IFACE_CONNECTION_INTERFACE_ADDRESSING1)) + return FALSE; - tp_contacts_mixin_set_contact_attribute (attributes_hash, - contact, TP_TOKEN_CONNECTION_INTERFACE_ADDRESSING_ADDRESSES, - tp_g_value_slice_new_take_boxed (TP_HASH_TYPE_STRING_STRING_MAP, addresses)); -} + contact_repo = tp_base_connection_get_handles ((TpBaseConnection *) self, + TP_ENTITY_TYPE_CONTACT); + uris = gabble_uris_for_handle (contact_repo, contact); + addresses = gabble_vcard_addresses_for_handle (contact_repo, contact); -static void -conn_addressing_fill_contact_attributes (GObject *obj, - const GArray *contacts, - GHashTable *attributes_hash) -{ - guint i; - TpHandleRepoIface *contact_repo = tp_base_connection_get_handles ( - (TpBaseConnection *) obj, TP_HANDLE_TYPE_CONTACT); + tp_contact_attribute_map_take_sliced_gvalue (attributes, + contact, TP_TOKEN_CONNECTION_INTERFACE_ADDRESSING1_URIS, + tp_g_value_slice_new_take_boxed (G_TYPE_STRV, uris)); - for (i = 0; i < contacts->len; i++) - { - TpHandle contact = g_array_index (contacts, TpHandle, i); - _fill_contact_attributes (contact_repo, contact, attributes_hash); - } + tp_contact_attribute_map_take_sliced_gvalue (attributes, + contact, TP_TOKEN_CONNECTION_INTERFACE_ADDRESSING1_ADDRESSES, + tp_g_value_slice_new_take_boxed (TP_HASH_TYPE_STRING_STRING_MAP, + addresses)); + + return TRUE; } static void -conn_addressing_get_contacts_by_uri (TpSvcConnectionInterfaceAddressing *iface, +conn_addressing_get_contacts_by_uri (TpSvcConnectionInterfaceAddressing1 *iface, const gchar **uris, const gchar **interfaces, DBusGMethodInvocation *context) { const gchar **uri; - TpHandleRepoIface *contact_repo = tp_base_connection_get_handles ( - (TpBaseConnection *) iface, TP_HANDLE_TYPE_CONTACT); + TpBaseConnection *base = TP_BASE_CONNECTION (iface); + TpHandleRepoIface *contact_repo = tp_base_connection_get_handles (base, + TP_ENTITY_TYPE_CONTACT); GHashTable *attributes; GHashTable *requested = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL); GArray *handles = g_array_sized_new (TRUE, TRUE, sizeof (TpHandle), g_strv_length ((gchar **) uris)); - gchar *sender = dbus_g_method_get_sender (context); for (uri = uris; *uri != NULL; uri++) { @@ -98,33 +94,32 @@ conn_addressing_get_contacts_by_uri (TpSvcConnectionInterfaceAddressing *iface, g_array_append_val (handles, h); } - attributes = tp_contacts_mixin_get_contact_attributes (G_OBJECT (iface), handles, - interfaces, assumed_interfaces, sender); + attributes = tp_base_connection_dup_contact_attributes_hash (base, handles, + interfaces, assumed_interfaces); - tp_svc_connection_interface_addressing_return_from_get_contacts_by_uri ( + tp_svc_connection_interface_addressing1_return_from_get_contacts_by_uri ( context, requested, attributes); g_array_unref (handles); g_hash_table_unref (requested); g_hash_table_unref (attributes); - g_free (sender); } static void -conn_addressing_get_contacts_by_vcard_field (TpSvcConnectionInterfaceAddressing *iface, +conn_addressing_get_contacts_by_vcard_field (TpSvcConnectionInterfaceAddressing1 *iface, const gchar *field, const gchar **addresses, const gchar **interfaces, DBusGMethodInvocation *context) { const gchar **address; - TpHandleRepoIface *contact_repo = tp_base_connection_get_handles ( - (TpBaseConnection *) iface, TP_HANDLE_TYPE_CONTACT); + TpBaseConnection *base = TP_BASE_CONNECTION (iface); + TpHandleRepoIface *contact_repo = tp_base_connection_get_handles (base, + TP_ENTITY_TYPE_CONTACT); GHashTable *attributes; GHashTable *requested = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL); GArray *handles = g_array_sized_new (TRUE, TRUE, sizeof (TpHandle), g_strv_length ((gchar **) addresses)); - gchar *sender = dbus_g_method_get_sender (context); for (address = addresses; *address != NULL; address++) { @@ -138,23 +133,20 @@ conn_addressing_get_contacts_by_vcard_field (TpSvcConnectionInterfaceAddressing g_array_append_val (handles, h); } - attributes = tp_contacts_mixin_get_contact_attributes (G_OBJECT (iface), handles, - interfaces, assumed_interfaces, sender); + attributes = tp_base_connection_dup_contact_attributes_hash (base, handles, + interfaces, assumed_interfaces); - tp_svc_connection_interface_addressing_return_from_get_contacts_by_vcard_field ( + tp_svc_connection_interface_addressing1_return_from_get_contacts_by_vcard_field ( context, requested, attributes); g_array_unref (handles); g_hash_table_unref (requested); g_hash_table_unref (attributes); - g_free (sender); } void -conn_addressing_init (GabbleConnection *self) { - tp_contacts_mixin_add_contact_attributes_iface (G_OBJECT (self), - TP_IFACE_CONNECTION_INTERFACE_ADDRESSING, - conn_addressing_fill_contact_attributes); +conn_addressing_init (GabbleConnection *self) +{ } void @@ -162,7 +154,7 @@ conn_addressing_iface_init (gpointer g_iface, gpointer iface_data) { #define IMPLEMENT(x) \ - tp_svc_connection_interface_addressing_implement_##x (\ + tp_svc_connection_interface_addressing1_implement_##x (\ g_iface, conn_addressing_##x) IMPLEMENT (get_contacts_by_uri); diff --git a/src/conn-addressing.h b/src/conn-addressing.h index 2dbe08756..223b67ddd 100644 --- a/src/conn-addressing.h +++ b/src/conn-addressing.h @@ -29,6 +29,11 @@ G_BEGIN_DECLS void conn_addressing_iface_init (gpointer g_iface, gpointer iface_data); void conn_addressing_init (GabbleConnection *self); +gboolean conn_addressing_fill_contact_attributes (GabbleConnection *self, + const gchar *dbus_interface, + TpHandle contact, + TpContactAttributeMap *attributes); + G_END_DECLS #endif /* GABBLE_CONN_ADDRESSING_H */ diff --git a/src/conn-aliasing.c b/src/conn-aliasing.c index e5bef80f7..3f803f151 100644 --- a/src/conn-aliasing.c +++ b/src/conn-aliasing.c @@ -45,33 +45,6 @@ static GabbleConnectionAliasSource _gabble_connection_get_cached_remote_alias ( static void maybe_request_vcard (GabbleConnection *self, TpHandle handle, GabbleConnectionAliasSource source); -/** - * gabble_connection_get_alias_flags - * - * Implements D-Bus method GetAliasFlags - * on interface org.freedesktop.Telepathy.Connection.Interface.Aliasing - * - * @error: Used to return a pointer to a GError detailing any error - * that occurred, D-Bus will throw the error only if this - * function returns FALSE. - * - * Returns: TRUE if successful, FALSE if an error was thrown. - */ -static void -gabble_connection_get_alias_flags (TpSvcConnectionInterfaceAliasing *iface, - DBusGMethodInvocation *context) -{ - TpBaseConnection *base = TP_BASE_CONNECTION (iface); - - g_assert (GABBLE_IS_CONNECTION (base)); - - TP_BASE_CONNECTION_ERROR_IF_NOT_CONNECTED (base, context); - - tp_svc_connection_interface_aliasing_return_from_get_alias_flags ( - context, TP_CONNECTION_ALIAS_FLAG_USER_SET); -} - - typedef struct _AliasesRequest AliasesRequest; struct _AliasesRequest @@ -144,7 +117,7 @@ aliases_request_try_return (AliasesRequest *request) /* Cast to (const gchar **) necessary because no-one understands 'const' * in C. */ - tp_svc_connection_interface_aliasing_return_from_request_aliases ( + tp_svc_connection_interface_aliasing1_return_from_request_aliases ( request->request_call, (const gchar **)request->aliases); return TRUE; } @@ -377,20 +350,20 @@ gabble_do_pep_request (GabbleConnection *self, * gabble_connection_request_aliases * * Implements D-Bus method RequestAliases - * on interface org.freedesktop.Telepathy.Connection.Interface.Aliasing + * on interface Connection.Interface.Aliasing * * @context: The D-Bus invocation context to use to return values * or throw an error. */ static void -gabble_connection_request_aliases (TpSvcConnectionInterfaceAliasing *iface, +gabble_connection_request_aliases (TpSvcConnectionInterfaceAliasing1 *iface, const GArray *contacts, DBusGMethodInvocation *context) { GabbleConnection *self = GABBLE_CONNECTION (iface); TpBaseConnection *base = (TpBaseConnection *) self; TpHandleRepoIface *contact_handles = tp_base_connection_get_handles (base, - TP_HANDLE_TYPE_CONTACT); + TP_ENTITY_TYPE_CONTACT); guint i; AliasesRequest *request; GError *error = NULL; @@ -490,7 +463,7 @@ set_one_alias ( { TpBaseConnection *base = (TpBaseConnection *) conn; TpHandleRepoIface *contact_handles = tp_base_connection_get_handles (base, - TP_HANDLE_TYPE_CONTACT); + TP_ENTITY_TYPE_CONTACT); gboolean ret = TRUE; g_assert (tp_base_connection_get_status (base) == @@ -586,10 +559,10 @@ set_one_alias ( * gabble_connection_set_aliases * * Implements D-Bus method SetAliases - * on interface org.freedesktop.Telepathy.Connection.Interface.Aliasing + * on interface Connection.Interface.Aliasing */ static void -gabble_connection_set_aliases (TpSvcConnectionInterfaceAliasing *iface, +gabble_connection_set_aliases (TpSvcConnectionInterfaceAliasing1 *iface, GHashTable *aliases, DBusGMethodInvocation *context) { @@ -614,7 +587,7 @@ gabble_connection_set_aliases (TpSvcConnectionInterfaceAliasing *iface, if (retval) { - tp_svc_connection_interface_aliasing_return_from_set_aliases ( + tp_svc_connection_interface_aliasing1_return_from_set_aliases ( context); } else @@ -631,7 +604,7 @@ _grab_nickname (GabbleConnection *self, { TpBaseConnection *base = (TpBaseConnection *) self; TpHandleRepoIface *contact_handles = tp_base_connection_get_handles (base, - TP_HANDLE_TYPE_CONTACT); + TP_ENTITY_TYPE_CONTACT); const gchar *old, *nickname; node = wocky_node_get_child_ns (node, "nick", NS_NICK); @@ -677,7 +650,7 @@ pep_nick_node_changed (WockyPepService *pep, GabbleConnection *conn) { TpHandleRepoIface *contact_repo = tp_base_connection_get_handles ( - (TpBaseConnection *) conn, TP_HANDLE_TYPE_CONTACT); + (TpBaseConnection *) conn, TP_ENTITY_TYPE_CONTACT); TpHandle handle; const gchar *jid; @@ -776,7 +749,7 @@ gabble_conn_aliasing_nicknames_updated (GObject *object, { GabbleConnection *conn = GABBLE_CONNECTION (user_data); GabbleConnectionAliasSource signal_source; - GPtrArray *aliases; + GHashTable *aliases; guint i; g_return_if_fail (handles->len > 0); @@ -804,14 +777,13 @@ gabble_conn_aliasing_nicknames_updated (GObject *object, return; } - aliases = g_ptr_array_sized_new (handles->len); + aliases = g_hash_table_new_full (NULL, NULL, NULL, g_free); for (i = 0; i < handles->len; i++) { TpHandle handle = g_array_index (handles, TpHandle, i); GabbleConnectionAliasSource current_source; gchar *alias = NULL; - GValue entry = { 0, }; current_source = _gabble_connection_get_cached_alias (conn, handle, &alias); @@ -829,16 +801,8 @@ gabble_conn_aliasing_nicknames_updated (GObject *object, continue; } - g_value_init (&entry, TP_STRUCT_TYPE_ALIAS_PAIR); - g_value_take_boxed (&entry, - dbus_g_type_specialized_construct (TP_STRUCT_TYPE_ALIAS_PAIR)); - - dbus_g_type_struct_set (&entry, - 0, handle, - 1, alias, - G_MAXUINT); - - g_ptr_array_add (aliases, g_value_get_boxed (&entry)); + g_hash_table_insert (aliases, GUINT_TO_POINTER (handle), + g_strdup (alias)); /* Check whether the roster has an entry for the handle and if so, set * the roster alias so the vCard isn't fetched on every connect. */ @@ -849,13 +813,10 @@ gabble_conn_aliasing_nicknames_updated (GObject *object, g_free (alias); } - if (aliases->len > 0) - tp_svc_connection_interface_aliasing_emit_aliases_changed (conn, aliases); - - for (i = 0; i < aliases->len; i++) - g_boxed_free (TP_STRUCT_TYPE_ALIAS_PAIR, g_ptr_array_index (aliases, i)); + if (g_hash_table_size (aliases) > 0) + tp_svc_connection_interface_aliasing1_emit_aliases_changed (conn, aliases); - g_ptr_array_unref (aliases); + g_hash_table_unref (aliases); } static void @@ -965,7 +926,7 @@ _gabble_connection_get_cached_alias (GabbleConnection *conn, { TpBaseConnection *base = (TpBaseConnection *) conn; TpHandleRepoIface *contact_handles = tp_base_connection_get_handles (base, - TP_HANDLE_TYPE_CONTACT); + TP_ENTITY_TYPE_CONTACT); const gchar *tmp, *jid; gboolean roster_alias_was_jid = FALSE; GabbleConnectionAliasSource source; @@ -1036,7 +997,7 @@ _gabble_connection_get_cached_remote_alias ( { TpBaseConnection *base = (TpBaseConnection *) conn; TpHandleRepoIface *contact_handles = tp_base_connection_get_handles (base, - TP_HANDLE_TYPE_CONTACT); + TP_ENTITY_TYPE_CONTACT); const gchar *jid = tp_handle_inspect (contact_handles, handle); g_assert (NULL != jid); @@ -1057,7 +1018,7 @@ maybe_request_vcard (GabbleConnection *self, TpHandle handle, if (self->features & GABBLE_CONNECTION_FEATURES_PEP) { TpHandleRepoIface *contact_handles = - tp_base_connection_get_handles (base, TP_HANDLE_TYPE_CONTACT); + tp_base_connection_get_handles (base, TP_ENTITY_TYPE_CONTACT); gabble_do_pep_request (self, handle, contact_handles, aliases_request_basic_pep_cb, GUINT_TO_POINTER (handle)); @@ -1070,16 +1031,14 @@ maybe_request_vcard (GabbleConnection *self, TpHandle handle, } } -static void -conn_aliasing_fill_contact_attributes (GObject *obj, - const GArray *contacts, GHashTable *attributes_hash) +gboolean +conn_aliasing_fill_contact_attributes (GabbleConnection *self, + const gchar *dbus_interface, + TpHandle handle, + TpContactAttributeMap *attributes) { - guint i; - GabbleConnection *self = GABBLE_CONNECTION(obj); - - for (i = 0; i < contacts->len; i++) + if (!tp_strdiff (dbus_interface, TP_IFACE_CONNECTION_INTERFACE_ALIASING1)) { - TpHandle handle = g_array_index (contacts, TpHandle, i); GabbleConnectionAliasSource source; gchar *alias; GValue *val = tp_g_value_slice_new (G_TYPE_STRING); @@ -1089,79 +1048,20 @@ conn_aliasing_fill_contact_attributes (GObject *obj, g_value_take_string (val, alias); - tp_contacts_mixin_set_contact_attribute (attributes_hash, - handle, TP_IFACE_CONNECTION_INTERFACE_ALIASING"/alias", + tp_contact_attribute_map_take_sliced_gvalue (attributes, + handle, TP_TOKEN_CONNECTION_INTERFACE_ALIASING1_ALIAS, val); maybe_request_vcard (self, handle, source); - } -} - -/** - * gabble_connection_get_aliases - * - * Implements D-Bus method GetAliases - * on interface org.freedesktop.Telepathy.Connection.Interface.Aliasing - * - * @context: The D-Bus invocation context to use to return values - * or throw an error. - */ -static void -gabble_connection_get_aliases (TpSvcConnectionInterfaceAliasing *iface, - const GArray *contacts, - DBusGMethodInvocation *context) -{ - GabbleConnection *self = GABBLE_CONNECTION (iface); - TpBaseConnection *base = (TpBaseConnection *) self; - TpHandleRepoIface *contact_handles = tp_base_connection_get_handles (base, - TP_HANDLE_TYPE_CONTACT); - GHashTable *result; - GError *error = NULL; - guint i; - - g_assert (GABBLE_IS_CONNECTION (self)); - - TP_BASE_CONNECTION_ERROR_IF_NOT_CONNECTED (base, context); - - if (!tp_handles_are_valid (contact_handles, contacts, FALSE, &error)) - { - dbus_g_method_return_error (context, error); - g_error_free (error); - return; - } - - result = g_hash_table_new_full (g_direct_hash, g_direct_equal, - NULL, g_free); - - for (i = 0; i < contacts->len; i++) - { - TpHandle handle = g_array_index (contacts, TpHandle, i); - GabbleConnectionAliasSource source; - gchar *alias; - - source = _gabble_connection_get_cached_alias (self, handle, &alias); - g_assert (alias != NULL); - - g_hash_table_insert (result, GUINT_TO_POINTER (handle), alias); - - maybe_request_vcard (self, handle, source); + return TRUE; } - tp_svc_connection_interface_aliasing_return_from_get_aliases (context, - result); - - g_hash_table_unref (result); + return FALSE; } - - void conn_aliasing_init (GabbleConnection *conn) { - tp_contacts_mixin_add_contact_attributes_iface (G_OBJECT (conn), - TP_IFACE_CONNECTION_INTERFACE_ALIASING, - conn_aliasing_fill_contact_attributes); - conn->pep_nick = wocky_pep_service_new (NS_NICK, TRUE); conn->pep_alias_cache = g_hash_table_new_full (NULL, NULL, NULL, g_free); @@ -1178,14 +1078,11 @@ conn_aliasing_finalize (GabbleConnection *conn) void conn_aliasing_iface_init (gpointer g_iface, gpointer iface_data) { - TpSvcConnectionInterfaceAliasingClass *klass = g_iface; + TpSvcConnectionInterfaceAliasing1Class *klass = g_iface; -#define IMPLEMENT(x) tp_svc_connection_interface_aliasing_implement_##x (\ +#define IMPLEMENT(x) tp_svc_connection_interface_aliasing1_implement_##x (\ klass, gabble_connection_##x) - IMPLEMENT(get_alias_flags); IMPLEMENT(request_aliases); - IMPLEMENT(get_aliases); IMPLEMENT(set_aliases); #undef IMPLEMENT } - diff --git a/src/conn-aliasing.h b/src/conn-aliasing.h index d165449b4..ad163d669 100644 --- a/src/conn-aliasing.h +++ b/src/conn-aliasing.h @@ -40,6 +40,11 @@ void gabble_conn_aliasing_nicknames_updated (GObject *object, GabbleConnectionAliasSource _gabble_connection_get_cached_alias ( GabbleConnection *, TpHandle, gchar **); +gboolean conn_aliasing_fill_contact_attributes (GabbleConnection *self, + const gchar *dbus_interface, + TpHandle handle, + TpContactAttributeMap *attributes); + G_END_DECLS #endif /* __CONN_ALIASING_H__ */ diff --git a/src/conn-avatars.c b/src/conn-avatars.c index 681a04df4..2d0cb88f9 100644 --- a/src/conn-avatars.c +++ b/src/conn-avatars.c @@ -54,7 +54,7 @@ update_own_avatar_sha1 (GabbleConnection *conn, if (!tp_strdiff (sha1, conn->self_presence->avatar_sha1)) return TRUE; - tp_svc_connection_interface_avatars_emit_avatar_updated (conn, + tp_svc_connection_interface_avatars1_emit_avatar_updated (conn, tp_base_connection_get_self_handle (base), sha1); g_free (conn->self_presence->avatar_sha1); @@ -89,7 +89,7 @@ connection_avatar_update_cb (GabblePresenceCache *cache, if (handle == tp_base_connection_get_self_handle (base)) update_own_avatar_sha1 (conn, sha1, NULL); else - tp_svc_connection_interface_avatars_emit_avatar_updated (conn, + tp_svc_connection_interface_avatars1_emit_avatar_updated (conn, handle, sha1); } @@ -120,160 +120,6 @@ static const char *mimetypes[] = { #define AVATAR_MAX_PX 96 #define AVATAR_MAX_BYTES 8192 -/** - * gabble_connection_get_avatar_requirements - * - * Implements D-Bus method GetAvatarRequirements - * on interface org.freedesktop.Telepathy.Connection.Interface.Avatars - * - * @error: Used to return a pointer to a GError detailing any error - * that occurred, D-Bus will throw the error only if this - * function returns FALSE. - * - * Returns: TRUE if successful, FALSE if an error was thrown. - */ -static void -gabble_connection_get_avatar_requirements (TpSvcConnectionInterfaceAvatars *iface, - DBusGMethodInvocation *context) -{ - - TP_BASE_CONNECTION_ERROR_IF_NOT_CONNECTED (TP_BASE_CONNECTION (iface), - context); - - tp_svc_connection_interface_avatars_return_from_get_avatar_requirements ( - context, mimetypes, AVATAR_MIN_PX, AVATAR_MIN_PX, - AVATAR_MAX_PX, AVATAR_MAX_PX, AVATAR_MAX_BYTES); -} - -/* begin deprecated code */ - -typedef struct { - DBusGMethodInvocation *invocation; - gchar **ret; - guint my_index; - gulong signal_conn; -} GetAvatarTokensContext; - -static void -_got_self_avatar_for_get_avatar_tokens (GObject *obj, - gchar *sha1, - gpointer user_data) -{ - GetAvatarTokensContext *context = (GetAvatarTokensContext *) user_data; - - g_signal_handler_disconnect (obj, context->signal_conn); - g_free (context->ret[context->my_index]); - context->ret[context->my_index] = g_strdup (sha1); - - /* Cast to (const gchar **) necessary because no-one understands 'const' - * in C. - */ - tp_svc_connection_interface_avatars_return_from_get_avatar_tokens ( - context->invocation, (const gchar **)context->ret); - g_strfreev (context->ret); - - g_slice_free (GetAvatarTokensContext, context); -} - - -/** - * gabble_connection_get_avatar_tokens - * - * Implements D-Bus method GetAvatarTokens - * on interface org.freedesktop.Telepathy.Connection.Interface.Avatars - * - * @context: The D-Bus invocation context to use to return values - * or throw an error. - */ -static void -gabble_connection_get_avatar_tokens (TpSvcConnectionInterfaceAvatars *iface, - const GArray *contacts, - DBusGMethodInvocation *invocation) -{ - GabbleConnection *self = GABBLE_CONNECTION (iface); - TpBaseConnection *base = (TpBaseConnection *) self; - gboolean wait_for_self_avatar = FALSE; - gboolean have_self_avatar; - guint i, my_index = 0; - gchar **ret; - GError *err = NULL; - TpHandleRepoIface *contact_handles = tp_base_connection_get_handles (base, - TP_HANDLE_TYPE_CONTACT); - - TP_BASE_CONNECTION_ERROR_IF_NOT_CONNECTED (base, invocation); - - if (!tp_handles_are_valid (contact_handles, contacts, FALSE, &err)) - { - dbus_g_method_return_error (invocation, err); - g_error_free (err); - return; - } - - g_object_get (self->vcard_manager, - "have-self-avatar", &have_self_avatar, - NULL); - - ret = g_new0 (gchar *, contacts->len + 1); - - /* TODO: always call the callback so we can defer presence lookups until - * we return the method, then we don't need to strdup the strings we're - * returning. */ - - for (i = 0; i < contacts->len; i++) - { - TpHandle handle; - GabblePresence *presence = NULL; - - handle = g_array_index (contacts, TpHandle, i); - - if (tp_base_connection_get_self_handle (base) == handle) - { - if (have_self_avatar) - { - presence = self->self_presence; - } - else - { - wait_for_self_avatar = TRUE; - my_index = i; - } - } - else - { - presence = gabble_presence_cache_get (self->presence_cache, handle); - } - - if (NULL != presence && NULL != presence->avatar_sha1) - ret[i] = g_strdup (presence->avatar_sha1); - else - ret[i] = g_strdup (""); - } - - if (wait_for_self_avatar) - { - GetAvatarTokensContext *context = g_slice_new (GetAvatarTokensContext); - - context->invocation = invocation; - context->my_index = my_index; - context->ret = ret; - context->signal_conn = g_signal_connect (self->vcard_manager, - "got-self-initial-avatar", - G_CALLBACK (_got_self_avatar_for_get_avatar_tokens), - context); - - return; - } - - /* Cast to (const gchar **) necessary because no-one understands 'const' - * in C. - */ - tp_svc_connection_interface_avatars_return_from_get_avatar_tokens ( - invocation, (const gchar **)ret); - g_strfreev (ret); -} - -/* end deprecated code */ - typedef struct { GabbleConnection *conn; DBusGMethodInvocation *invocation; @@ -298,7 +144,7 @@ _got_self_avatar_for_get_known_avatar_tokens (GObject *obj, GUINT_TO_POINTER (tp_base_connection_get_self_handle (base)), g_strdup (sha1)); - tp_svc_connection_interface_avatars_return_from_get_known_avatar_tokens ( + tp_svc_connection_interface_avatars1_return_from_get_known_avatar_tokens ( context->invocation, context->ret); g_hash_table_unref (context->ret); @@ -310,13 +156,13 @@ _got_self_avatar_for_get_known_avatar_tokens (GObject *obj, * gabble_connection_get_known_avatar_tokens * * Implements D-Bus method GetKnownAvatarTokens - * on interface org.freedesktop.Telepathy.Connection.Interface.Avatars + * on interface Connection.Interface.Avatars * * @context: The D-Bus invocation context to use to return values * or throw an error. */ static void -gabble_connection_get_known_avatar_tokens (TpSvcConnectionInterfaceAvatars *iface, +gabble_connection_get_known_avatar_tokens (TpSvcConnectionInterfaceAvatars1 *iface, const GArray *contacts, DBusGMethodInvocation *invocation) { @@ -328,7 +174,7 @@ gabble_connection_get_known_avatar_tokens (TpSvcConnectionInterfaceAvatars *ifac GHashTable *ret; GError *err = NULL; TpHandleRepoIface *contact_handles = tp_base_connection_get_handles (base, - TP_HANDLE_TYPE_CONTACT); + TP_ENTITY_TYPE_CONTACT); TP_BASE_CONNECTION_ERROR_IF_NOT_CONNECTED (base, invocation); @@ -397,7 +243,7 @@ gabble_connection_get_known_avatar_tokens (TpSvcConnectionInterfaceAvatars *ifac return; } - tp_svc_connection_interface_avatars_return_from_get_known_avatar_tokens ( + tp_svc_connection_interface_avatars1_return_from_get_known_avatar_tokens ( invocation, ret); g_hash_table_unref (ret); @@ -471,160 +317,7 @@ parse_avatar (WockyNode *vcard, } static void -_request_avatar_cb (GabbleVCardManager *self, - GabbleVCardManagerRequest *request, - TpHandle handle, - WockyNode *vcard, - GError *vcard_error, - gpointer user_data) -{ - DBusGMethodInvocation *context = (DBusGMethodInvocation *) user_data; - GabbleConnection *conn; - TpBaseConnection *base; - const gchar *mime_type = NULL; - GArray *arr; - GError *error = NULL; - GString *avatar = NULL; - GabblePresence *presence; - - g_object_get (self, "connection", &conn, NULL); - base = TP_BASE_CONNECTION (conn); - - if (NULL == vcard) - { - GError tp_error = { TP_ERROR, TP_ERROR_NOT_AVAILABLE, - vcard_error->message }; - - if (vcard_error->domain == WOCKY_XMPP_ERROR) - { - switch (vcard_error->code) - { - case WOCKY_XMPP_ERROR_NOT_AUTHORIZED: - case WOCKY_XMPP_ERROR_FORBIDDEN: - tp_error.code = TP_ERROR_PERMISSION_DENIED; - break; - case WOCKY_XMPP_ERROR_ITEM_NOT_FOUND: - tp_error.code = TP_ERROR_DOES_NOT_EXIST; - break; - } - /* what other mappings make sense here? */ - } - - dbus_g_method_return_error (context, &tp_error); - goto out; - } - - if (!parse_avatar (vcard, &mime_type, &avatar, &error)) - { - dbus_g_method_return_error (context, error); - g_error_free (error); - goto out; - } - - if (handle == tp_base_connection_get_self_handle (base)) - presence = conn->self_presence; - else - presence = gabble_presence_cache_get (conn->presence_cache, handle); - - if (presence != NULL) - { - gchar *sha1; - - sha1 = sha1_hex (avatar->str, avatar->len); - - if (tp_strdiff (presence->avatar_sha1, sha1)) - { - /* the thinking here is that we have to return an error, because we - * can't give the user the vcard they're expecting, which has the - * hash from the time that they requested it. */ - DEBUG ("treason uncloaked! avatar hash in presence does not match " - "avatar in vCard for handle %u", handle); - - g_set_error (&error, TP_ERROR, TP_ERROR_NOT_AVAILABLE, - "avatar hash in presence does not match avatar in vCard"); - dbus_g_method_return_error (context, error); - g_error_free (error); - error = NULL; - - if (handle == tp_base_connection_get_self_handle (base)) - { - update_own_avatar_sha1 (conn, sha1, NULL); - g_free (sha1); - } - else - { - g_free (presence->avatar_sha1); - presence->avatar_sha1 = sha1; /* take ownership */ - - tp_svc_connection_interface_avatars_emit_avatar_updated ( - conn, handle, sha1); - } - - goto out; - } - - g_free (sha1); - } - - arr = g_array_new (FALSE, FALSE, sizeof (gchar)); - g_array_append_vals (arr, avatar->str, avatar->len); - tp_svc_connection_interface_avatars_return_from_request_avatar ( - context, arr, mime_type); - g_array_unref (arr); - -out: - if (avatar != NULL) - g_string_free (avatar, TRUE); - - g_object_unref (conn); -} - - -/** - * gabble_connection_request_avatar - * - * Implements D-Bus method RequestAvatar - * on interface org.freedesktop.Telepathy.Connection.Interface.Avatars - * - * @context: The D-Bus invocation context to use to return values - * or throw an error. - */ -static void -gabble_connection_request_avatar (TpSvcConnectionInterfaceAvatars *iface, - guint contact, - DBusGMethodInvocation *context) -{ - GabbleConnection *self = GABBLE_CONNECTION (iface); - TpBaseConnection *base = (TpBaseConnection *) self; - TpHandleRepoIface *contact_handles = tp_base_connection_get_handles (base, - TP_HANDLE_TYPE_CONTACT); - GError *err = NULL; - WockyNode *vcard_node; - - TP_BASE_CONNECTION_ERROR_IF_NOT_CONNECTED (base, context); - - if (!tp_handle_is_valid (contact_handles, contact, &err)) - { - dbus_g_method_return_error (context, err); - g_error_free (err); - return; - } - - if (gabble_vcard_manager_get_cached (self->vcard_manager, - contact, &vcard_node)) - { - _request_avatar_cb (self->vcard_manager, NULL, contact, vcard_node, NULL, - context); - } - else - { - gabble_vcard_manager_request (self->vcard_manager, contact, 0, - _request_avatar_cb, context, NULL); - } -} - -static void -emit_avatar_retrieved (TpSvcConnectionInterfaceAvatars *iface, +emit_avatar_retrieved (TpSvcConnectionInterfaceAvatars1 *iface, TpHandle contact, WockyNode *vcard_node) { @@ -639,7 +332,7 @@ emit_avatar_retrieved (TpSvcConnectionInterfaceAvatars *iface, sha1 = sha1_hex (avatar_str->str, avatar_str->len); arr = g_array_new (FALSE, FALSE, sizeof (gchar)); g_array_append_vals (arr, avatar_str->str, avatar_str->len); - tp_svc_connection_interface_avatars_emit_avatar_retrieved (iface, contact, + tp_svc_connection_interface_avatars1_emit_avatar_retrieved (iface, contact, sha1, arr, mime_type); g_array_unref (arr); g_free (sha1); @@ -650,7 +343,7 @@ emit_avatar_retrieved (TpSvcConnectionInterfaceAvatars *iface, typedef struct { TpHandle handle; GabbleConnection *conn; - TpSvcConnectionInterfaceAvatars *iface; + TpSvcConnectionInterfaceAvatars1 *iface; } RequestAvatarsContext; static void @@ -676,14 +369,14 @@ request_avatars_cb (GabbleVCardManager *manager, } static void -gabble_connection_request_avatars (TpSvcConnectionInterfaceAvatars *iface, +gabble_connection_request_avatars (TpSvcConnectionInterfaceAvatars1 *iface, const GArray *contacts, DBusGMethodInvocation *context) { GabbleConnection *self = GABBLE_CONNECTION (iface); TpBaseConnection *base = (TpBaseConnection *) self; TpHandleRepoIface *contacts_repo = - tp_base_connection_get_handles (base, TP_HANDLE_TYPE_CONTACT); + tp_base_connection_get_handles (base, TP_ENTITY_TYPE_CONTACT); GError *error = NULL; guint i; @@ -726,7 +419,7 @@ gabble_connection_request_avatars (TpSvcConnectionInterfaceAvatars *iface, } } - tp_svc_connection_interface_avatars_return_from_request_avatars (context); + tp_svc_connection_interface_avatars1_return_from_request_avatars (context); } @@ -790,9 +483,9 @@ _set_avatar_cb2 (GabbleVCardManager *manager, if (conn_presence_signal_own_presence (ctx->conn, NULL, &error)) { - tp_svc_connection_interface_avatars_return_from_set_avatar ( + tp_svc_connection_interface_avatars1_return_from_set_avatar ( ctx->invocation, presence->avatar_sha1); - tp_svc_connection_interface_avatars_emit_avatar_updated ( + tp_svc_connection_interface_avatars1_emit_avatar_updated ( ctx->conn, tp_base_connection_get_self_handle (base), presence->avatar_sha1); } @@ -811,13 +504,13 @@ _set_avatar_cb2 (GabbleVCardManager *manager, * gabble_connection_set_avatar * * Implements D-Bus method SetAvatar - * on interface org.freedesktop.Telepathy.Connection.Interface.Avatars + * on interface Connection.Interface.Avatars * * @context: The D-Bus invocation context to use to return values * or throw an error. */ static void -gabble_connection_set_avatar (TpSvcConnectionInterfaceAvatars *iface, +gabble_connection_set_avatar (TpSvcConnectionInterfaceAvatars1 *iface, const GArray *avatar, const gchar *mime_type, DBusGMethodInvocation *context) @@ -879,29 +572,28 @@ gabble_connection_set_avatar (TpSvcConnectionInterfaceAvatars *iface, * gabble_connection_clear_avatar * * Implements D-Bus method ClearAvatar - * on interface org.freedesktop.Telepathy.Connection.Interface.Avatars + * on interface Connection.Interface.Avatars * * @context: The D-Bus invocation context to use to return values * or throw an error. */ static void -gabble_connection_clear_avatar (TpSvcConnectionInterfaceAvatars *iface, +gabble_connection_clear_avatar (TpSvcConnectionInterfaceAvatars1 *iface, DBusGMethodInvocation *context) { gabble_connection_set_avatar (iface, NULL, NULL, context); } -static void -conn_avatars_fill_contact_attributes (GObject *obj, - const GArray *contacts, GHashTable *attributes_hash) +gboolean +conn_avatars_fill_contact_attributes (GabbleConnection *self, + const gchar *dbus_interface, + TpHandle handle, + TpContactAttributeMap *attributes) { - guint i; - GabbleConnection *self = GABBLE_CONNECTION(obj); - TpBaseConnection *base = (TpBaseConnection *) self; + TpBaseConnection *base = TP_BASE_CONNECTION (self); - for (i = 0; i < contacts->len; i++) + if (!tp_strdiff (dbus_interface, TP_IFACE_CONNECTION_INTERFACE_AVATARS1)) { - TpHandle handle = g_array_index (contacts, guint, i); GabblePresence *presence = NULL; if (tp_base_connection_get_self_handle (base) == handle) @@ -918,10 +610,14 @@ conn_avatars_fill_contact_attributes (GObject *obj, else g_value_set_string (val, ""); - tp_contacts_mixin_set_contact_attribute (attributes_hash, handle, - TP_IFACE_CONNECTION_INTERFACE_AVATARS"/token", val); + tp_contact_attribute_map_take_sliced_gvalue (attributes, handle, + TP_TOKEN_CONNECTION_INTERFACE_AVATARS1_TOKEN, val); } + + return TRUE; } + + return FALSE; } @@ -934,24 +630,17 @@ conn_avatars_init (GabbleConnection *conn) (connection_got_self_initial_avatar_cb), conn); g_signal_connect (conn->presence_cache, "avatar-update", G_CALLBACK (connection_avatar_update_cb), conn); - - tp_contacts_mixin_add_contact_attributes_iface (G_OBJECT (conn), - TP_IFACE_CONNECTION_INTERFACE_AVATARS, - conn_avatars_fill_contact_attributes); } void conn_avatars_iface_init (gpointer g_iface, gpointer iface_data) { - TpSvcConnectionInterfaceAvatarsClass *klass = g_iface; + TpSvcConnectionInterfaceAvatars1Class *klass = g_iface; -#define IMPLEMENT(x) tp_svc_connection_interface_avatars_implement_##x (\ +#define IMPLEMENT(x) tp_svc_connection_interface_avatars1_implement_##x (\ klass, gabble_connection_##x) - IMPLEMENT(get_avatar_requirements); - IMPLEMENT(get_avatar_tokens); IMPLEMENT(get_known_avatar_tokens); - IMPLEMENT(request_avatar); IMPLEMENT(request_avatars); IMPLEMENT(set_avatar); IMPLEMENT(clear_avatar); diff --git a/src/conn-avatars.h b/src/conn-avatars.h index a26506d0c..1ea3c6cd9 100644 --- a/src/conn-avatars.h +++ b/src/conn-avatars.h @@ -41,6 +41,11 @@ void gabble_connection_dup_avatar_requirements (GStrv *supported_mime_types, guint *max_width, guint *max_bytes); +gboolean conn_avatars_fill_contact_attributes (GabbleConnection *self, + const gchar *dbus_interface, + TpHandle handle, + TpContactAttributeMap *attributes); + G_END_DECLS #endif /* __CONN_AVATARS_H__ */ diff --git a/src/conn-client-types.c b/src/conn-client-types.c index 2947534c0..7da31dce0 100644 --- a/src/conn-client-types.c +++ b/src/conn-client-types.c @@ -79,61 +79,7 @@ get_client_types_from_handle (GabbleConnection *conn, } static void -client_types_get_client_types (TpSvcConnectionInterfaceClientTypes *iface, - const GArray *contacts, - DBusGMethodInvocation *context) -{ - GabbleConnection *conn = GABBLE_CONNECTION (iface); - TpBaseConnection *base = (TpBaseConnection *) conn; - TpHandleRepoIface *contact_handles; - guint i; - GHashTable *client_types; - GError *error = NULL; - - /* Validate contacts */ - contact_handles = tp_base_connection_get_handles (base, - TP_HANDLE_TYPE_CONTACT); - - if (!tp_handles_are_valid (contact_handles, contacts, TRUE, &error)) - { - dbus_g_method_return_error (context, error); - g_error_free (error); - return; - } - - if (DEBUGGING) - { - DEBUG ("GetClientTypes called on the following handles:"); - - for (i = 0; i < contacts->len; i++) - { - DEBUG (" * %u", g_array_index (contacts, TpHandle, i)); - } - } - - client_types = g_hash_table_new_full (g_direct_hash, g_direct_equal, NULL, - (GDestroyNotify) g_strfreev); - - for (i = 0; i < contacts->len; i++) - { - TpHandle handle = g_array_index (contacts, TpHandle, i); - gchar **types; - - if (!get_client_types_from_handle (conn, handle, &types)) - continue; - - g_hash_table_insert (client_types, GUINT_TO_POINTER (handle), - types); - } - - tp_svc_connection_interface_client_types_return_from_get_client_types ( - context, client_types); - - g_hash_table_unref (client_types); -} - -static void -client_types_request_client_types (TpSvcConnectionInterfaceClientTypes *iface, +client_types_request_client_types (TpSvcConnectionInterfaceClientTypes1 *iface, TpHandle contact, DBusGMethodInvocation *context) { @@ -145,7 +91,7 @@ client_types_request_client_types (TpSvcConnectionInterfaceClientTypes *iface, /* Validate contact */ contact_handles = tp_base_connection_get_handles (base, - TP_HANDLE_TYPE_CONTACT); + TP_ENTITY_TYPE_CONTACT); if (!tp_handle_is_valid (contact_handles, contact, &error)) { @@ -164,7 +110,7 @@ client_types_request_client_types (TpSvcConnectionInterfaceClientTypes *iface, types = g_strdupv (empty); } - tp_svc_connection_interface_client_types_return_from_request_client_types ( + tp_svc_connection_interface_client_types1_return_from_request_client_types ( context, (const gchar **) types); g_strfreev (types); @@ -174,37 +120,37 @@ void conn_client_types_iface_init (gpointer g_iface, gpointer iface_data) { - TpSvcConnectionInterfaceClientTypesClass *klass = g_iface; + TpSvcConnectionInterfaceClientTypes1Class *klass = g_iface; -#define IMPLEMENT(x) tp_svc_connection_interface_client_types_implement_##x \ +#define IMPLEMENT(x) tp_svc_connection_interface_client_types1_implement_##x \ (klass, client_types_##x) - IMPLEMENT (get_client_types); IMPLEMENT (request_client_types); #undef IMPLEMENT } -static void -conn_client_types_fill_contact_attributes (GObject *obj, - const GArray *contacts, - GHashTable *attributes_hash) +gboolean +conn_client_types_fill_contact_attributes (GabbleConnection *self, + const gchar *dbus_interface, + TpHandle handle, + TpContactAttributeMap *attributes) { - GabbleConnection *conn = GABBLE_CONNECTION (obj); - guint i; - - for (i = 0; i < contacts->len; i++) + if (!tp_strdiff (dbus_interface, TP_IFACE_CONNECTION_INTERFACE_CLIENT_TYPES1)) { - TpHandle handle = g_array_index (contacts, TpHandle, i); GValue *val; gchar **types; - if (!get_client_types_from_handle (conn, handle, &types)) - continue; + if (!get_client_types_from_handle (self, handle, &types)) + return TRUE; val = tp_g_value_slice_new_take_boxed (G_TYPE_STRV, types); - tp_contacts_mixin_set_contact_attribute (attributes_hash, handle, - TP_IFACE_CONNECTION_INTERFACE_CLIENT_TYPES "/client-types", val); + tp_contact_attribute_map_take_sliced_gvalue (attributes, handle, + TP_TOKEN_CONNECTION_INTERFACE_CLIENT_TYPES1_CLIENT_TYPES, val); + + return TRUE; } + + return FALSE; } typedef struct @@ -236,7 +182,7 @@ idle_timeout (gpointer user_data) if (get_client_types_from_handle (data->conn, data->handle, &types)) { - tp_svc_connection_interface_client_types_emit_client_types_updated ( + tp_svc_connection_interface_client_types1_emit_client_types_updated ( data->conn, data->handle, (const gchar **) types); g_strfreev (types); } @@ -275,10 +221,6 @@ presence_cache_client_types_updated_cb (GabblePresenceCache *presence_cache, void conn_client_types_init (GabbleConnection *conn) { - tp_contacts_mixin_add_contact_attributes_iface (G_OBJECT (conn), - TP_IFACE_CONNECTION_INTERFACE_CLIENT_TYPES, - conn_client_types_fill_contact_attributes); - g_signal_connect (conn->presence_cache, "client-types-updated", G_CALLBACK (presence_cache_client_types_updated_cb), conn); } diff --git a/src/conn-client-types.h b/src/conn-client-types.h index 2e88dd7ee..d1096d6c7 100644 --- a/src/conn-client-types.h +++ b/src/conn-client-types.h @@ -29,6 +29,11 @@ void conn_client_types_iface_init (gpointer g_iface, gpointer iface_data); void conn_client_types_init (GabbleConnection *conn); +gboolean conn_client_types_fill_contact_attributes (GabbleConnection *self, + const gchar *dbus_interface, + TpHandle handle, + TpContactAttributeMap *attributes); + G_END_DECLS #endif /* __CONN_CLIENT_TYPES_H__ */ diff --git a/src/conn-contact-info.c b/src/conn-contact-info.c index 599197b9b..5295b0f61 100644 --- a/src/conn-contact-info.c +++ b/src/conn-contact-info.c @@ -372,7 +372,7 @@ _parse_vcard (WockyNode *vcard_node, } static void -_emit_contact_info_changed (TpSvcConnectionInterfaceContactInfo *iface, +_emit_contact_info_changed (TpSvcConnectionInterfaceContactInfo1 *iface, TpHandle contact, WockyNode *vcard_node) { @@ -383,7 +383,7 @@ _emit_contact_info_changed (TpSvcConnectionInterfaceContactInfo *iface, if (contact_info == NULL) return; - tp_svc_connection_interface_contact_info_emit_contact_info_changed ( + tp_svc_connection_interface_contact_info1_emit_contact_info_changed ( iface, contact, contact_info); g_boxed_free (TP_ARRAY_TYPE_CONTACT_INFO_FIELD_LIST, contact_info); @@ -409,70 +409,6 @@ _request_vcards_cb (GabbleVCardManager *manager, * in vcard_updated. */ } -/** - * gabble_connection_get_contact_info - * - * Implements D-Bus method GetContactInfo - * on interface org.freedesktop.Telepathy.Connection.Interface.ContactInfo - * - * @context: The D-Bus invocation context to use to return values - * or throw an error. - */ -static void -gabble_connection_get_contact_info ( - TpSvcConnectionInterfaceContactInfo *iface, - const GArray *contacts, - DBusGMethodInvocation *context) -{ - GabbleConnection *self = GABBLE_CONNECTION (iface); - TpBaseConnection *base = (TpBaseConnection *) self; - TpHandleRepoIface *contacts_repo = - tp_base_connection_get_handles (base, TP_HANDLE_TYPE_CONTACT); - GError *error = NULL; - guint i; - GHashTable *ret; - - TP_BASE_CONNECTION_ERROR_IF_NOT_CONNECTED (TP_BASE_CONNECTION (iface), - context); - - if (!tp_handles_are_valid (contacts_repo, contacts, FALSE, &error)) - { - dbus_g_method_return_error (context, error); - g_error_free (error); - return; - } - - ret = dbus_g_type_specialized_construct (TP_HASH_TYPE_CONTACT_INFO_MAP); - - for (i = 0; i < contacts->len; i++) - { - WockyNode *vcard_node; - TpHandle contact = g_array_index (contacts, TpHandle, i); - - if (gabble_vcard_manager_get_cached (self->vcard_manager, - contact, &vcard_node)) - { - GPtrArray *contact_info = _parse_vcard (vcard_node, NULL); - - /* we have the cached vcard but it cannot be parsed, skipping */ - if (contact_info == NULL) - { - DEBUG ("contact %d vcard is cached but cannot be parsed, " - "skipping.", contact); - continue; - } - - g_hash_table_insert (ret, GUINT_TO_POINTER (contact), - contact_info); - } - } - - tp_svc_connection_interface_contact_info_return_from_get_contact_info ( - context, ret); - - g_boxed_free (TP_HASH_TYPE_CONTACT_INFO_MAP, ret); -} - static void _return_from_request_contact_info (WockyNode *vcard_node, GError *vcard_error, @@ -515,7 +451,7 @@ _return_from_request_contact_info (WockyNode *vcard_node, return; } - tp_svc_connection_interface_contact_info_return_from_request_contact_info ( + tp_svc_connection_interface_contact_info1_return_from_request_contact_info ( context, contact_info); g_boxed_free (TP_ARRAY_TYPE_CONTACT_INFO_FIELD_LIST, contact_info); @@ -538,20 +474,20 @@ _request_vcard_cb (GabbleVCardManager *self, * gabble_connection_refresh_contact_info * * Implements D-Bus method RefreshContactInfo - * on interface org.freedesktop.Telepathy.Connection.Interface.ContactInfo + * on interface Connection.Interface.ContactInfo * * @context: The D-Bus invocation context to use to return values * or throw an error. */ static void -gabble_connection_refresh_contact_info (TpSvcConnectionInterfaceContactInfo *iface, +gabble_connection_refresh_contact_info (TpSvcConnectionInterfaceContactInfo1 *iface, const GArray *contacts, DBusGMethodInvocation *context) { GabbleConnection *self = GABBLE_CONNECTION (iface); TpBaseConnection *base = (TpBaseConnection *) self; TpHandleRepoIface *contacts_repo = - tp_base_connection_get_handles (base, TP_HANDLE_TYPE_CONTACT); + tp_base_connection_get_handles (base, TP_ENTITY_TYPE_CONTACT); GError *error = NULL; guint i; @@ -585,7 +521,7 @@ gabble_connection_refresh_contact_info (TpSvcConnectionInterfaceContactInfo *ifa } } - tp_svc_connection_interface_contact_info_return_from_refresh_contact_info ( + tp_svc_connection_interface_contact_info1_return_from_refresh_contact_info ( context); } @@ -593,20 +529,20 @@ gabble_connection_refresh_contact_info (TpSvcConnectionInterfaceContactInfo *ifa * gabble_connection_request_contact_info * * Implements D-Bus method RequestContactInfo - * on interface org.freedesktop.Telepathy.Connection.Interface.ContactInfo + * on interface Connection.Interface.ContactInfo * * @context: The D-Bus invocation context to use to return values * or throw an error. */ static void -gabble_connection_request_contact_info (TpSvcConnectionInterfaceContactInfo *iface, +gabble_connection_request_contact_info (TpSvcConnectionInterfaceContactInfo1 *iface, guint contact, DBusGMethodInvocation *context) { GabbleConnection *self = GABBLE_CONNECTION (iface); TpBaseConnection *base = (TpBaseConnection *) self; TpHandleRepoIface *contact_handles = tp_base_connection_get_handles (base, - TP_HANDLE_TYPE_CONTACT); + TP_ENTITY_TYPE_CONTACT); GError *err = NULL; WockyNode *vcard_node; @@ -714,7 +650,7 @@ _set_contact_info_cb (GabbleVCardManager *vcard_manager, } else { - tp_svc_connection_interface_contact_info_return_from_set_contact_info ( + tp_svc_connection_interface_contact_info1_return_from_set_contact_info ( context); } } @@ -723,13 +659,13 @@ _set_contact_info_cb (GabbleVCardManager *vcard_manager, * gabble_connection_set_contact_info * * Implements D-Bus method SetContactInfo - * on interface org.freedesktop.Telepathy.Connection.Interface.ContactInfo + * on interface Connection.Interface.ContactInfo * * @context: The D-Bus invocation context to use to return values * or throw an error. */ static void -gabble_connection_set_contact_info (TpSvcConnectionInterfaceContactInfo *iface, +gabble_connection_set_contact_info (TpSvcConnectionInterfaceContactInfo1 *iface, const GPtrArray *contact_info, DBusGMethodInvocation *context) { @@ -942,7 +878,7 @@ _vcard_updated (GObject *object, contact, &vcard_node)) { _emit_contact_info_changed ( - TP_SVC_CONNECTION_INTERFACE_CONTACT_INFO (conn), + TP_SVC_CONNECTION_INTERFACE_CONTACT_INFO1 (conn), contact, vcard_node); } } @@ -1096,36 +1032,38 @@ conn_contact_info_status_changed_cb (GabbleConnection *conn, } } -static void -conn_contact_info_fill_contact_attributes (GObject *obj, - const GArray *contacts, - GHashTable *attributes_hash) +gboolean +conn_contact_info_fill_contact_attributes (GabbleConnection *self, + const gchar *dbus_interface, + TpHandle contact, + TpContactAttributeMap *attributes) { - guint i; - GabbleConnection *self = GABBLE_CONNECTION (obj); - g_assert (self->vcard_manager != NULL); - for (i = 0; i < contacts->len; i++) + if (!tp_strdiff (dbus_interface, TP_IFACE_CONNECTION_INTERFACE_CONTACT_INFO1)) { - TpHandle contact = g_array_index (contacts, TpHandle, i); WockyNode *vcard_node; if (gabble_vcard_manager_get_cached (self->vcard_manager, contact, &vcard_node)) { GPtrArray *contact_info = _parse_vcard (vcard_node, NULL); + if (contact_info != NULL) { GValue *val = tp_g_value_slice_new_take_boxed ( TP_ARRAY_TYPE_CONTACT_INFO_FIELD_LIST, contact_info); - tp_contacts_mixin_set_contact_attribute (attributes_hash, - contact, TP_IFACE_CONNECTION_INTERFACE_CONTACT_INFO"/info", + tp_contact_attribute_map_take_sliced_gvalue (attributes, + contact, TP_TOKEN_CONNECTION_INTERFACE_CONTACT_INFO1_INFO, val); } } + + return TRUE; } + + return FALSE; } void @@ -1133,10 +1071,6 @@ conn_contact_info_init (GabbleConnection *conn) { g_assert (conn->vcard_manager != NULL); - tp_contacts_mixin_add_contact_attributes_iface (G_OBJECT (conn), - TP_IFACE_CONNECTION_INTERFACE_CONTACT_INFO, - conn_contact_info_fill_contact_attributes); - conn->contact_info_fields = conn_contact_info_build_supported_fields (conn, conn->vcard_manager); @@ -1157,11 +1091,10 @@ conn_contact_info_finalize (GabbleConnection *conn) void conn_contact_info_iface_init (gpointer g_iface, gpointer iface_data) { - TpSvcConnectionInterfaceContactInfoClass *klass = g_iface; + TpSvcConnectionInterfaceContactInfo1Class *klass = g_iface; -#define IMPLEMENT(x) tp_svc_connection_interface_contact_info_implement_##x (\ +#define IMPLEMENT(x) tp_svc_connection_interface_contact_info1_implement_##x (\ klass, gabble_connection_##x) - IMPLEMENT(get_contact_info); IMPLEMENT(refresh_contact_info); IMPLEMENT(request_contact_info); IMPLEMENT(set_contact_info); diff --git a/src/conn-contact-info.h b/src/conn-contact-info.h index a075daaa5..abde01cbe 100644 --- a/src/conn-contact-info.h +++ b/src/conn-contact-info.h @@ -34,6 +34,11 @@ extern TpDBusPropertiesMixinPropImpl *conn_contact_info_properties; void conn_contact_info_properties_getter (GObject *object, GQuark interface, GQuark name, GValue *value, gpointer getter_data); +gboolean conn_contact_info_fill_contact_attributes (GabbleConnection *self, + const gchar *dbus_interface, + TpHandle contact, + TpContactAttributeMap *attributes); + G_END_DECLS #endif /* __CONN_CONTACT_INFO_H__ */ diff --git a/src/conn-location.c b/src/conn-location.c index b51196641..54a76d3e7 100644 --- a/src/conn-location.c +++ b/src/conn-location.c @@ -98,7 +98,7 @@ get_cached_location (GabbleConnection *conn, const gchar *jid; TpHandleRepoIface *contact_repo; - contact_repo = tp_base_connection_get_handles (base, TP_HANDLE_TYPE_CONTACT); + contact_repo = tp_base_connection_get_handles (base, TP_ENTITY_TYPE_CONTACT); jid = tp_handle_inspect (contact_repo, handle); location = gabble_presence_cache_get_location (conn->presence_cache, handle); @@ -111,51 +111,6 @@ get_cached_location (GabbleConnection *conn, return location; } -static void -location_get_locations (TpSvcConnectionInterfaceLocation *iface, - const GArray *contacts, - DBusGMethodInvocation *context) -{ - GabbleConnection *conn = GABBLE_CONNECTION (iface); - TpBaseConnection *base = (TpBaseConnection *) conn; - TpHandleRepoIface *contact_handles; - guint i; - GError *error = NULL; - GHashTable *return_locations = g_hash_table_new_full (g_direct_hash, - g_direct_equal, NULL, (GDestroyNotify) g_hash_table_unref); - - DEBUG ("GetLocation for contacts:"); - - gabble_connection_ensure_capabilities (conn, - gabble_capabilities_get_geoloc_notify ()); - - /* Validate contacts */ - contact_handles = tp_base_connection_get_handles (base, - TP_HANDLE_TYPE_CONTACT); - - if (!tp_handles_are_valid (contact_handles, contacts, TRUE, &error)) - { - dbus_g_method_return_error (context, error); - g_error_free (error); - g_hash_table_unref (return_locations); - return; - } - - for (i = 0; i < contacts->len; i++) - { - TpHandle contact = g_array_index (contacts, TpHandle, i); - GHashTable *location = get_cached_location (conn, contact); - - if (location != NULL) - g_hash_table_insert (return_locations, GUINT_TO_POINTER (contact), - location); - } - - tp_svc_connection_interface_location_return_from_get_locations - (context, return_locations); - g_hash_table_unref (return_locations); -} - typedef struct { GabbleConnection *self; TpHandle handle; @@ -203,7 +158,7 @@ request_location_reply_cb (GObject *source, location = g_hash_table_new (NULL, NULL); } - tp_svc_connection_interface_location_return_from_request_location ( + tp_svc_connection_interface_location1_return_from_request_location ( ctx->context, location); g_hash_table_unref (location); } @@ -215,14 +170,14 @@ request_location_reply_cb (GObject *source, static void location_request_location ( - TpSvcConnectionInterfaceLocation *iface, + TpSvcConnectionInterfaceLocation1 *iface, TpHandle handle, DBusGMethodInvocation *context) { GabbleConnection *self = GABBLE_CONNECTION (iface); TpBaseConnection *base = (TpBaseConnection *) self; TpHandleRepoIface *contact_handles = tp_base_connection_get_handles (base, - TP_HANDLE_TYPE_CONTACT); + TP_ENTITY_TYPE_CONTACT); const gchar *jid; WockyBareContact *contact; YetAnotherContextStruct *ctx; @@ -347,7 +302,7 @@ set_location_sent_cb (GabbleConnection *conn, } static void -location_set_location (TpSvcConnectionInterfaceLocation *iface, +location_set_location (TpSvcConnectionInterfaceLocation1 *iface, GHashTable *location, DBusGMethodInvocation *context) { @@ -408,11 +363,10 @@ out: void location_iface_init (gpointer g_iface, gpointer iface_data) { - TpSvcConnectionInterfaceLocationClass *klass = g_iface; + TpSvcConnectionInterfaceLocation1Class *klass = g_iface; -#define IMPLEMENT(x) tp_svc_connection_interface_location_implement_##x \ +#define IMPLEMENT(x) tp_svc_connection_interface_location1_implement_##x \ (klass, location_##x) - IMPLEMENT(get_locations); IMPLEMENT(set_location); IMPLEMENT(request_location); #undef IMPLEMENT @@ -430,7 +384,7 @@ conn_location_properties_getter (GObject *object, if (!tp_strdiff (g_quark_to_string (name), "LocationAccessControlTypes")) { guint access_control_type = - TP_RICH_PRESENCE_ACCESS_CONTROL_TYPE_PUBLISH_LIST; + TP_ACCESS_CONTROL_TYPE_PUBLISH_LIST; GArray *access_control = g_array_sized_new (FALSE, FALSE, sizeof (guint), 1); @@ -449,7 +403,7 @@ conn_location_properties_getter (GObject *object, access_control = tp_value_array_build (2, G_TYPE_UINT, - (guint) TP_RICH_PRESENCE_ACCESS_CONTROL_TYPE_PUBLISH_LIST, + (guint) TP_ACCESS_CONTROL_TYPE_PUBLISH_LIST, G_TYPE_VALUE, &dummy, G_TYPE_INVALID); @@ -483,22 +437,21 @@ conn_location_properties_setter (GObject *object, GValue *access_control_argument; g_return_val_if_fail (interface == - TP_IFACE_QUARK_CONNECTION_INTERFACE_LOCATION, FALSE); + TP_IFACE_QUARK_CONNECTION_INTERFACE_LOCATION1, FALSE); /* There is only one property with write access. So TpDBusPropertiesMixin * already checked this. */ g_assert (name == g_quark_from_static_string ("LocationAccessControl")); /* TpDBusPropertiesMixin already checked that it was a (uv). */ - g_assert (G_VALUE_HOLDS (value, - TP_STRUCT_TYPE_RICH_PRESENCE_ACCESS_CONTROL)); + g_assert (G_VALUE_HOLDS (value, TP_STRUCT_TYPE_ACCESS_CONTROL)); tp_value_array_unpack (g_value_get_boxed (value), 2, &access_control_type, &access_control_argument); if (access_control_type != - TP_RICH_PRESENCE_ACCESS_CONTROL_TYPE_PUBLISH_LIST) + TP_ACCESS_CONTROL_TYPE_PUBLISH_LIST) { g_set_error (error, TP_ERROR, TP_ERROR_NOT_IMPLEMENTED, "Access control type not implemented"); @@ -518,7 +471,7 @@ update_location_from_item ( GHashTable *location = g_hash_table_new_full (g_direct_hash, g_direct_equal, g_free, (GDestroyNotify) tp_g_value_slice_free); TpHandleRepoIface *contact_repo = tp_base_connection_get_handles ( - (TpBaseConnection *) conn, TP_HANDLE_TYPE_CONTACT); + (TpBaseConnection *) conn, TP_ENTITY_TYPE_CONTACT); const gchar *from = tp_handle_inspect (contact_repo, contact); WockyNodeIter i; WockyNode *subloc_node; @@ -602,7 +555,7 @@ update_location_from_item ( g_hash_table_insert (location, g_strdup (mapping->tp_name), value); } - tp_svc_connection_interface_location_emit_location_updated (conn, + tp_svc_connection_interface_location1_emit_location_updated (conn, contact, location); gabble_presence_cache_update_location (conn->presence_cache, contact, location); @@ -618,7 +571,7 @@ location_pep_node_changed (WockyPepService *pep, GabbleConnection *conn) { TpHandleRepoIface *contact_repo = tp_base_connection_get_handles ( - (TpBaseConnection *) conn, TP_HANDLE_TYPE_CONTACT); + (TpBaseConnection *) conn, TP_ENTITY_TYPE_CONTACT); TpBaseConnection *base = (TpBaseConnection *) conn; TpHandle handle; const gchar *jid; @@ -638,17 +591,14 @@ location_pep_node_changed (WockyPepService *pep, update_location_from_item (conn, handle, item_node); } -static void -conn_location_fill_contact_attributes (GObject *obj, - const GArray *contacts, - GHashTable *attributes_hash) +gboolean +conn_location_fill_contact_attributes (GabbleConnection *self, + const gchar *dbus_interface, + TpHandle handle, + TpContactAttributeMap *attributes) { - GabbleConnection *self = GABBLE_CONNECTION (obj); - guint i; - - for (i = 0; i < contacts->len; i++) + if (!tp_strdiff (dbus_interface, TP_IFACE_CONNECTION_INTERFACE_LOCATION1)) { - TpHandle handle = g_array_index (contacts, TpHandle, i); GHashTable *location = get_cached_location (self, handle); if (location != NULL) @@ -656,19 +606,19 @@ conn_location_fill_contact_attributes (GObject *obj, GValue *val = tp_g_value_slice_new_take_boxed ( TP_HASH_TYPE_STRING_VARIANT_MAP, location); - tp_contacts_mixin_set_contact_attribute (attributes_hash, - handle, TP_IFACE_CONNECTION_INTERFACE_LOCATION"/location", val); + tp_contact_attribute_map_take_sliced_gvalue (attributes, + handle, TP_TOKEN_CONNECTION_INTERFACE_LOCATION1_LOCATION, val); } + + return TRUE; } + + return FALSE; } void conn_location_init (GabbleConnection *conn) { - tp_contacts_mixin_add_contact_attributes_iface (G_OBJECT (conn), - TP_IFACE_CONNECTION_INTERFACE_LOCATION, - conn_location_fill_contact_attributes); - conn->pep_location = wocky_pep_service_new (NS_GEOLOC, TRUE); g_signal_connect (conn->pep_location, "changed", diff --git a/src/conn-location.h b/src/conn-location.h index fa2d707a6..b7e594702 100644 --- a/src/conn-location.h +++ b/src/conn-location.h @@ -16,6 +16,11 @@ gboolean conn_location_properties_setter (GObject *object, GQuark interface, void conn_location_init (GabbleConnection *conn); +gboolean conn_location_fill_contact_attributes (GabbleConnection *self, + const gchar *dbus_interface, + TpHandle handle, + TpContactAttributeMap *attributes); + G_END_DECLS #endif /* __CONN_LOCATION_H__ */ diff --git a/src/conn-mail-notif.c b/src/conn-mail-notif.c index afefdf7de..9537fd859 100644 --- a/src/conn-mail-notif.c +++ b/src/conn-mail-notif.c @@ -115,7 +115,7 @@ return_from_request_inbox_url (GabbleConnection *conn) if (error != NULL) dbus_g_method_return_error (context, error); else - tp_svc_connection_interface_mail_notification_return_from_request_inbox_url ( + tp_svc_connection_interface_mail_notification1_return_from_request_inbox_url ( context, result); it = g_list_next (it); @@ -159,7 +159,7 @@ check_supported_or_dbus_return (GabbleConnection *conn, static void gabble_mail_notification_request_inbox_url ( - TpSvcConnectionInterfaceMailNotification *iface, + TpSvcConnectionInterfaceMailNotification1 *iface, DBusGMethodInvocation *context) { GabbleConnection *conn = GABBLE_CONNECTION (iface); @@ -179,7 +179,7 @@ gabble_mail_notification_request_inbox_url ( static void gabble_mail_notification_request_mail_url ( - TpSvcConnectionInterfaceMailNotification *iface, + TpSvcConnectionInterfaceMailNotification1 *iface, const gchar *in_id, const GValue *in_url_data, DBusGMethodInvocation *context) @@ -211,7 +211,7 @@ gabble_mail_notification_request_mail_url ( TP_ARRAY_TYPE_HTTP_POST_DATA_LIST, empty_array, G_TYPE_INVALID); - tp_svc_connection_interface_mail_notification_return_from_request_mail_url ( + tp_svc_connection_interface_mail_notification1_return_from_request_mail_url ( context, result); tp_value_array_free (result); @@ -457,7 +457,7 @@ store_unread_mails (GabbleConnection *conn, else priv->unread_count = g_hash_table_size (priv->unread_mails); - tp_svc_connection_interface_mail_notification_emit_unread_mails_changed ( + tp_svc_connection_interface_mail_notification1_emit_unread_mails_changed ( conn, priv->unread_count, collector.mails_added, (const char **)mails_removed->pdata); @@ -706,10 +706,10 @@ conn_mail_notif_init (GabbleConnection *conn) G_CALLBACK (connection_status_changed), conn); g_signal_connect (conn, - "clients-interested::" TP_IFACE_CONNECTION_INTERFACE_MAIL_NOTIFICATION, + "clients-interested::" TP_IFACE_CONNECTION_INTERFACE_MAIL_NOTIFICATION1, G_CALLBACK (mail_clients_interested_cb), NULL); g_signal_connect (conn, - "clients-uninterested::" TP_IFACE_CONNECTION_INTERFACE_MAIL_NOTIFICATION, + "clients-uninterested::" TP_IFACE_CONNECTION_INTERFACE_MAIL_NOTIFICATION1, G_CALLBACK (mail_clients_uninterested_cb), NULL); } @@ -748,9 +748,9 @@ void conn_mail_notif_iface_init (gpointer g_iface, gpointer iface_data) { - TpSvcConnectionInterfaceMailNotificationClass *klass = g_iface; + TpSvcConnectionInterfaceMailNotification1Class *klass = g_iface; -#define IMPLEMENT(x) tp_svc_connection_interface_mail_notification_implement_##x (\ +#define IMPLEMENT(x) tp_svc_connection_interface_mail_notification1_implement_##x (\ klass, gabble_mail_notification_##x) IMPLEMENT (request_inbox_url); IMPLEMENT (request_mail_url); @@ -833,7 +833,7 @@ conn_mail_notif_properties_getter (GObject *object, { TpBaseConnection *base = TP_BASE_CONNECTION (object); TpHandleRepoIface *contact_handles = - tp_base_connection_get_handles (base, TP_HANDLE_TYPE_CONTACT); + tp_base_connection_get_handles (base, TP_ENTITY_TYPE_CONTACT); TpHandle self = tp_base_connection_get_self_handle (base); const gchar *bare_jid = tp_handle_inspect (contact_handles, self); diff --git a/src/conn-olpc.c b/src/conn-olpc.c deleted file mode 100644 index 46fef4b0d..000000000 --- a/src/conn-olpc.c +++ /dev/null @@ -1,3081 +0,0 @@ -/* - * conn-olpc.c - Gabble OLPC BuddyInfo and ActivityProperties interfaces - * Copyright (C) 2007 Collabora Ltd. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include "config.h" -#include "conn-olpc.h" - -#include <string.h> -#include <stdlib.h> - -#include <telepathy-glib/telepathy-glib.h> - -#define DEBUG_FLAG GABBLE_DEBUG_OLPC - -#include <gabble/error.h> - -#include "debug.h" -#include "connection.h" -#include "muc-channel.h" -#include "presence-cache.h" -#include "namespaces.h" -#include "disco.h" -#include "util.h" -#include "olpc-activity.h" - -/* FIXME: At some point we should audit this code to check which assumptions - * it does about buddy and activity and if they are still relevant. - * For example, we currently allow the creation of activity objects which - * don't have an ID. I'm not sure that really make sense. - * Or at some place in the code, we allow user to change the ID of an existing - * activity object which is probably bong too. */ - -static gboolean -update_activities_properties (GabbleConnection *conn, const gchar *contact, - WockyStanza *msg); - -/* - * This function performs a depth-first search on @node to find any element - * named @name in namespace @ns. This is usually not what you want because you - * don't want a depth-first search of the entire hierarchy: you know at what - * level of nesting you expect to find an element. Using this function rather - * than wocky_node_get_child_ns() a couple of times opens you up to accepting - * wildly misconstructed stanzas. Please think of the kittens. - */ -static WockyNode * -search_for_child ( - WockyNode *node, - const gchar *name, - const gchar *ns) -{ - WockyNode *found, *child; - WockyNodeIter i; - - found = wocky_node_get_child_ns (node, name, ns); - if (found != NULL) - return found; - - wocky_node_iter_init (&i, node, NULL, NULL); - while (wocky_node_iter_next (&i, &child)) - { - found = search_for_child (child, name, ns); - if (found != NULL) - return found; - } - - return NULL; -} - -/* Returns TRUE if it actually contributed something, else FALSE. - */ -static gboolean -activity_info_contribute_properties (GabbleOlpcActivity *activity, - WockyNode *parent, - gboolean only_public) -{ - WockyNode *props_node; - - if (activity->id == NULL || activity->properties == NULL) - return FALSE; - - if (only_public && !gabble_olpc_activity_is_visible (activity)) - return FALSE; - - props_node = wocky_node_add_child_ns (parent, - "properties", NS_OLPC_ACTIVITY_PROPS); - wocky_node_set_attributes (props_node, - "room", gabble_olpc_activity_get_room (activity), - "activity", activity->id, - NULL); - - lm_message_node_add_children_from_properties (props_node, - activity->properties, "property"); - return TRUE; -} - -static void -decrement_contacts_activities_set_foreach (TpHandleSet *set, - TpHandle handle, - gpointer data) -{ - GabbleConnection *conn = data; - GabbleOlpcActivity *activity = g_hash_table_lookup ( - conn->olpc_activities_info, GUINT_TO_POINTER (handle)); - - g_object_unref (activity); -} - -/* context may be NULL. */ -static gboolean -check_pep (GabbleConnection *conn, - DBusGMethodInvocation *context) -{ - if (!(conn->features & GABBLE_CONNECTION_FEATURES_PEP)) - { - GError error = { TP_ERROR, TP_ERROR_NETWORK_ERROR, - "Server does not support PEP" }; - - DEBUG ("%s", error.message); - if (context != NULL) - dbus_g_method_return_error (context, &error); - return FALSE; - } - - return TRUE; -} - -static const gchar * -inspect_handle (TpBaseConnection *base, - DBusGMethodInvocation *context, - guint handle, - TpHandleRepoIface *handle_repo) -{ - GError *error = NULL; - - if (!tp_handle_is_valid (handle_repo, handle, &error)) - { - dbus_g_method_return_error (context, error); - g_error_free (error); - return NULL; - } - - return tp_handle_inspect (handle_repo, handle); -} - -static const gchar * -inspect_contact (TpBaseConnection *base, - DBusGMethodInvocation *context, - guint contact) -{ - TpHandleRepoIface *contact_repo = tp_base_connection_get_handles ( - base, TP_HANDLE_TYPE_CONTACT); - - return inspect_handle (base, context, contact, contact_repo); -} - -static const gchar * -inspect_room (TpBaseConnection *base, - DBusGMethodInvocation *context, - guint room) -{ - TpHandleRepoIface *room_repo = tp_base_connection_get_handles ( - base, TP_HANDLE_TYPE_ROOM); - - return inspect_handle (base, context, room, room_repo); -} - -/* context may be NULL, since this may be called in response to becoming - * connected. - */ -static gboolean -check_publish_reply_msg (WockyStanza *reply_msg, - DBusGMethodInvocation *context) -{ - GError *error = NULL; - - if (wocky_stanza_extract_errors (reply_msg, NULL, &error, NULL, NULL)) - { - GError *tp_error = NULL; - - gabble_set_tp_error_from_wocky (error, &tp_error); - g_prefix_error (&tp_error, "Failed to publish to the PEP node: "); - DEBUG ("%s", tp_error->message); - - if (context != NULL) - dbus_g_method_return_error (context, tp_error); - - g_error_free (tp_error); - g_error_free (error); - return FALSE; - } - else - { - return TRUE; - } -} - -static gboolean -check_query_reply_msg (WockyStanza *reply_msg, - DBusGMethodInvocation *context) -{ - GError *error = NULL; - - if (wocky_stanza_extract_errors (reply_msg, NULL, &error, NULL, NULL)) - { - GError *tp_error = NULL; - - gabble_set_tp_error_from_wocky (error, &tp_error); - g_prefix_error (&tp_error, "Failed to query the PEP node: "); - DEBUG ("%s", tp_error->message); - - if (context != NULL) - dbus_g_method_return_error (context, tp_error); - - g_error_free (tp_error); - g_error_free (error); - return FALSE; - } - else - { - return TRUE; - } -} - -typedef struct -{ - GabbleConnection *conn; - DBusGMethodInvocation *context; -} pubsub_query_ctx; - -static pubsub_query_ctx * -pubsub_query_ctx_new (GabbleConnection *conn, - DBusGMethodInvocation *context) -{ - pubsub_query_ctx *ctx = g_slice_new (pubsub_query_ctx); - - ctx->conn = conn; - ctx->context = context; - return ctx; -} - -static void -pubsub_query_ctx_free (pubsub_query_ctx *ctx) -{ - g_slice_free (pubsub_query_ctx, ctx); -} - -static void -get_properties_reply_cb (GObject *source, - GAsyncResult *res, - gpointer user_data) -{ - pubsub_query_ctx *ctx = (pubsub_query_ctx *) user_data; - WockyStanza *reply_msg; - GError *error = NULL; - GHashTable *properties; - WockyNode *node; - - /* FIXME: can we just pass &node in here to get the <properties/>? */ - reply_msg = wocky_pep_service_get_finish (WOCKY_PEP_SERVICE (source), res, - NULL, &error); - if (reply_msg == NULL) - { - GError err = { TP_ERROR, TP_ERROR_NETWORK_ERROR, - "Failed to send property request to server" }; - - DEBUG ("Query failed: %s", error->message); - - dbus_g_method_return_error (ctx->context, &err); - g_error_free (error); - goto out; - } - - if (!check_query_reply_msg (reply_msg, ctx->context)) - goto out; - - node = search_for_child ( - wocky_stanza_get_top_node (reply_msg), "properties", NULL); - properties = lm_message_node_extract_properties (node, "property"); - - gabble_svc_olpc_buddy_info_return_from_get_properties (ctx->context, - properties); - g_hash_table_unref (properties); - -out: - pubsub_query_ctx_free (ctx); - if (reply_msg != NULL) - g_object_unref (reply_msg); -} - -static void -olpc_buddy_info_get_properties (GabbleSvcOLPCBuddyInfo *iface, - guint handle, - DBusGMethodInvocation *context) -{ - GabbleConnection *conn = GABBLE_CONNECTION (iface); - TpBaseConnection *base = (TpBaseConnection *) conn; - const gchar *jid; - pubsub_query_ctx *ctx; - WockyBareContact *contact; - - DEBUG ("called"); - - gabble_connection_ensure_capabilities (conn, - gabble_capabilities_get_olpc_notify ()); - - if (!check_pep (conn, context)) - return; - - jid = inspect_contact (base, context, handle); - if (jid == NULL) - return; - - ctx = pubsub_query_ctx_new (conn, context); - contact = ensure_bare_contact_from_jid (conn, jid); - - wocky_pep_service_get_async (conn->pep_olpc_buddy_props, contact, NULL, - get_properties_reply_cb, ctx); - - g_object_unref (contact); -} - -/* context may be NULL. */ -static void -set_properties_reply_cb (GabbleConnection *conn, - WockyStanza *sent_msg, - WockyStanza *reply_msg, - GObject *object, - gpointer user_data) -{ - DBusGMethodInvocation *context = user_data; - - if (!check_publish_reply_msg (reply_msg, context)) - return; - - if (context != NULL) - gabble_svc_olpc_buddy_info_return_from_set_properties (context); -} - -/* context may be NULL, in which case it will be NULL in the reply_cb. */ -static void -transmit_properties (GabbleConnection *conn, - GHashTable *properties, - DBusGMethodInvocation *context) -{ - WockyStanza *msg; - WockyNode *item, *props_node; - - gabble_connection_ensure_capabilities (conn, - gabble_capabilities_get_olpc_notify ()); - - if (!check_pep (conn, context)) - return; - - msg = wocky_pep_service_make_publish_stanza (conn->pep_olpc_buddy_props, - &item); - props_node = wocky_node_add_child_ns (item, "properties", - NS_OLPC_BUDDY_PROPS); - - lm_message_node_add_children_from_properties (props_node, properties, - "property"); - - if (!_gabble_connection_send_with_reply (conn, msg, - set_properties_reply_cb, NULL, context, NULL)) - { - GError error = { TP_ERROR, TP_ERROR_NETWORK_ERROR, - "Failed to send property change request to server" }; - - DEBUG ("%s", error.message); - if (context != NULL) - dbus_g_method_return_error (context, &error); - } - - g_object_unref (msg); -} - -static GQuark -preload_buddy_properties_quark (void) -{ - static GQuark q = 0; - if (q == 0) - { - q = g_quark_from_static_string - ("GabbleConnection.preload_buddy_properties_quark"); - } - return q; -} - -static GQuark -invitees_quark (void) -{ - static GQuark q = 0; - if (q == 0) - { - q = g_quark_from_static_string - ("GabbleConnection.conn_olpc_invitees_quark"); - } - return q; -} - -static void -gabble_connection_connected_olpc (GabbleConnection *conn) -{ - GHashTable *preload = g_object_steal_qdata ((GObject *) conn, - preload_buddy_properties_quark ()); - - if (preload != NULL) - { - transmit_properties (conn, preload, NULL); - g_hash_table_unref (preload); - } -} - -static void -olpc_buddy_info_set_properties (GabbleSvcOLPCBuddyInfo *iface, - GHashTable *properties, - DBusGMethodInvocation *context) -{ - GabbleConnection *conn = GABBLE_CONNECTION (iface); - TpBaseConnection *base = (TpBaseConnection *) conn; - DEBUG ("called"); - - if (tp_base_connection_get_status (base) == TP_CONNECTION_STATUS_CONNECTED) - { - transmit_properties (conn, properties, context); - } - else - { - GHashTable *preload; - GQuark preload_quark = preload_buddy_properties_quark (); - - DEBUG ("Not connected: will perform OLPC buddy property update later"); - - preload = g_object_get_qdata ((GObject *) conn, preload_quark); - if (preload != NULL) - { - /* throw away any already-preloaded properties - SetProperties - * is an overwrite, not an update */ - g_hash_table_remove_all (preload); - } - else - { - preload = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, - (GDestroyNotify) tp_g_value_slice_free); - g_object_set_qdata_full ((GObject *) conn, preload_quark, preload, - (GDestroyNotify) g_hash_table_unref); - } - - tp_g_hash_table_update (preload, properties, - (GBoxedCopyFunc) g_strdup, - (GBoxedCopyFunc) tp_g_value_slice_dup); - - gabble_svc_olpc_buddy_info_return_from_set_properties (context); - } -} - -static void -olpc_buddy_props_pep_node_changed (WockyPepService *pep, - WockyBareContact *contact, - WockyStanza *stanza, - WockyNode *item, - GabbleConnection *conn) -{ - TpHandleRepoIface *contact_repo = tp_base_connection_get_handles ( - (TpBaseConnection *) conn, TP_HANDLE_TYPE_CONTACT); - GHashTable *properties; - WockyNode *node; - TpBaseConnection *base = (TpBaseConnection *) conn; - TpHandle handle; - const gchar *jid; - - jid = wocky_bare_contact_get_jid (contact); - handle = tp_handle_ensure (contact_repo, jid, NULL, NULL); - if (handle == 0) - { - DEBUG ("Invalid from: %s", jid); - return; - } - - if (handle == tp_base_connection_get_self_handle (base)) - /* Ignore echoed pubsub notifications */ - return; - - node = search_for_child ( - wocky_stanza_get_top_node (stanza), "properties", NULL); - properties = lm_message_node_extract_properties (node, "property"); - gabble_svc_olpc_buddy_info_emit_properties_changed (conn, handle, - properties); - g_hash_table_unref (properties); -} - -static void -get_activity_properties_reply_cb (GObject *source, - GAsyncResult *res, - gpointer user_data) - -{ - GabbleConnection *conn = GABBLE_CONNECTION (user_data); - const gchar *from; - WockyStanza *reply_msg; - GError *error = NULL; - - reply_msg = wocky_pep_service_get_finish (WOCKY_PEP_SERVICE (source), res, - NULL, &error); - if (reply_msg == NULL) - { - DEBUG ("Failed to send activity properties request to server: %s", - error->message); - g_error_free (error); - return; - } - - from = wocky_node_get_attribute ( - wocky_stanza_get_top_node (reply_msg), "from"); - update_activities_properties (conn, from, reply_msg); - g_object_unref (reply_msg); -} - -static gboolean -remove_activity (gpointer key, - gpointer value, - gpointer activity) -{ - return activity == value; -} - -static void -activity_disposed_cb (gpointer _conn, - GObject *activity) -{ - GabbleConnection *conn = GABBLE_CONNECTION (_conn); - - if (conn->olpc_activities_info == NULL) - /* We are disposing */ - return; - - g_hash_table_foreach_remove (conn->olpc_activities_info, - remove_activity, activity); -} - -static GabbleOlpcActivity * -add_activity_info (GabbleConnection *conn, - TpHandle handle) -{ - GabbleOlpcActivity *activity; - - activity = gabble_olpc_activity_new (conn, handle); - - g_hash_table_insert (conn->olpc_activities_info, - GUINT_TO_POINTER (handle), activity); - g_object_weak_ref (G_OBJECT (activity), activity_disposed_cb, conn); - - return activity; -} - -static GPtrArray * -get_buddy_activities (GabbleConnection *conn, - TpHandle buddy) -{ - TpIntset *all; - gboolean free_all = FALSE; - GPtrArray *activities = g_ptr_array_new (); - TpHandleSet *invited_activities, *pep_activities; - - invited_activities = g_hash_table_lookup (conn->olpc_invited_activities, - GUINT_TO_POINTER (buddy)); - pep_activities = g_hash_table_lookup (conn->olpc_pep_activities, - GUINT_TO_POINTER (buddy)); - - if (invited_activities == NULL) - { - if (pep_activities == NULL) - { - all = NULL; - } - else - { - all = tp_handle_set_peek (pep_activities); - } - } - else - { - if (pep_activities == NULL) - { - all = tp_handle_set_peek (invited_activities); - } - else - { - all = tp_intset_union (tp_handle_set_peek (invited_activities), - tp_handle_set_peek (pep_activities)); - free_all = TRUE; - } - } - - if (all != NULL) - { - TpIntsetFastIter iter; - guint element; - - tp_intset_fast_iter_init (&iter, all); - - while (tp_intset_fast_iter_next (&iter, &element)) - { - GabbleOlpcActivity *activity = g_hash_table_lookup ( - conn->olpc_activities_info, GUINT_TO_POINTER (element)); - GValue gvalue = { 0 }; - - g_assert (activity != NULL); - if (activity->id == NULL) - { - DEBUG ("... activity #%u has no ID, skipping", element); - continue; - } - - g_value_init (&gvalue, GABBLE_STRUCT_TYPE_ACTIVITY); - g_value_take_boxed (&gvalue, dbus_g_type_specialized_construct - (GABBLE_STRUCT_TYPE_ACTIVITY)); - dbus_g_type_struct_set (&gvalue, - 0, activity->id, - 1, activity->room, - G_MAXUINT); - DEBUG ("... activity #%u (ID %s)", - activity->room, activity->id); - g_ptr_array_add (activities, g_value_get_boxed (&gvalue)); - } - } - - if (free_all) - tp_intset_destroy (all); - - return activities; -} - -static void -extract_activities (GabbleConnection *conn, - WockyStanza *msg, - TpHandle sender) -{ - WockyNode *activities_node; - TpHandleSet *activities_set, *old_activities; - TpHandleRepoIface *room_repo = tp_base_connection_get_handles ( - (TpBaseConnection *) conn, TP_HANDLE_TYPE_ROOM); - WockyNodeIter i; - - activities_node = search_for_child ( - wocky_stanza_get_top_node (msg), "activities", NULL); - - activities_set = tp_handle_set_new (room_repo); - - if (activities_node != NULL) - { - WockyNode *node; - wocky_node_iter_init (&i, activities_node, "activity", NULL); - while (wocky_node_iter_next (&i, &node)) - { - const gchar *act_id; - const gchar *room; - GabbleOlpcActivity *activity; - TpHandle room_handle; - - act_id = wocky_node_get_attribute (node, "type"); - if (act_id == NULL) - { - NODE_DEBUG (node, "No activity ID, skipping"); - continue; - } - - room = wocky_node_get_attribute (node, "room"); - if (room == NULL) - { - NODE_DEBUG (node, "No room name, skipping"); - continue; - } - - room_handle = tp_handle_ensure (room_repo, room, NULL, NULL); - if (room_handle == 0) - { - DEBUG ("Invalid room name <%s>, skipping", room); - continue; - } - - activity = g_hash_table_lookup (conn->olpc_activities_info, - GUINT_TO_POINTER (room_handle)); - - if (activity == NULL) - { - activity = add_activity_info (conn, room_handle); - g_assert (!tp_handle_set_is_member (activities_set, room_handle)); - } - else - { - if (tp_handle_set_is_member (activities_set, room_handle)) - { - NODE_DEBUG (node, "Room advertised twice, skipping"); - continue; - } - - g_object_ref (activity); - - DEBUG ("ref: %s (%d) refcount: %d\n", - gabble_olpc_activity_get_room (activity), - activity->room, G_OBJECT (activity)->ref_count); - } - /* pass ownership to the activities_set */ - tp_handle_set_add (activities_set, room_handle); - - if (tp_strdiff (activity->id, act_id)) - { - DEBUG ("Assigning new ID <%s> to room #%u <%s>", act_id, room_handle, - room); - g_object_set (activity, "id", act_id, NULL); - } - } - } - - old_activities = g_hash_table_lookup (conn->olpc_pep_activities, - GUINT_TO_POINTER (sender)); - - if (old_activities != NULL) - { - /* We decrement the refcount (and free if needed) all the - * activities previously announced by this contact. */ - tp_handle_set_foreach (old_activities, - decrement_contacts_activities_set_foreach, conn); - } - - /* Update the list of activities associated with this contact. */ - g_hash_table_insert (conn->olpc_pep_activities, - GUINT_TO_POINTER (sender), activities_set); -} - -static void -free_activities (GPtrArray *activities) -{ - guint i; - - for (i = 0; i < activities->len; i++) - g_boxed_free (GABBLE_STRUCT_TYPE_ACTIVITY, activities->pdata[i]); - - g_ptr_array_unref (activities); -} - -static void -check_activity_properties (GabbleConnection *conn, - GPtrArray *activities, - const gchar *from) -{ - /* XXX: dirty hack! - * We use PEP instead of pubsub until we have MEP. - * When we request activities from a remote contact we need to check - * if we already "know" his activities (we have its properties). - * If not, we need to explicitely ask to the user to send them to us. - * When we'll have MEP we will be able to request activities - * propreties from muc's pubsub node and so avoid all this crack. - */ - gboolean query_needed = FALSE; - guint i; - - for (i = 0; i < activities->len && !query_needed; i++) - { - GValue pair = {0,}; - guint channel; - GabbleOlpcActivity *activity; - - g_value_init (&pair, GABBLE_STRUCT_TYPE_ACTIVITY); - g_value_set_static_boxed (&pair, g_ptr_array_index (activities, i)); - dbus_g_type_struct_get (&pair, - 1, &channel, - G_MAXUINT); - - activity = g_hash_table_lookup (conn->olpc_activities_info, - GUINT_TO_POINTER (channel)); - if (activity == NULL || activity->properties == NULL) - { - query_needed = TRUE; - } - } - - if (query_needed) - { - WockyBareContact *contact = ensure_bare_contact_from_jid (conn, from); - - wocky_pep_service_get_async (conn->pep_olpc_act_props, contact, - NULL, get_activity_properties_reply_cb, conn); - - g_object_unref (contact); - } -} - -static void -get_activities_reply_cb (GObject *source, - GAsyncResult *res, - gpointer user_data) - -{ - pubsub_query_ctx *ctx = (pubsub_query_ctx *) user_data; - WockyStanza *reply_msg; - GError *err = NULL; - GPtrArray *activities; - const gchar *from; - TpHandle from_handle; - TpHandleRepoIface *contact_repo = tp_base_connection_get_handles ( - (TpBaseConnection *) ctx->conn, TP_HANDLE_TYPE_CONTACT); - GError *stanza_error = NULL; - - reply_msg = wocky_pep_service_get_finish (WOCKY_PEP_SERVICE (source), res, - NULL, &err); - if (reply_msg == NULL) - { - GError error = { TP_ERROR, TP_ERROR_NETWORK_ERROR, - "Failed to send property request to server" }; - - DEBUG ("Query failed: %s", err->message); - - dbus_g_method_return_error (ctx->context, &error); - g_error_free (err); - goto out; - } - - from = wocky_node_get_attribute ( - wocky_stanza_get_top_node (reply_msg), "from"); - if (from == NULL) - { - GError error = { TP_ERROR, TP_ERROR_NETWORK_ERROR, - "Error in pubsub reply: no sender" }; - - dbus_g_method_return_error (ctx->context, &error); - goto out; - } - - from_handle = tp_handle_lookup (contact_repo, from, NULL, NULL); - if (from_handle == 0) - { - GError error = { TP_ERROR, TP_ERROR_NETWORK_ERROR, - "Error in pubsub reply: unknown sender" }; - - dbus_g_method_return_error (ctx->context, &error); - goto out; - } - - if (wocky_stanza_extract_errors (reply_msg, NULL, &stanza_error, NULL, NULL)) - { - GError *tp_error = NULL; - - gabble_set_tp_error_from_wocky (stanza_error, &tp_error); - g_prefix_error (&tp_error, "Error in pubsub reply: "); - dbus_g_method_return_error (ctx->context, tp_error); - g_clear_error (&tp_error); - g_clear_error (&stanza_error); - goto out; - } - - extract_activities (ctx->conn, reply_msg, from_handle); - - activities = get_buddy_activities (ctx->conn, from_handle); - - /* FIXME: race between client and PEP */ - check_activity_properties (ctx->conn, activities, from); - - gabble_svc_olpc_buddy_info_return_from_get_activities (ctx->context, - activities); - - free_activities (activities); -out: - pubsub_query_ctx_free (ctx); - if (reply_msg != NULL) - g_object_unref (reply_msg); -} - -static void -olpc_buddy_info_get_activities (GabbleSvcOLPCBuddyInfo *iface, - guint handle, - DBusGMethodInvocation *context) -{ - GabbleConnection *conn = GABBLE_CONNECTION (iface); - TpBaseConnection *base = (TpBaseConnection *) conn; - const gchar *jid; - pubsub_query_ctx *ctx; - WockyBareContact *contact; - - DEBUG ("called"); - - gabble_connection_ensure_capabilities (conn, - gabble_capabilities_get_olpc_notify ()); - - if (!check_pep (conn, context)) - return; - - jid = inspect_contact (base, context, handle); - if (jid == NULL) - return; - - ctx = pubsub_query_ctx_new (conn, context); - contact = ensure_bare_contact_from_jid (conn, jid); - - wocky_pep_service_get_async (conn->pep_olpc_activities, contact, NULL, - get_activities_reply_cb, ctx); - - g_object_unref (contact); -} - -/* FIXME: API could be improved */ -static gboolean -upload_activities_pep (GabbleConnection *conn, - GabbleConnectionMsgReplyFunc callback, - gpointer user_data, - GError **error) -{ - TpBaseConnection *base = (TpBaseConnection *) conn; - WockyNode *item, *activities; - WockyStanza *msg; - TpHandleSet *my_activities = g_hash_table_lookup (conn->olpc_pep_activities, - GUINT_TO_POINTER (tp_base_connection_get_self_handle (base))); - GError *e = NULL; - gboolean ret; - - msg = wocky_pep_service_make_publish_stanza (conn->pep_olpc_activities, - &item); - activities = wocky_node_add_child_ns (item, "activities", - NS_OLPC_ACTIVITIES); - - if (my_activities != NULL) - { - TpIntsetFastIter iter; - guint element; - - tp_intset_fast_iter_init (&iter, tp_handle_set_peek (my_activities)); - - while (tp_intset_fast_iter_next (&iter, &element)) - { - GabbleOlpcActivity *activity = g_hash_table_lookup ( - conn->olpc_activities_info, GUINT_TO_POINTER (element)); - WockyNode *activity_node; - - g_assert (activity != NULL); - if (!gabble_olpc_activity_is_visible (activity)) - continue; - - activity_node = wocky_node_add_child_with_content (activities, - "activity", ""); - wocky_node_set_attributes (activity_node, - "type", activity->id, - "room", gabble_olpc_activity_get_room (activity), - NULL); - } - } - - ret = _gabble_connection_send_with_reply (conn, msg, callback, NULL, - user_data, &e); - - if (!ret) - { - g_set_error (error, TP_ERROR, TP_ERROR_NETWORK_ERROR, - "Failed to send property change request to server: %s", e->message); - g_error_free (e); - } - - g_object_unref (msg); - return ret; -} - -static void -set_activities_reply_cb (GabbleConnection *conn, - WockyStanza *sent_msg, - WockyStanza *reply_msg, - GObject *object, - gpointer user_data) -{ - DBusGMethodInvocation *context = user_data; - - if (!check_publish_reply_msg (reply_msg, context)) - return; - - /* FIXME: emit ActivitiesChanged? */ - - gabble_svc_olpc_buddy_info_return_from_set_activities (context); -} - -static gboolean -add_activity (GabbleConnection *self, - const gchar *id, - guint channel, - GError **error) -{ - TpBaseConnection *base = (TpBaseConnection *) self; - TpHandleRepoIface *room_repo = tp_base_connection_get_handles ( - base, TP_HANDLE_TYPE_ROOM); - TpHandleSet *old_activities = g_hash_table_lookup (self->olpc_pep_activities, - GUINT_TO_POINTER (tp_base_connection_get_self_handle (base))); - GabbleOlpcActivity *activity; - - if (!tp_handle_is_valid (room_repo, channel, error)) - { - DEBUG ("Invalid room handle %d", channel); - return FALSE; - } - - if (old_activities != NULL && tp_handle_set_is_member (old_activities, channel)) - { - *error = g_error_new (TP_ERROR, - TP_ERROR_INVALID_ARGUMENT, - "Can't set twice the same activity: %s", id); - - DEBUG ("activity already added: %s", id); - return FALSE; - } - - activity = g_hash_table_lookup (self->olpc_activities_info, - GUINT_TO_POINTER (channel)); - - if (activity == NULL) - { - activity = add_activity_info (self, channel); - } - - g_object_ref (activity); - - DEBUG ("ref: %s (%d) refcount: %d\n", - gabble_olpc_activity_get_room (activity), - activity->room, G_OBJECT (activity)->ref_count); - - g_object_set (activity, "id", id, NULL); - - return TRUE; -} - -static void -olpc_buddy_info_set_activities (GabbleSvcOLPCBuddyInfo *iface, - const GPtrArray *activities, - DBusGMethodInvocation *context) -{ - GabbleConnection *conn = GABBLE_CONNECTION (iface); - TpBaseConnection *base = (TpBaseConnection *) conn; - TpHandleRepoIface *room_repo = tp_base_connection_get_handles ( - base, TP_HANDLE_TYPE_ROOM); - guint i; - TpHandleSet *activities_set, *old_activities; - - DEBUG ("called"); - - gabble_connection_ensure_capabilities (conn, - gabble_capabilities_get_olpc_notify ()); - - if (!check_pep (conn, context)) - return; - - activities_set = tp_handle_set_new (room_repo); - - for (i = 0; i < activities->len; i++) - { - GValue pair = {0,}; - gchar *id; - guint channel; - const gchar *room = NULL; - GabbleOlpcActivity *activity; - GError *error = NULL; - - g_value_init (&pair, GABBLE_STRUCT_TYPE_ACTIVITY); - g_value_set_static_boxed (&pair, g_ptr_array_index (activities, i)); - dbus_g_type_struct_get (&pair, - 0, &id, - 1, &channel, - G_MAXUINT); - - if (!tp_handle_is_valid (room_repo, channel, &error)) - { - DEBUG ("Invalid room handle"); - dbus_g_method_return_error (context, error); - - /* We have to unref information previously - * refed in this loop */ - tp_handle_set_foreach (activities_set, - decrement_contacts_activities_set_foreach, conn); - - /* set_activities failed so we don't unref old activities - * of the local user */ - - tp_handle_set_destroy (activities_set); - g_error_free (error); - g_free (id); - return; - } - - room = tp_handle_inspect (room_repo, channel); - - activity = g_hash_table_lookup (conn->olpc_activities_info, - GUINT_TO_POINTER (channel)); - - if (activity == NULL) - { - activity = add_activity_info (conn, channel); - } - else - { - if (tp_handle_set_is_member (activities_set, channel)) - { - error = g_error_new (TP_ERROR, - TP_ERROR_INVALID_ARGUMENT, - "Can't set twice the same activity: %s", room); - - DEBUG ("activity already added: %s", room); - dbus_g_method_return_error (context, error); - - /* We have to unref information previously - * refed in this loop */ - tp_handle_set_foreach (activities_set, - decrement_contacts_activities_set_foreach, conn); - - /* set_activities failed so we don't unref old activities - * of the local user */ - - tp_handle_set_destroy (activities_set); - g_error_free (error); - g_free (activity); - g_free (id); - return; - } - - g_object_ref (activity); - - DEBUG ("ref: %s (%d) refcount: %d\n", - gabble_olpc_activity_get_room (activity), - activity->room, G_OBJECT (activity)->ref_count); - } - - g_object_set (activity, "id", id, NULL); - g_free (id); - - tp_handle_set_add (activities_set, channel); - } - - old_activities = g_hash_table_lookup (conn->olpc_pep_activities, - GUINT_TO_POINTER (tp_base_connection_get_self_handle (base))); - - if (old_activities != NULL) - { - /* We decrement the refcount (and free if needed) all the - * activities previously announced by our own contact. */ - tp_handle_set_foreach (old_activities, - decrement_contacts_activities_set_foreach, conn); - } - - /* Update the list of activities associated with our own contact. */ - g_hash_table_insert (conn->olpc_pep_activities, - GUINT_TO_POINTER (tp_base_connection_get_self_handle (base)), - activities_set); - - if (!upload_activities_pep (conn, set_activities_reply_cb, context, NULL)) - { - GError error = { TP_ERROR, TP_ERROR_NETWORK_ERROR, - "Failed to send property request to server" }; - - dbus_g_method_return_error (context, &error); - } - - /* FIXME: what if we were advertising properties for things that - * we've declared are no longer in our activities list? Strictly speaking - * we should probably re-upload our activity properties PEP if that's - * the case */ -} - -static void -olpc_activities_pep_node_changed (WockyPepService *pep, - WockyBareContact *contact, - WockyStanza *stanza, - WockyNode *item, - GabbleConnection *conn) -{ - TpHandleRepoIface *contact_repo = tp_base_connection_get_handles ( - (TpBaseConnection *) conn, TP_HANDLE_TYPE_CONTACT); - GPtrArray *activities; - TpBaseConnection *base = (TpBaseConnection *) conn; - TpHandle handle; - const gchar *jid; - - jid = wocky_bare_contact_get_jid (contact); - handle = tp_handle_ensure (contact_repo, jid, NULL, NULL); - if (handle == 0) - { - DEBUG ("Invalid from: %s", jid); - return; - } - - if (handle != tp_base_connection_get_self_handle (base)) - extract_activities (conn, stanza, handle); - - activities = get_buddy_activities (conn, handle); - gabble_svc_olpc_buddy_info_emit_activities_changed (conn, handle, - activities); - free_activities (activities); -} - -static GabbleOlpcActivity * -add_activity_info_in_set (GabbleConnection *conn, - TpHandle room_handle, - const gchar *from, - GHashTable *table) -{ - GabbleOlpcActivity *activity; - TpHandle from_handle; - TpHandleSet *activities_set; - TpHandleRepoIface *contact_repo = tp_base_connection_get_handles ( - (TpBaseConnection *) conn, TP_HANDLE_TYPE_CONTACT); - TpHandleRepoIface *room_repo = tp_base_connection_get_handles ( - (TpBaseConnection *) conn, TP_HANDLE_TYPE_ROOM); - - from_handle = tp_handle_lookup (contact_repo, from, NULL, NULL); - - if (from_handle == 0) - { - DEBUG ("unknown sender"); - return NULL; - } - - activity = add_activity_info (conn, room_handle); - - /* Add activity information in the list of the contact */ - activities_set = g_hash_table_lookup (table, GUINT_TO_POINTER ( - from_handle)); - if (activities_set == NULL) - { - activities_set = tp_handle_set_new (room_repo); - g_hash_table_insert (table, GUINT_TO_POINTER (from_handle), - activities_set); - } - - /* add_activity_info_in_set isn't meant to be called if the - * activity already existed */ - g_assert (!tp_handle_set_is_member (activities_set, room_handle)); - - /* the set owns the ref of the newly created activity */ - tp_handle_set_add (activities_set, room_handle); - - return activity; -} - -static GabbleOlpcActivity * -extract_current_activity (GabbleConnection *conn, - WockyNode *node, - const gchar *contact, - gboolean create_activity) -{ - const gchar *room, *id; - GabbleOlpcActivity *activity; - TpHandleRepoIface *room_repo = tp_base_connection_get_handles ( - (TpBaseConnection *) conn, TP_HANDLE_TYPE_ROOM); - TpHandleRepoIface *contact_repo = tp_base_connection_get_handles ( - (TpBaseConnection *) conn, TP_HANDLE_TYPE_CONTACT); - TpHandle room_handle, contact_handle; - - if (node == NULL) - return NULL; - - /* For some weird reasons, the PEP protocol use "type" for the activity ID. - * We can't change that without breaking compatibility but if there is no - * "type" attribute then we can use the "id" one. */ - id = wocky_node_get_attribute (node, "type"); - if (id == NULL) - { - id = wocky_node_get_attribute (node, "id"); - } - - room = wocky_node_get_attribute (node, "room"); - if (room == NULL || room[0] == '\0') - return NULL; - - room_handle = tp_handle_ensure (room_repo, room, NULL, NULL); - if (room_handle == 0) - return NULL; - - contact_handle = tp_handle_lookup (contact_repo, contact, NULL, NULL); - if (contact_handle == 0) - return NULL; - - activity = g_hash_table_lookup (conn->olpc_activities_info, - GUINT_TO_POINTER (room_handle)); - - if (activity == NULL && create_activity) - { - /* Humm we received as current activity an activity we don't know yet. - * If the remote user doesn't announce this activity - * in his next activities list, information about - * it will be freed */ - - DEBUG ("unknown current activity %s", room); - - activity = add_activity_info_in_set (conn, room_handle, contact, - conn->olpc_pep_activities); - } - - /* update current-activity cache */ - if (activity != NULL) - { - g_object_set (activity, "id", id, NULL); - g_hash_table_insert (conn->olpc_current_act, - GUINT_TO_POINTER (contact_handle), g_object_ref (activity)); - } - else - { - g_hash_table_remove (conn->olpc_current_act, - GUINT_TO_POINTER (contact_handle)); - } - - return activity; -} - -static void -get_current_activity_reply_cb (GObject *source, - GAsyncResult *res, - gpointer user_data) -{ - pubsub_query_ctx *ctx = (pubsub_query_ctx *) user_data; - WockyStanza *reply_msg; - GError *error = NULL; - WockyNode *node; - const gchar *from; - GabbleOlpcActivity *activity; - - reply_msg = wocky_pep_service_get_finish (WOCKY_PEP_SERVICE (source), res, - NULL, &error); - if (reply_msg == NULL) - { - GError err = { TP_ERROR, TP_ERROR_NETWORK_ERROR, - "Failed to send property request to server" }; - - DEBUG ("Query failed: %s", error->message); - - dbus_g_method_return_error (ctx->context, &err); - g_error_free (error); - goto out; - } - - if (wocky_stanza_extract_errors (reply_msg, NULL, NULL, NULL, NULL)) - { - DEBUG ("Failed to query PEP node. No current activity"); - - gabble_svc_olpc_buddy_info_return_from_get_current_activity (ctx->context, - "", 0); - - goto out; - } - - from = wocky_node_get_attribute ( - wocky_stanza_get_top_node (reply_msg), "from"); - node = search_for_child ( - wocky_stanza_get_top_node (reply_msg), "activity", NULL); - activity = extract_current_activity (ctx->conn, node, from, TRUE); - if (activity == NULL) - { - DEBUG ("GetCurrentActivity returns no activity"); - - gabble_svc_olpc_buddy_info_return_from_get_current_activity (ctx->context, - "", 0); - } - else - { - DEBUG ("GetCurrentActivity returns (\"%s\", room#%u)", activity->id, - activity->room); - - gabble_svc_olpc_buddy_info_return_from_get_current_activity (ctx->context, - activity->id, activity->room); - } - -out: - pubsub_query_ctx_free (ctx); - if (reply_msg != NULL) - g_object_unref (reply_msg); -} - -static void -olpc_buddy_info_get_current_activity (GabbleSvcOLPCBuddyInfo *iface, - guint handle, - DBusGMethodInvocation *context) -{ - GabbleConnection *conn = GABBLE_CONNECTION (iface); - TpBaseConnection *base = (TpBaseConnection *) conn; - const gchar *jid; - GabbleOlpcActivity *activity; - pubsub_query_ctx *ctx; - WockyBareContact *contact; - - DEBUG ("called for contact#%u", handle); - - gabble_connection_ensure_capabilities (conn, - gabble_capabilities_get_olpc_notify ()); - - if (!check_pep (conn, context)) - return; - - jid = inspect_contact (base, context, handle); - if (jid == NULL) - return; - - activity = g_hash_table_lookup (conn->olpc_current_act, - GUINT_TO_POINTER (handle)); - if (activity != NULL) - { - DEBUG ("found current activity in cache: %s (%u)", activity->id, - activity->room); - - gabble_svc_olpc_buddy_info_return_from_get_current_activity (context, - activity->id, activity->room); - return; - } - - DEBUG ("current activity not in cache, query PEP node"); - - ctx = pubsub_query_ctx_new (conn, context); - contact = ensure_bare_contact_from_jid (conn, jid); - - wocky_pep_service_get_async (conn->pep_olpc_current_act, contact, - NULL, get_current_activity_reply_cb, ctx); - - g_object_unref (contact); -} - -static void -set_current_activity_reply_cb (GabbleConnection *conn, - WockyStanza *sent_msg, - WockyStanza *reply_msg, - GObject *object, - gpointer user_data) -{ - DBusGMethodInvocation *context = user_data; - - if (!check_publish_reply_msg (reply_msg, context)) - return; - - gabble_svc_olpc_buddy_info_return_from_set_current_activity (context); -} - -/* Check if this activity is in our own activities list */ -static gboolean -activity_in_own_set (GabbleConnection *conn, - const gchar *room) -{ - TpBaseConnection *base = (TpBaseConnection *) conn; - TpHandleSet *activities_set; - TpHandleRepoIface *room_repo = tp_base_connection_get_handles ( - (TpBaseConnection *) conn, TP_HANDLE_TYPE_ROOM); - TpHandle room_handle; - - room_handle = tp_handle_lookup (room_repo, room, NULL, NULL); - if (room_handle == 0) - /* If activity's information was in the list, we would - * have found the handle as Activity keep a ref on it */ - return FALSE; - - activities_set = g_hash_table_lookup (conn->olpc_pep_activities, - GUINT_TO_POINTER (tp_base_connection_get_self_handle (base))); - - if (activities_set == NULL || - !tp_handle_set_is_member (activities_set, room_handle)) - return FALSE; - - return TRUE; -} - -static void -olpc_buddy_info_set_current_activity (GabbleSvcOLPCBuddyInfo *iface, - const gchar *activity, - guint channel, - DBusGMethodInvocation *context) -{ - GabbleConnection *conn = GABBLE_CONNECTION (iface); - TpBaseConnection *base = (TpBaseConnection *) conn; - WockyStanza *msg; - WockyNode *item, *publish; - const gchar *room = ""; - - DEBUG ("called"); - - gabble_connection_ensure_capabilities (conn, - gabble_capabilities_get_olpc_notify ()); - - if (!check_pep (conn, context)) - return; - - /* if activity == "" there is no current activity */ - if (activity[0] != '\0') - { - room = inspect_room (base, context, channel); - if (room == NULL) - return; - - if (!activity_in_own_set (conn, room)) - { - GError error = { TP_ERROR, TP_ERROR_INVALID_ARGUMENT, - "Can't set an activity as current if you're not announcing it" }; - - dbus_g_method_return_error (context, &error); - return; - } - } - - msg = wocky_pep_service_make_publish_stanza (conn->pep_olpc_current_act, - &item); - publish = wocky_node_add_child_ns (item, "activity", - NS_OLPC_CURRENT_ACTIVITY); - - wocky_node_set_attributes (publish, - "type", activity, - "room", room, - NULL); - - if (!_gabble_connection_send_with_reply (conn, msg, - set_current_activity_reply_cb, NULL, context, NULL)) - { - GError error = { TP_ERROR, TP_ERROR_NETWORK_ERROR, - "Failed to send property change request to server" }; - - dbus_g_method_return_error (context, &error); - } - - g_object_unref (msg); -} - -static void -olpc_current_act_pep_node_changed (WockyPepService *pep, - WockyBareContact *contact, - WockyStanza *stanza, - WockyNode *item, - GabbleConnection *conn) -{ - TpHandleRepoIface *contact_repo = tp_base_connection_get_handles ( - (TpBaseConnection *) conn, TP_HANDLE_TYPE_CONTACT); - TpBaseConnection *base = (TpBaseConnection *) conn; - WockyNode *node; - GabbleOlpcActivity *activity; - TpHandle handle; - const gchar *jid; - - jid = wocky_bare_contact_get_jid (contact); - handle = tp_handle_ensure (contact_repo, jid, NULL, NULL); - if (handle == 0) - { - DEBUG ("Invalid from: %s", jid); - return; - } - - if (handle == tp_base_connection_get_self_handle (base)) - /* Ignore echoed pubsub notifications */ - return; - - node = search_for_child (wocky_stanza_get_top_node (stanza), - "activity", NULL); - - activity = extract_current_activity (conn, node, jid, TRUE); - if (activity != NULL) - { - DEBUG ("emitting CurrentActivityChanged(contact#%u, ID \"%s\", room#%u)", - handle, activity->id, activity->room); - gabble_svc_olpc_buddy_info_emit_current_activity_changed (conn, handle, - activity->id, activity->room); - } - else - { - DEBUG ("emitting CurrentActivityChanged(contact#%u, \"\", 0)", - handle); - gabble_svc_olpc_buddy_info_emit_current_activity_changed (conn, handle, - "", 0); - } -} - -static void -add_activity_reply_cb (GabbleConnection *conn, - WockyStanza *sent_msg, - WockyStanza *reply_msg, - GObject *object, - gpointer user_data) -{ - DBusGMethodInvocation *context = user_data; - - if (!check_publish_reply_msg (reply_msg, context)) - return; - - /* FIXME: emit ActivitiesChanged? */ - - gabble_svc_olpc_buddy_info_return_from_add_activity (context); -} - -static void -olpc_buddy_info_add_activity (GabbleSvcOLPCBuddyInfo *iface, - const gchar *id, - guint channel, - DBusGMethodInvocation *context) -{ - GabbleConnection *self = GABBLE_CONNECTION (iface); - TpBaseConnection *base = (TpBaseConnection *) self; - TpHandleSet *activities_set = g_hash_table_lookup (self->olpc_pep_activities, - GUINT_TO_POINTER (tp_base_connection_get_self_handle (base))); - TpHandleRepoIface *room_repo = tp_base_connection_get_handles (base, - TP_HANDLE_TYPE_ROOM); - GError *error = NULL; - - gabble_connection_ensure_capabilities (self, - gabble_capabilities_get_olpc_notify ()); - - if (!check_pep (self, context)) - return; - - if (!add_activity (self, id, channel, &error)) - { - dbus_g_method_return_error (context, error); - return; - } - - if (activities_set == NULL) { - activities_set = tp_handle_set_new (room_repo); - g_hash_table_insert (self->olpc_pep_activities, - GUINT_TO_POINTER (tp_base_connection_get_self_handle (base)), - activities_set); - } - - tp_handle_set_add (activities_set, channel); - - if (!upload_activities_pep (self, add_activity_reply_cb, context, NULL)) - { - error = g_error_new (TP_ERROR, TP_ERROR_NETWORK_ERROR, - "Failed to send property request to server"); - - dbus_g_method_return_error (context, error); - } -} - -void -olpc_buddy_info_iface_init (gpointer g_iface, - gpointer iface_data) -{ - GabbleSvcOLPCBuddyInfoClass *klass = g_iface; - -#define IMPLEMENT(x) gabble_svc_olpc_buddy_info_implement_##x (\ - klass, olpc_buddy_info_##x) - IMPLEMENT(get_activities); - IMPLEMENT(set_activities); - IMPLEMENT(get_properties); - IMPLEMENT(set_properties); - IMPLEMENT(get_current_activity); - IMPLEMENT(set_current_activity); - IMPLEMENT(add_activity); -#undef IMPLEMENT -} - -/* FIXME: API could be improved */ -static gboolean -upload_activity_properties_pep (GabbleConnection *conn, - GabbleConnectionMsgReplyFunc callback, - gpointer user_data, - GError **error) -{ - TpBaseConnection *base = (TpBaseConnection *) conn; - WockyNode *publish, *item; - WockyStanza *msg; - GError *e = NULL; - gboolean ret; - TpHandleSet *my_activities = g_hash_table_lookup (conn->olpc_pep_activities, - GUINT_TO_POINTER (tp_base_connection_get_self_handle (base))); - - msg = wocky_pep_service_make_publish_stanza (conn->pep_olpc_act_props, &item); - publish = wocky_node_add_child_ns (item, "activities", - NS_OLPC_ACTIVITY_PROPS); - - if (my_activities != NULL) - { - TpIntsetFastIter iter; - guint element; - - tp_intset_fast_iter_init (&iter, tp_handle_set_peek (my_activities)); - - while (tp_intset_fast_iter_next (&iter, &element)) - { - GabbleOlpcActivity *activity = g_hash_table_lookup ( - conn->olpc_activities_info, GUINT_TO_POINTER (element)); - - activity_info_contribute_properties (activity, publish, TRUE); - } - } - - ret = _gabble_connection_send_with_reply (conn, msg, callback, NULL, - user_data, &e); - - if (!ret) - { - g_set_error (error, TP_ERROR, TP_ERROR_NETWORK_ERROR, - "Failed to send property change request to server: %s", e->message); - g_error_free (e); - } - - g_object_unref (msg); - return ret; -} - -typedef struct { - DBusGMethodInvocation *context; - gboolean visibility_changed; - GabbleOlpcActivity *activity; -} set_properties_ctx; - -static void -set_activity_properties_activities_reply_cb (GabbleConnection *conn, - WockyStanza *sent_msg, - WockyStanza *reply_msg, - GObject *object, - gpointer user_data) -{ - set_properties_ctx *context = user_data; - - /* if the SetProperties() call was skipped, both messages are NULL */ - g_assert ((sent_msg == NULL) == (reply_msg == NULL)); - - if (reply_msg != NULL && - !check_publish_reply_msg (reply_msg, context->context)) - { - g_slice_free (set_properties_ctx, context); - return; - } - - gabble_svc_olpc_activity_properties_emit_activity_properties_changed ( - conn, context->activity->room, context->activity->properties); - - gabble_svc_olpc_activity_properties_return_from_set_properties ( - context->context); - - g_slice_free (set_properties_ctx, context); - return; -} - -static void -set_activity_properties_reply_cb (GabbleConnection *conn, - WockyStanza *sent_msg, - WockyStanza *reply_msg, - GObject *object, - gpointer user_data) -{ - set_properties_ctx *context = user_data; - - /* if the SetProperties() call was skipped, both messages are NULL */ - g_assert ((sent_msg == NULL) == (reply_msg == NULL)); - - if (reply_msg != NULL && - !check_publish_reply_msg (reply_msg, context->context)) - { - g_slice_free (set_properties_ctx, context); - return; - } - - if (context->visibility_changed) - { - GError *err = NULL; - - if (!upload_activities_pep (conn, - set_activity_properties_activities_reply_cb, - context, &err)) - { - dbus_g_method_return_error (context->context, err); - g_error_free (err); - } - } - else - { - /* nothing to do, so just "succeed" */ - set_activity_properties_activities_reply_cb (conn, NULL, NULL, NULL, - context); - } -} - -static gboolean -refresh_invitations (GabbleConnection *conn, - GabbleMucChannel *chan, - GabbleOlpcActivity *activity, - GError **error) -{ - TpHandleRepoIface *contact_repo = tp_base_connection_get_handles ( - (TpBaseConnection *) conn, TP_HANDLE_TYPE_CONTACT); - TpHandleSet *invitees = g_object_get_qdata ((GObject *) chan, - invitees_quark ()); - - if (invitees != NULL && tp_handle_set_size (invitees) > 0) - { - TpIntsetFastIter iter; - guint element; - - tp_intset_fast_iter_init (&iter, tp_handle_set_peek (invitees)); - - while (tp_intset_fast_iter_next (&iter, &element)) - { - const gchar *to = tp_handle_inspect (contact_repo, element); - WockyStanza *msg = wocky_stanza_build ( - WOCKY_STANZA_TYPE_MESSAGE, WOCKY_STANZA_SUB_TYPE_NONE, - NULL, to, NULL); - - activity_info_contribute_properties (activity, - wocky_stanza_get_top_node (msg), FALSE); - - if (!_gabble_connection_send (conn, msg, error)) - { - DEBUG ("Unable to re-send activity properties to invitee %s", - to); - g_object_unref (msg); - return FALSE; - } - - g_object_unref (msg); - } - } - - return TRUE; -} - -static void -olpc_activity_properties_set_properties (GabbleSvcOLPCActivityProperties *iface, - guint room, - GHashTable *properties, - DBusGMethodInvocation *context) -{ - GabbleConnection *conn = GABBLE_CONNECTION (iface); - TpBaseConnection *base = (TpBaseConnection *) conn; - WockyStanza *msg; - const gchar *jid; - GHashTable *properties_copied; - GabbleOlpcActivity *activity; - GabbleMucChannel *muc_channel; - guint state; - gboolean was_visible, is_visible; - set_properties_ctx *ctx; - GError *err = NULL; - - DEBUG ("called"); - - gabble_connection_ensure_capabilities (conn, - gabble_capabilities_get_olpc_notify ()); - - if (!check_pep (conn, context)) - return; - - jid = inspect_room (base, context, room); - if (jid == NULL) - return; - - if (!activity_in_own_set (conn, jid)) - { - GError error = { TP_ERROR, TP_ERROR_INVALID_ARGUMENT, - "Can't set properties on an activity if you're not announcing it" }; - - dbus_g_method_return_error (context, &error); - return; - } - - muc_channel = gabble_muc_factory_find_text_channel (conn->muc_factory, - room); - if (muc_channel != NULL) - { - g_object_get (muc_channel, - "state", &state, - NULL); - } - if (muc_channel == NULL || state != MUC_STATE_JOINED) - { - GError error = { TP_ERROR, TP_ERROR_INVALID_ARGUMENT, - "Can't set properties on an activity if you're not in it" }; - - dbus_g_method_return_error (context, &error); - return; - } - - properties_copied = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, - (GDestroyNotify) tp_g_value_slice_free); - tp_g_hash_table_update (properties_copied, properties, - (GBoxedCopyFunc) g_strdup, (GBoxedCopyFunc) tp_g_value_slice_dup); - - activity = g_hash_table_lookup (conn->olpc_activities_info, - GUINT_TO_POINTER (room)); - - was_visible = gabble_olpc_activity_is_visible (activity); - - g_object_set (activity, "properties", properties_copied, NULL); - - is_visible = gabble_olpc_activity_is_visible (activity); - - msg = wocky_stanza_build ( - WOCKY_STANZA_TYPE_MESSAGE, WOCKY_STANZA_SUB_TYPE_GROUPCHAT, - NULL, jid, NULL); - activity_info_contribute_properties (activity, - wocky_stanza_get_top_node (msg), FALSE); - if (!_gabble_connection_send (conn, msg, NULL)) - { - GError error = { TP_ERROR, TP_ERROR_NETWORK_ERROR, - "Failed to send property change notification to chatroom" }; - - g_object_unref (msg); - dbus_g_method_return_error (context, &error); - return; - } - g_object_unref (msg); - - if (!refresh_invitations (conn, muc_channel, activity, &err)) - { - dbus_g_method_return_error (context, err); - g_error_free (err); - return; - } - - ctx = g_slice_new (set_properties_ctx); - ctx->context = context; - ctx->visibility_changed = (was_visible != is_visible); - ctx->activity = activity; - - if (was_visible || is_visible) - { - if (!upload_activity_properties_pep (conn, - set_activity_properties_reply_cb, ctx, &err)) - { - g_slice_free (set_properties_ctx, ctx); - dbus_g_method_return_error (context, err); - g_error_free (err); - return; - } - } - else - { - /* chain straight to the reply callback, which changes our Activities - * list */ - set_activity_properties_reply_cb (conn, NULL, NULL, NULL, ctx); - } -} - -static void -olpc_activity_properties_get_properties (GabbleSvcOLPCActivityProperties *iface, - guint room, - DBusGMethodInvocation *context) -{ - GabbleConnection *conn = GABBLE_CONNECTION (iface); - gboolean not_prop = FALSE; - GHashTable *properties; - GabbleOlpcActivity *activity; - - DEBUG ("called"); - - gabble_connection_ensure_capabilities (conn, - gabble_capabilities_get_olpc_notify ()); - - if (!check_pep (conn, context)) - return; - - activity = g_hash_table_lookup (conn->olpc_activities_info, - GUINT_TO_POINTER (room)); - - if (activity == NULL || activity->properties == NULL) - { - /* no properties */ - properties = g_hash_table_new (g_str_hash, g_str_equal); - not_prop = TRUE; - } - else - { - properties = activity->properties; - } - - gabble_svc_olpc_activity_properties_return_from_get_properties (context, - properties); - - if (not_prop) - g_hash_table_unref (properties); -} - -struct _i_hate_g_hash_table_foreach -{ - GHashTable *old_properties; - gboolean new_infos; -}; - -static void -check_prop_in_old_properties (gpointer key, - gpointer value, - gpointer user_data) -{ - const gchar *prop = key; - GValue *gvalue = value, *old_gvalue; - struct _i_hate_g_hash_table_foreach *data = - (struct _i_hate_g_hash_table_foreach *) user_data; - - old_gvalue = g_hash_table_lookup (data->old_properties, prop); - - if (old_gvalue == NULL) - { - data->new_infos = TRUE; - } - else if (G_VALUE_TYPE (gvalue) != G_VALUE_TYPE (old_gvalue)) - { - data->new_infos = TRUE; - } - else - { - if (G_VALUE_TYPE (gvalue) == G_TYPE_STRING) - { - const gchar *str1, *str2; - - str1 = g_value_get_string (gvalue); - str2 = g_value_get_string (old_gvalue); - - if (tp_strdiff (str1, str2)) - { - data->new_infos = TRUE; - } - } - else if (G_VALUE_TYPE (gvalue) == G_TYPE_BOOLEAN) - { - gboolean bool1, bool2; - - bool1 = g_value_get_boolean (gvalue); - bool2 = g_value_get_boolean (old_gvalue); - - if (bool1 != bool2) - { - data->new_infos = TRUE; - } - } - else - { - /* if in doubt, emit the signal */ - data->new_infos = TRUE; - } - } -} - -static gboolean -properties_contains_new_infos (GHashTable *old_properties, - GHashTable *new_properties) -{ - struct _i_hate_g_hash_table_foreach data; - - if (g_hash_table_size (new_properties) > g_hash_table_size (old_properties)) - /* New key/value pair(s) */ - return TRUE; - - data.old_properties = old_properties; - data.new_infos = FALSE; - - g_hash_table_foreach (new_properties, check_prop_in_old_properties, - &data); - - return data.new_infos; -} - -static void -update_activity_properties (GabbleConnection *conn, - const gchar *room, - const gchar *contact, - WockyNode *properties_node) -{ - GHashTable *new_properties, *old_properties; - gboolean new_infos = FALSE; - GabbleOlpcActivity *activity; - TpHandle room_handle; - TpHandleRepoIface *room_repo = tp_base_connection_get_handles ( - (TpBaseConnection *) conn, TP_HANDLE_TYPE_ROOM); - - room_handle = tp_handle_ensure (room_repo, room, NULL, NULL); - - activity = g_hash_table_lookup (conn->olpc_activities_info, - GUINT_TO_POINTER (room_handle)); - - if (activity == NULL) - { - DEBUG ("unknown activity: %s", room); - if (contact != NULL) - { - /* Humm we received properties for an activity we don't - * know yet. - * If the remote user doesn't announce this activity - * in his next activities list, information about - * it will be freed */ - activity = add_activity_info_in_set (conn, room_handle, contact, - conn->olpc_pep_activities); - } - else - { - activity = add_activity_info (conn, room_handle); - } - } - - if (activity == NULL) - return; - - old_properties = activity->properties; - - new_properties = lm_message_node_extract_properties (properties_node, - "property"); - - if (g_hash_table_size (new_properties) == 0) - { - g_hash_table_unref (new_properties); - return; - } - - if (old_properties == NULL || - properties_contains_new_infos (old_properties, - new_properties)) - { - new_infos = TRUE; - } - - g_object_set (activity, "properties", new_properties, NULL); - - if (new_infos) - { - /* Only emit the signal if we add new values */ - - gabble_svc_olpc_activity_properties_emit_activity_properties_changed ( - conn, activity->room, new_properties); - } -} - -static gboolean -update_activities_properties (GabbleConnection *conn, - const gchar *contact, - WockyStanza *msg) -{ - const gchar *room; - WockyNode *node; - WockyNodeIter i; - WockyNode *properties_node; - - node = search_for_child ( - wocky_stanza_get_top_node (msg), "activities", NULL); - if (node == NULL) - return FALSE; - - wocky_node_iter_init (&i, node, "properties", NULL); - while (wocky_node_iter_next (&i, &properties_node)) - { - room = wocky_node_get_attribute (properties_node, "room"); - if (room == NULL) - continue; - - update_activity_properties (conn, room, contact, properties_node); - } - return TRUE; -} - -static void -olpc_act_props_pep_node_changed (WockyPepService *pep, - WockyBareContact *contact, - WockyStanza *stanza, - WockyNode *item, - GabbleConnection *conn) -{ - TpHandleRepoIface *contact_repo = tp_base_connection_get_handles ( - (TpBaseConnection *) conn, TP_HANDLE_TYPE_CONTACT); - TpBaseConnection *base = (TpBaseConnection *) conn; - TpHandle handle; - const gchar *jid; - - jid = wocky_bare_contact_get_jid (contact); - handle = tp_handle_ensure (contact_repo, jid, NULL, NULL); - if (handle == 0) - { - DEBUG ("Invalid from: %s", jid); - return; - } - - if (handle == tp_base_connection_get_self_handle (base)) - /* Ignore echoed pubsub notifications */ - return; - - update_activities_properties (conn, jid, stanza); -} - -static void -connection_status_changed_cb (GabbleConnection *conn, - TpConnectionStatus status, - TpConnectionStatusReason reason, - gpointer user_data) -{ - if (status == TP_CONNECTION_STATUS_CONNECTED) - { - /* Well, let's do another crack. - * We have to cleanup PEP node to avoid to confuse - * remote contacts with old properties from a previous session. - */ - if (!upload_activities_pep (conn, NULL, NULL, NULL)) - { - DEBUG ("Failed to send PEP activities reset in response to " - "initial connection"); - } - if (!upload_activity_properties_pep (conn, NULL, NULL, - NULL)) - { - DEBUG ("Failed to send PEP activity props reset in response to " - "initial connection"); - } - - gabble_connection_connected_olpc (conn); - } -} - -static void -pseudo_invite_reply_cb (GabbleConnection *conn, - WockyStanza *sent_msg, - WockyStanza *reply_msg, - GObject *object, - gpointer user_data) -{ - if (!check_publish_reply_msg (reply_msg, NULL)) - { - STANZA_DEBUG (reply_msg, "Failed to make PEP change in " - "response to pseudo-invitation message"); - STANZA_DEBUG (sent_msg, "The failed request was"); - } -} - -gboolean -conn_olpc_process_activity_properties_message (GabbleConnection *conn, - WockyStanza *msg, - const gchar *from) -{ - TpBaseConnection *base = (TpBaseConnection *) conn; - TpHandleRepoIface *contact_repo = tp_base_connection_get_handles (base, - TP_HANDLE_TYPE_CONTACT); - TpHandleRepoIface *room_repo = tp_base_connection_get_handles (base, - TP_HANDLE_TYPE_ROOM); - WockyNode *node = search_for_child ( - wocky_stanza_get_top_node (msg), "properties", NS_OLPC_ACTIVITY_PROPS); - const gchar *id; - TpHandle room_handle, contact_handle = 0; - GabbleOlpcActivity *activity; - TpHandleSet *their_invites, *our_activities; - GHashTable *old_properties, *new_properties; - gboolean properties_changed, pep_properties_changed, activities_changed; - gboolean was_visible, is_visible; - GabbleMucChannel *muc_channel = NULL; - - /* if no <properties xmlns=...>, then not for us */ - if (node == NULL) - return FALSE; - - DEBUG ("Found <properties> node in <message>"); - - id = wocky_node_get_attribute (node, "activity"); - if (id == NULL) - { - NODE_DEBUG (node, "... activity ID missing - ignoring"); - return TRUE; - } - - room_handle = gabble_get_room_handle_from_jid (room_repo, from); - - if (room_handle != 0) - { - muc_channel = gabble_muc_factory_find_text_channel (conn->muc_factory, - room_handle); - } - - if (muc_channel == NULL) - { - const gchar *room; - - DEBUG ("Activity properties message was a pseudo-invitation"); - - /* FIXME: This is stupid. We should ref the handles in a TpHandleSet - * per activity, then we could _ensure this handle */ - contact_handle = tp_handle_lookup (contact_repo, from, NULL, NULL); - if (contact_handle == 0) - { - DEBUG ("... contact <%s> unknown - ignoring (FIX THIS)", from); - return TRUE; - } - - room = wocky_node_get_attribute (node, "room"); - if (room == NULL) - { - NODE_DEBUG (node, "... room name missing - ignoring"); - return TRUE; - } - DEBUG ("... room <%s>", room); - room_handle = tp_handle_ensure (room_repo, room, NULL, NULL); - if (room_handle == 0) - { - DEBUG ("... room <%s> invalid - ignoring", room); - return TRUE; - } - - muc_channel = gabble_muc_factory_find_text_channel (conn->muc_factory, - room_handle); - if (muc_channel != NULL) - { - guint state; - - g_object_get (muc_channel, - "state", &state, - NULL); - if (state == MUC_STATE_JOINED) - { - DEBUG ("Ignoring pseudo-invitation to <%s> - we're already " - "there", room); - return TRUE; - } - } - } - else - { - TpHandle self_handle; - - DEBUG ("Activity properties message was in a chatroom"); - - tp_group_mixin_get_self_handle ((GObject *) muc_channel, &self_handle, - NULL); - - if (tp_handle_lookup (contact_repo, from, NULL, NULL) == self_handle) - { - DEBUG ("Ignoring echoed activity properties message from myself"); - return TRUE; - } - } - - activity = g_hash_table_lookup (conn->olpc_activities_info, - GUINT_TO_POINTER (room_handle)); - - if (contact_handle != 0) - { - their_invites = g_hash_table_lookup (conn->olpc_invited_activities, - GUINT_TO_POINTER (contact_handle)); - if (their_invites == NULL) - { - activities_changed = TRUE; - their_invites = tp_handle_set_new (room_repo); - g_hash_table_insert (conn->olpc_invited_activities, - GUINT_TO_POINTER (contact_handle), their_invites); - } - else - { - activities_changed = !tp_handle_set_is_member (their_invites, - room_handle); - } - - if (activity == NULL) - { - DEBUG ("... creating new Activity"); - activity = add_activity_info (conn, room_handle); - tp_handle_set_add (their_invites, room_handle); - } - else if (!tp_handle_set_is_member (their_invites, room_handle)) - { - DEBUG ("... it's the first time that contact invited me, " - "referencing Activity on their behalf"); - g_object_ref (activity); - tp_handle_set_add (their_invites, room_handle); - } - } - else - { - activities_changed = FALSE; - /* we're in the room, so it ought to have an Activity ref'd */ - g_assert (activity != NULL); - } - - new_properties = lm_message_node_extract_properties (node, - "property"); - g_assert (new_properties); - - /* before applying the changes, gather enough information to work out - * whether anything changed */ - - old_properties = activity->properties; - - was_visible = gabble_olpc_activity_is_visible (activity); - - properties_changed = old_properties == NULL - || properties_contains_new_infos (old_properties, new_properties); - - /* apply the info we found */ - - if (tp_strdiff (activity->id, id)) - { - DEBUG ("... recording new activity ID %s", id); - g_object_set (activity, "id", id, NULL); - } - - g_object_set (activity, "properties", new_properties, NULL); - - /* emit signals and amend our PEP nodes, if necessary */ - - is_visible = gabble_olpc_activity_is_visible (activity); - - if (is_visible) - { - pep_properties_changed = properties_changed || !was_visible; - } - else - { - pep_properties_changed = was_visible; - } - - if (properties_changed) - gabble_svc_olpc_activity_properties_emit_activity_properties_changed (conn, - room_handle, new_properties); - - if (activities_changed) - { - GPtrArray *activities; - g_assert (contact_handle != 0); - - activities = get_buddy_activities (conn, contact_handle); - gabble_svc_olpc_buddy_info_emit_activities_changed (conn, contact_handle, - activities); - free_activities (activities); - } - - if (properties_changed && muc_channel != NULL) - refresh_invitations (conn, muc_channel, activity, NULL); - - /* If we're announcing this activity, we might need to change our PEP node */ - if (pep_properties_changed) - { - our_activities = g_hash_table_lookup (conn->olpc_pep_activities, - GUINT_TO_POINTER (tp_base_connection_get_self_handle (base))); - if (our_activities != NULL && - tp_handle_set_is_member (our_activities, room_handle)) - { - if (!upload_activity_properties_pep (conn, - pseudo_invite_reply_cb, NULL, NULL)) - { - DEBUG ("Failed to send PEP properties change in response to " - "properties change message"); - } - } - } - - if (is_visible != was_visible) - { - our_activities = g_hash_table_lookup (conn->olpc_pep_activities, - GUINT_TO_POINTER (tp_base_connection_get_self_handle (base))); - if (our_activities != NULL && - tp_handle_set_is_member (our_activities, room_handle)) - { - if (!upload_activities_pep (conn, - pseudo_invite_reply_cb, NULL, NULL)) - { - DEBUG ("Failed to send PEP activities change in response to " - "properties change message"); - } - } - } - - return TRUE; -} - -static void -closed_pep_reply_cb (GabbleConnection *conn, - WockyStanza *sent_msg, - WockyStanza *reply_msg, - GObject *object, - gpointer user_data) -{ - if (!check_publish_reply_msg (reply_msg, NULL)) - { - STANZA_DEBUG (reply_msg, "Failed to make PEP change in " - "response to channel closure"); - STANZA_DEBUG (sent_msg, "The failed request was"); - } -} - -static gboolean -revoke_invitations (GabbleConnection *conn, - GabbleMucChannel *chan, - GabbleOlpcActivity *activity, - GError **error) -{ - TpHandleRepoIface *contact_repo = tp_base_connection_get_handles ( - (TpBaseConnection *) conn, TP_HANDLE_TYPE_CONTACT); - TpHandleSet *invitees = g_object_get_qdata ((GObject *) chan, - invitees_quark ()); - - if (activity->id == NULL) - /* this is not a real OLPC activity */ - return TRUE; - - if (invitees != NULL && tp_handle_set_size (invitees) > 0) - { - TpIntsetFastIter iter; - guint element; - - tp_intset_fast_iter_init (&iter, tp_handle_set_peek (invitees)); - - DEBUG ("revoke invitations for activity %s", activity->id); - while (tp_intset_fast_iter_next (&iter, &element)) - { - const gchar *to = tp_handle_inspect (contact_repo, element); - WockyStanza *msg = wocky_stanza_build ( - WOCKY_STANZA_TYPE_MESSAGE, WOCKY_STANZA_SUB_TYPE_NONE, - NULL, to, - '(', "uninvite", ':', NS_OLPC_ACTIVITY_PROPS, - '@', "room", gabble_olpc_activity_get_room (activity), - '@', "id", activity->id, - ')', NULL); - - if (!_gabble_connection_send (conn, msg, error)) - { - DEBUG ("Unable to send activity invitee revocation %s", - to); - g_object_unref (msg); - return FALSE; - } - - g_object_unref (msg); - } - } - - return TRUE; -} - -gboolean -conn_olpc_process_activity_uninvite_message (GabbleConnection *conn, - WockyStanza *msg, - const gchar *from) -{ - TpHandleRepoIface *room_repo = tp_base_connection_get_handles ( - (TpBaseConnection *) conn, TP_HANDLE_TYPE_ROOM); - TpHandleRepoIface *contact_repo = tp_base_connection_get_handles ( - (TpBaseConnection *) conn, TP_HANDLE_TYPE_CONTACT); - WockyNode *node; - const gchar *id, *room; - TpHandle room_handle, from_handle; - TpHandleSet *rooms; - - node = search_for_child ( - wocky_stanza_get_top_node (msg), "uninvite", NS_OLPC_ACTIVITY_PROPS); - - /* if no <uninvite xmlns=...>, then not for us */ - if (node == NULL) - return FALSE; - - id = wocky_node_get_attribute (node, "id"); - if (id == NULL) - { - DEBUG ("no activity id. Skip"); - return TRUE; - } - - room = wocky_node_get_attribute (node, "room"); - if (room == NULL) - { - DEBUG ("no room. Skip"); - return TRUE; - } - - room_handle = tp_handle_lookup (room_repo, room, NULL, NULL); - if (room_handle == 0) - { - DEBUG ("room %s unknown", room); - return TRUE; - } - - from_handle = tp_handle_lookup (contact_repo, from, NULL, NULL); - if (from_handle == 0) - { - DEBUG ("sender %s unknown", from); - return TRUE; - } - - rooms = g_hash_table_lookup (conn->olpc_invited_activities, - GUINT_TO_POINTER (from_handle)); - - if (rooms == NULL) - { - DEBUG ("No invites associated with contact %d", from_handle); - return TRUE; - } - - if (tp_handle_set_remove (rooms, room_handle)) - { - GabbleOlpcActivity *activity; - GPtrArray *activities; - - activity = g_hash_table_lookup (conn->olpc_activities_info, - GUINT_TO_POINTER (room_handle)); - - if (activity == NULL) - { - DEBUG ("No info about activity associated with room %s", room); - return TRUE; - } - - if (tp_strdiff (id, activity->id)) - { - DEBUG ("Uninvite's activity id (%s) doesn't match our " - "activity id (%s)", id, activity->id); - return TRUE; - } - - DEBUG ("remove invite from %s", from); - g_object_unref (activity); - - /* Emit BuddyInfo::ActivitiesChanged */ - activities = get_buddy_activities (conn, from_handle); - gabble_svc_olpc_buddy_info_emit_activities_changed (conn, from_handle, - activities); - free_activities (activities); - } - else - { - DEBUG ("No invite from %s for activity %s (room %s)", from, id, room); - return TRUE; - } - - return TRUE; -} - -static void -muc_channel_closed_cb (GabbleMucChannel *chan, - GabbleOlpcActivity *activity) -{ - GabbleConnection *conn; - TpBaseConnection *base; - TpHandleSet *my_activities; - gboolean was_in_our_pep = FALSE; - - /* is the muc channel /actually/ disappearing */ - if (!tp_base_channel_is_destroyed (TP_BASE_CHANNEL (chan))) - return; - - g_object_get (activity, "connection", &conn, NULL); - base = TP_BASE_CONNECTION (conn); - - /* Revoke invitations we sent for this activity */ - revoke_invitations (conn, chan, activity, NULL); - - /* remove it from our advertised activities list, unreffing it in the - * process if it was in fact advertised */ - my_activities = g_hash_table_lookup (conn->olpc_pep_activities, - GUINT_TO_POINTER (tp_base_connection_get_self_handle (base))); - if (my_activities != NULL) - { - if (tp_handle_set_remove (my_activities, activity->room)) - { - was_in_our_pep = gabble_olpc_activity_is_visible (activity); - g_object_unref (activity); - } - } - - /* unref it again (it was referenced on behalf of the channel) */ - g_object_unref (activity); - - if (was_in_our_pep) - { - if (!upload_activities_pep (conn, closed_pep_reply_cb, NULL, NULL)) - { - DEBUG ("Failed to send PEP activities change in response to " - "channel close"); - } - if (!upload_activity_properties_pep (conn, closed_pep_reply_cb, NULL, - NULL)) - { - DEBUG ("Failed to send PEP activity props change in response to " - "channel close"); - } - } - - g_object_unref (conn); -} - -static void -muc_channel_pre_invite_cb (GabbleMucChannel *chan, - const gchar *jid, - GabbleOlpcActivity *activity) -{ - GabbleConnection *conn; - TpHandleRepoIface *contact_repo; - GQuark quark = invitees_quark (); - TpHandleSet *invitees; - /* send them the properties */ - WockyStanza *msg; - TpHandle handle; - GError *error = NULL; - - g_object_get (activity, "connection", &conn, NULL); - contact_repo = tp_base_connection_get_handles - ((TpBaseConnection *) conn, TP_HANDLE_TYPE_CONTACT); - - msg = wocky_stanza_build ( - WOCKY_STANZA_TYPE_MESSAGE, WOCKY_STANZA_SUB_TYPE_NONE, - NULL, jid, - NULL); - - if (activity_info_contribute_properties (activity, - wocky_stanza_get_top_node (msg), FALSE)) - { - /* not much we can do about errors - but if this fails, the invitation - * will too, unless something extremely strange is going on */ - if (!_gabble_connection_send (conn, msg, NULL)) - { - DEBUG ("Unable to send activity properties to invitee"); - } - } - g_object_unref (msg); - - handle = tp_handle_ensure (contact_repo, jid, NULL, &error); - if (handle == 0) - { - DEBUG ("can't add %s to invitees: %s", jid, error->message); - g_error_free (error); - g_object_unref (conn); - return; - } - - invitees = g_object_get_qdata ((GObject *) chan, quark); - if (invitees == NULL) - { - invitees = tp_handle_set_new (contact_repo); - g_object_set_qdata_full ((GObject *) chan, quark, invitees, - (GDestroyNotify) tp_handle_set_destroy); - } - - tp_handle_set_add (invitees, handle); - - g_object_unref (conn); -} - -typedef struct -{ - GabbleConnection *conn; - TpHandle room_handle; -} remove_invite_foreach_ctx; - -static void -remove_invite_foreach (gpointer key, - gpointer value, - gpointer user_data) -{ - TpHandle inviter = GPOINTER_TO_UINT (key); - TpHandleSet *rooms = (TpHandleSet *) value; - remove_invite_foreach_ctx *ctx = (remove_invite_foreach_ctx *) user_data; - - /* We are now in the activity and so the responsibilty to track - * buddies membership is delegated to the PS. At some point, maybe that - * should be done by CM's */ - if (tp_handle_set_remove (rooms, ctx->room_handle)) - { - GabbleOlpcActivity *activity; - GPtrArray *activities; - - activity = g_hash_table_lookup (ctx->conn->olpc_activities_info, - GUINT_TO_POINTER (ctx->room_handle)); - - activities = get_buddy_activities (ctx->conn, inviter); - gabble_svc_olpc_buddy_info_emit_activities_changed (ctx->conn, inviter, - activities); - free_activities (activities); - - g_assert (activity != NULL); - DEBUG ("forget invite for activity %s from contact %d", activity->id, - inviter); - g_object_unref (activity); - } -} - -static void -forget_activity_invites (GabbleConnection *conn, - TpHandle room_handle) -{ - remove_invite_foreach_ctx ctx; - - ctx.conn = conn; - ctx.room_handle = room_handle; - g_hash_table_foreach (conn->olpc_invited_activities, remove_invite_foreach, - &ctx); -} - -static void -muc_channel_contact_join_cb (GabbleMucChannel *chan, - TpHandle contact, - GabbleOlpcActivity *activity) -{ - GabbleConnection *conn; - TpBaseConnection *base; - - g_object_get (activity, "connection", &conn, NULL); - base = TP_BASE_CONNECTION (conn); - - if (contact == tp_base_connection_get_self_handle (base)) - { - /* We join the channel, forget about all invites we received about - * this activity */ - forget_activity_invites (conn, activity->room); - } - else - { - GQuark quark = invitees_quark (); - TpHandleSet *invitees; - - invitees = g_object_get_qdata ((GObject *) chan, quark); - if (invitees != NULL) - { - DEBUG ("contact %d joined the muc, remove the invite we sent to him", - contact); - tp_handle_set_remove (invitees, contact); - } - } - - g_object_unref (conn); -} - -static void -muc_factory_new_channel_cb (gpointer key, - gpointer value, - gpointer data) -{ - GabbleConnection *conn = GABBLE_CONNECTION (data); - TpExportableChannel *chan = TP_EXPORTABLE_CHANNEL (key); - GabbleOlpcActivity *activity; - TpHandle room_handle; - - if (!GABBLE_IS_MUC_CHANNEL (chan)) - return; - - g_object_get (chan, - "handle", &room_handle, - NULL); - - /* ref the activity as long as we have a channel open */ - - activity = g_hash_table_lookup (conn->olpc_activities_info, - GUINT_TO_POINTER (room_handle)); - - if (activity == NULL) - { - activity = add_activity_info (conn, room_handle); - } - else - { - g_object_ref (activity); - } - - g_signal_connect (chan, "closed", G_CALLBACK (muc_channel_closed_cb), - activity); - g_signal_connect (chan, "pre-invite", G_CALLBACK (muc_channel_pre_invite_cb), - activity); - g_signal_connect (chan, "contact-join", - G_CALLBACK (muc_channel_contact_join_cb), activity); -} - -static void -muc_factory_new_channels_cb (GabbleMucFactory *fac, - GHashTable *channels, - GabbleConnection *conn) -{ - g_hash_table_foreach (channels, muc_factory_new_channel_cb, conn); -} - -static void -connection_presence_do_update (GabblePresenceCache *cache, - TpHandle handle, - GabbleConnection *conn) -{ - GabblePresence *presence; - - presence = gabble_presence_cache_get (cache, handle); - - if (presence && presence->status <= GABBLE_PRESENCE_LAST_UNAVAILABLE) - { - /* Contact becomes unavailable. We have to unref all the information - * provided by him - */ - GPtrArray *empty = g_ptr_array_new (); - TpHandleSet *list; - - list = g_hash_table_lookup (conn->olpc_pep_activities, - GUINT_TO_POINTER (handle)); - - if (list != NULL) - tp_handle_set_foreach (list, - decrement_contacts_activities_set_foreach, conn); - - g_hash_table_remove (conn->olpc_pep_activities, - GUINT_TO_POINTER (handle)); - - list = g_hash_table_lookup (conn->olpc_invited_activities, - GUINT_TO_POINTER (handle)); - - if (list != NULL) - tp_handle_set_foreach (list, - decrement_contacts_activities_set_foreach, conn); - - g_hash_table_remove (conn->olpc_invited_activities, - GUINT_TO_POINTER (handle)); - - gabble_svc_olpc_buddy_info_emit_activities_changed (conn, handle, - empty); - g_ptr_array_unref (empty); - } -} - -static void -connection_presences_updated_cb (GabblePresenceCache *cache, - GArray *handles, - GabbleConnection *conn) -{ - guint i; - - for (i = 0; i < handles->len ; i++) - { - TpHandle handle; - - handle = g_array_index (handles, TpHandle, i); - connection_presence_do_update (cache, handle, conn); - } -} - -void -conn_olpc_activity_properties_init (GabbleConnection *conn) -{ - /* room TpHandle => borrowed Activity */ - conn->olpc_activities_info = g_hash_table_new_full (g_direct_hash, - g_direct_equal, NULL, NULL); - - /* Activity from PEP - * - * contact TpHandle => TpHandleSet of room handles, - * each representing a reference to an Activity - * - * Special case: the entry for self_handle is the complete list of - * activities, not just those from PEP - */ - conn->olpc_pep_activities = g_hash_table_new_full (g_direct_hash, - g_direct_equal, NULL, (GDestroyNotify) tp_handle_set_destroy); - - /* Activity from pseudo-invitations - * - * contact TpHandle => TpHandleSet of room handles, - * each representing a reference to an Activity - * - * Special case: there is never an entry for self_handle - */ - conn->olpc_invited_activities = g_hash_table_new_full (g_direct_hash, - g_direct_equal, NULL, (GDestroyNotify) tp_handle_set_destroy); - - /* Current activity - * - * contact TpHandle => reffed GabbleOlpcActivity - */ - conn->olpc_current_act = g_hash_table_new_full (g_direct_hash, - g_direct_equal, NULL, (GDestroyNotify) g_object_unref); - - g_signal_connect (conn, "status-changed", - G_CALLBACK (connection_status_changed_cb), NULL); - - g_signal_connect (TP_CHANNEL_MANAGER (conn->muc_factory), "new-channels", - G_CALLBACK (muc_factory_new_channels_cb), conn); - - g_signal_connect (conn->presence_cache, "presences-updated", - G_CALLBACK (connection_presences_updated_cb), conn); - - conn->pep_olpc_buddy_props = wocky_pep_service_new (NS_OLPC_BUDDY_PROPS, - TRUE); - g_signal_connect (conn->pep_olpc_buddy_props, "changed", - G_CALLBACK (olpc_buddy_props_pep_node_changed), conn); - - conn->pep_olpc_activities = wocky_pep_service_new (NS_OLPC_ACTIVITIES, - TRUE); - g_signal_connect (conn->pep_olpc_activities, "changed", - G_CALLBACK (olpc_activities_pep_node_changed), conn); - - conn->pep_olpc_current_act = wocky_pep_service_new (NS_OLPC_CURRENT_ACTIVITY, - TRUE); - g_signal_connect (conn->pep_olpc_current_act, "changed", - G_CALLBACK (olpc_current_act_pep_node_changed), conn); - - conn->pep_olpc_act_props = wocky_pep_service_new (NS_OLPC_ACTIVITY_PROPS, - TRUE); - g_signal_connect (conn->pep_olpc_act_props, "changed", - G_CALLBACK (olpc_act_props_pep_node_changed), conn); -} - -static void -unref_activities_in_each_set (TpHandle handle, - TpHandleSet *set, - GabbleConnection *conn) -{ - if (set != NULL) - { - tp_handle_set_foreach (set, - decrement_contacts_activities_set_foreach, conn); - } -} - -void -conn_olpc_activity_properties_dispose (GabbleConnection *self) -{ - g_hash_table_unref (self->olpc_current_act); - self->olpc_current_act = NULL; - - g_hash_table_foreach (self->olpc_pep_activities, - (GHFunc) unref_activities_in_each_set, self); - g_hash_table_unref (self->olpc_pep_activities); - self->olpc_pep_activities = NULL; - - g_hash_table_foreach (self->olpc_invited_activities, - (GHFunc) unref_activities_in_each_set, self); - g_hash_table_unref (self->olpc_invited_activities); - self->olpc_invited_activities = NULL; - - g_hash_table_unref (self->olpc_activities_info); - self->olpc_activities_info = NULL; -} - -static GabbleOlpcActivity * -find_activity_by_id (GabbleConnection *self, - const gchar *activity_id) -{ - GHashTableIter iter; - gpointer key, value; - - g_hash_table_iter_init (&iter, self->olpc_activities_info); - while (g_hash_table_iter_next (&iter, &key, &value)) - { - GabbleOlpcActivity *activity = GABBLE_OLPC_ACTIVITY (value); - if (!tp_strdiff (activity->id, activity_id)) - return activity; - } - - return NULL; -} - -static void -olpc_activity_properties_get_activity (GabbleSvcOLPCActivityProperties *iface, - const gchar *activity_id, - DBusGMethodInvocation *context) -{ - GabbleConnection *self = GABBLE_CONNECTION (iface); - TpBaseConnection *base = (TpBaseConnection *) self; - GabbleOlpcActivity *activity; - GError *error = NULL; - - TP_BASE_CONNECTION_ERROR_IF_NOT_CONNECTED (base, context); - - activity = find_activity_by_id (self, activity_id); - if (activity == NULL) - { - g_set_error (&error, TP_ERROR, TP_ERROR_NOT_AVAILABLE, - "Activity unknown: %s", activity_id); - goto error; - } - - gabble_svc_olpc_activity_properties_return_from_get_activity (context, - activity->room); - - return; - -error: - dbus_g_method_return_error (context, error); - g_error_free (error); -} - -void -olpc_activity_properties_iface_init (gpointer g_iface, - gpointer iface_data) -{ - GabbleSvcOLPCActivityPropertiesClass *klass = g_iface; - -#define IMPLEMENT(x) gabble_svc_olpc_activity_properties_implement_##x (\ - klass, olpc_activity_properties_##x) - IMPLEMENT(get_properties); - IMPLEMENT(set_properties); - IMPLEMENT(get_activity); -#undef IMPLEMENT -} - diff --git a/src/conn-olpc.h b/src/conn-olpc.h deleted file mode 100644 index cef23cbbd..000000000 --- a/src/conn-olpc.h +++ /dev/null @@ -1,44 +0,0 @@ -/* - * conn-olpc.h - Header for Gabble OLPC BuddyInfo and ActivityProperties interfaces - * Copyright (C) 2007 Collabora Ltd. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef __CONN_OLPC_H__ -#define __CONN_OLPC_H__ - -#include <extensions/extensions.h> - -#include "connection.h" - -void -olpc_buddy_info_iface_init (gpointer g_iface, gpointer iface_data); - -void -olpc_activity_properties_iface_init (gpointer g_iface, gpointer iface_data); - -void conn_olpc_activity_properties_init (GabbleConnection *conn); - -void conn_olpc_activity_properties_dispose (GabbleConnection *conn); - -gboolean conn_olpc_process_activity_properties_message (GabbleConnection *conn, - WockyStanza *msg, const gchar *from); - -gboolean conn_olpc_process_activity_uninvite_message (GabbleConnection *conn, - WockyStanza *msg, const gchar *from); - -#endif /* __CONN_OLPC_H__ */ - diff --git a/src/conn-power-saving.c b/src/conn-power-saving.c index de6cc54d2..dd7499087 100644 --- a/src/conn-power-saving.c +++ b/src/conn-power-saving.c @@ -71,7 +71,7 @@ maybe_emit_power_saving_changed (GabbleConnection *self, if (enabling != enabled) { g_object_set (self, "power-saving", enabling, NULL); - tp_svc_connection_interface_power_saving_emit_power_saving_changed ( + tp_svc_connection_interface_power_saving1_emit_power_saving_changed ( self, enabling); } } @@ -103,7 +103,7 @@ toggle_google_queueing_cb (GObject *source_object, { DEBUG ("%sabled queueing", enabling ? "en" : "dis"); - tp_svc_connection_interface_power_saving_return_from_set_power_saving ( + tp_svc_connection_interface_power_saving1_return_from_set_power_saving ( queueing_context->dbus_context); if (!enabling) @@ -117,7 +117,7 @@ toggle_google_queueing_cb (GObject *source_object, static void conn_power_saving_set_power_saving ( - TpSvcConnectionInterfacePowerSaving *conn, + TpSvcConnectionInterfacePowerSaving1 *conn, gboolean enable, DBusGMethodInvocation *context) { @@ -132,7 +132,7 @@ conn_power_saving_set_power_saving ( if (enable == enabled) { /* no-op */ - tp_svc_connection_interface_power_saving_return_from_set_power_saving ( + tp_svc_connection_interface_power_saving1_return_from_set_power_saving ( context); return; } @@ -165,7 +165,7 @@ conn_power_saving_set_power_saving ( g_object_unref (porter); maybe_emit_power_saving_changed (self, enable); - tp_svc_connection_interface_power_saving_return_from_set_power_saving ( + tp_svc_connection_interface_power_saving1_return_from_set_power_saving ( context); } } @@ -175,7 +175,7 @@ conn_power_saving_iface_init (gpointer g_iface, gpointer iface_data) { #define IMPLEMENT(x) \ - tp_svc_connection_interface_power_saving_implement_##x (\ + tp_svc_connection_interface_power_saving1_implement_##x (\ g_iface, conn_power_saving_##x) IMPLEMENT (set_power_saving); #undef IMPLEMENT diff --git a/src/conn-presence.c b/src/conn-presence.c index 7798b6142..0e02dc7f4 100644 --- a/src/conn-presence.c +++ b/src/conn-presence.c @@ -31,8 +31,6 @@ #define DEBUG_FLAG GABBLE_DEBUG_CONNECTION -#include "extensions/extensions.h" /* for Decloak */ - #include "connection.h" #include "debug.h" #include "plugin-loader.h" @@ -168,69 +166,76 @@ conn_presence_error_quark (void) return quark; } -static GHashTable * -construct_contact_statuses_cb (GObject *obj, - const GArray *contact_handles, - GError **error) +static TpPresenceStatus *construct_contact_status (GObject *obj, + TpHandle handle) { GabbleConnection *self = GABBLE_CONNECTION (obj); TpBaseConnection *base = (TpBaseConnection *) self; - guint i; - TpHandle handle; - GHashTable *contact_statuses, *parameters; + GHashTable *parameters; TpPresenceStatus *contact_status; GValue *message; GabblePresence *presence; GabblePresenceId status; const gchar *status_message; - TpHandleRepoIface *handle_repo = tp_base_connection_get_handles (base, - TP_HANDLE_TYPE_CONTACT); - if (!tp_handles_are_valid (handle_repo, contact_handles, FALSE, error)) - return NULL; - - contact_statuses = g_hash_table_new_full (g_direct_hash, g_direct_equal, NULL, - (GDestroyNotify) tp_presence_status_free); + if (handle == tp_base_connection_get_self_handle (base)) + presence = self->self_presence; + else + presence = gabble_presence_cache_get (self->presence_cache, handle); - for (i = 0; i < contact_handles->len; i++) + if (presence) { - handle = g_array_index (contact_handles, TpHandle, i); + status = presence->status; + status_message = presence->status_message; + } + else + { + if (gabble_roster_handle_sends_presence_to_us (self->roster, handle)) + status = GABBLE_PRESENCE_OFFLINE; + else + status = GABBLE_PRESENCE_UNKNOWN; - if (handle == tp_base_connection_get_self_handle (base)) - presence = self->self_presence; - else - presence = gabble_presence_cache_get (self->presence_cache, handle); + status_message = NULL; + } - if (presence) - { - status = presence->status; - status_message = presence->status_message; - } - else - { - if (gabble_roster_handle_sends_presence_to_us (self->roster, handle)) - status = GABBLE_PRESENCE_OFFLINE; - else - status = GABBLE_PRESENCE_UNKNOWN; + parameters = g_hash_table_new_full (g_str_hash, g_str_equal, NULL, + (GDestroyNotify) tp_g_value_slice_free); - status_message = NULL; - } + if (status_message != NULL) + { + message = tp_g_value_slice_new (G_TYPE_STRING); + g_value_set_static_string (message, status_message); + g_hash_table_insert (parameters, "message", message); + } - parameters = g_hash_table_new_full (g_str_hash, g_str_equal, NULL, - (GDestroyNotify) tp_g_value_slice_free); + contact_status = tp_presence_status_new (status, parameters); + g_hash_table_unref (parameters); + return contact_status; +} - if (status_message != NULL) - { - message = tp_g_value_slice_new (G_TYPE_STRING); - g_value_set_static_string (message, status_message); - g_hash_table_insert (parameters, "message", message); - } +static GHashTable * +construct_contact_statuses (GabbleConnection *self, + const GArray *contact_handles) +{ + TpBaseConnection *base = (TpBaseConnection *) self; + guint i; + TpHandle handle; + GHashTable *contact_statuses; + TpHandleRepoIface *handle_repo = tp_base_connection_get_handles (base, + TP_ENTITY_TYPE_CONTACT); - contact_status = tp_presence_status_new (status, parameters); - g_hash_table_unref (parameters); + g_return_val_if_fail (tp_handles_are_valid (handle_repo, contact_handles, + FALSE, NULL), NULL); + + contact_statuses = g_hash_table_new_full (g_direct_hash, g_direct_equal, NULL, + (GDestroyNotify) tp_presence_status_free); + + for (i = 0; i < contact_handles->len; i++) + { + handle = g_array_index (contact_handles, TpHandle, i); g_hash_table_insert (contact_statuses, GUINT_TO_POINTER (handle), - contact_status); + construct_contact_status ((GObject *) self, handle)); } return contact_statuses; @@ -252,8 +257,8 @@ conn_presence_emit_presence_update ( { GHashTable *contact_statuses; - contact_statuses = construct_contact_statuses_cb ((GObject *) self, - contact_handles, NULL); + contact_statuses = construct_contact_statuses (self, + contact_handles); tp_presence_mixin_emit_presence_update ((GObject *) self, contact_statuses); g_hash_table_unref (contact_statuses); } @@ -1935,13 +1940,13 @@ conn_presence_class_init (GabbleConnectionClass *klass) tp_presence_mixin_class_init ((GObjectClass *) klass, G_STRUCT_OFFSET (GabbleConnectionClass, presence_class), - status_available_cb, construct_contact_statuses_cb, + status_available_cb, construct_contact_status, set_own_status_cb, conn_presence_statuses ()); mixin_cls = TP_PRESENCE_MIXIN_CLASS (klass); mixin_cls->get_maximum_status_message_length = get_maximum_status_message_length_cb; - tp_presence_mixin_simple_presence_init_dbus_properties ( + tp_presence_mixin_init_dbus_properties ( (GObjectClass *) klass); } @@ -1963,9 +1968,6 @@ conn_presence_init (GabbleConnection *conn) tp_presence_mixin_init ((GObject *) conn, G_STRUCT_OFFSET (GabbleConnection, presence)); - - tp_presence_mixin_simple_presence_register_with_contacts_mixin ( - G_OBJECT (conn)); } void @@ -2009,65 +2011,3 @@ conn_presence_finalize (GabbleConnection *conn) tp_presence_mixin_finalize ((GObject *) conn); } - -static void -conn_presence_send_directed_presence ( - GabbleSvcConnectionInterfaceGabbleDecloak *conn, - guint contact, - gboolean full, - DBusGMethodInvocation *context) -{ - GabbleConnection *self = GABBLE_CONNECTION (conn); - TpBaseConnection *base = TP_BASE_CONNECTION (conn); - TpHandleRepoIface *contact_handles = tp_base_connection_get_handles (base, - TP_HANDLE_TYPE_CONTACT); - const gchar *jid = tp_handle_inspect (contact_handles, contact); - gboolean ok; - GError *error = NULL; - - g_return_if_fail (jid != NULL); - - /* We don't strictly respect @full - we'll always send full presence to - * people we think ought to be receiving it anyway, because if we didn't, - * you could confuse them by sending directed presence that was less - * informative than the broadcast presence they already saw. */ - if (full || conn_presence_visible_to (self, contact)) - { - ok = conn_presence_signal_own_presence (self, jid, &error); - } - else - { - ok = gabble_connection_send_capabilities (self, jid, &error); - } - - if (ok) - { - gabble_svc_connection_interface_gabble_decloak_return_from_send_directed_presence (context); - } - else - { - dbus_g_method_return_error (context, error); - g_error_free (error); - } -} - -void -conn_decloak_emit_requested (GabbleConnection *conn, - TpHandle contact, - const gchar *reason, - gboolean decloaked) -{ - gabble_svc_connection_interface_gabble_decloak_emit_decloak_requested (conn, - contact, reason, decloaked); -} - -void -conn_decloak_iface_init (gpointer g_iface, - gpointer iface_data) -{ -#define IMPLEMENT(x) \ - gabble_svc_connection_interface_gabble_decloak_implement_##x (\ - g_iface, conn_presence_##x) - IMPLEMENT (send_directed_presence); -#undef IMPLEMENT -} diff --git a/src/conn-presence.h b/src/conn-presence.h index 6756f6923..4b060c6d4 100644 --- a/src/conn-presence.h +++ b/src/conn-presence.h @@ -56,10 +56,6 @@ void conn_presence_set_initial_presence_async (GabbleConnection *self, gboolean conn_presence_set_initial_presence_finish (GabbleConnection *self, GAsyncResult *result, GError **error); -void conn_decloak_iface_init (gpointer g_iface, gpointer iface_data); -void conn_decloak_emit_requested (GabbleConnection *conn, - TpHandle contact, const gchar *reason, gboolean decloaked); - TpConnectionPresenceType conn_presence_get_type (GabblePresence *presence); const TpPresenceStatusSpec *conn_presence_statuses (void); diff --git a/src/conn-util.c b/src/conn-util.c index 00f2e4d15..7fc721be1 100644 --- a/src/conn-util.c +++ b/src/conn-util.c @@ -108,7 +108,7 @@ conn_util_get_bare_self_jid (GabbleConnection *conn) { TpBaseConnection *base = TP_BASE_CONNECTION (conn); TpHandleRepoIface *contact_handles = tp_base_connection_get_handles (base, - TP_HANDLE_TYPE_CONTACT); + TP_ENTITY_TYPE_CONTACT); TpHandle self = tp_base_connection_get_self_handle (base); return tp_handle_inspect (contact_handles, self); diff --git a/src/connection.c b/src/connection.c index 598e57171..5207ed611 100644 --- a/src/connection.c +++ b/src/connection.c @@ -52,7 +52,6 @@ #include "conn-presence.h" #include "conn-sidecars.h" #include "conn-mail-notif.h" -#include "conn-olpc.h" #include "conn-power-saving.h" #include "debug.h" #include "disco.h" @@ -83,8 +82,6 @@ static guint disco_reply_timeout = 5; #define DISCONNECT_TIMEOUT 5 static void gabble_conn_contact_caps_iface_init (gpointer, gpointer); -static void conn_contact_capabilities_fill_contact_attributes (GObject *obj, - const GArray *contacts, GHashTable *attributes_hash); static void gabble_plugin_connection_iface_init ( GabblePluginConnectionInterface *iface, gpointer conn); @@ -96,44 +93,36 @@ static TpBaseContactList *_gabble_plugin_connection_get_contact_list ( G_DEFINE_TYPE_WITH_CODE(GabbleConnection, gabble_connection, TP_TYPE_BASE_CONNECTION, - G_IMPLEMENT_INTERFACE (TP_TYPE_SVC_CONNECTION_INTERFACE_ALIASING, + G_IMPLEMENT_INTERFACE (TP_TYPE_SVC_CONNECTION_INTERFACE_ALIASING1, conn_aliasing_iface_init); - G_IMPLEMENT_INTERFACE (TP_TYPE_SVC_CONNECTION_INTERFACE_AVATARS, + G_IMPLEMENT_INTERFACE (TP_TYPE_SVC_CONNECTION_INTERFACE_AVATARS1, conn_avatars_iface_init); - G_IMPLEMENT_INTERFACE (TP_TYPE_SVC_CONNECTION_INTERFACE_CONTACT_INFO, + G_IMPLEMENT_INTERFACE (TP_TYPE_SVC_CONNECTION_INTERFACE_CONTACT_INFO1, conn_contact_info_iface_init); G_IMPLEMENT_INTERFACE (TP_TYPE_SVC_DBUS_PROPERTIES, tp_dbus_properties_mixin_iface_init); - G_IMPLEMENT_INTERFACE (TP_TYPE_SVC_CONNECTION_INTERFACE_CONTACTS, - tp_contacts_mixin_iface_init); - G_IMPLEMENT_INTERFACE (TP_TYPE_SVC_CONNECTION_INTERFACE_CONTACT_LIST, + G_IMPLEMENT_INTERFACE (TP_TYPE_SVC_CONNECTION_INTERFACE_CONTACT_LIST1, tp_base_contact_list_mixin_list_iface_init); - G_IMPLEMENT_INTERFACE (TP_TYPE_SVC_CONNECTION_INTERFACE_CONTACT_GROUPS, + G_IMPLEMENT_INTERFACE (TP_TYPE_SVC_CONNECTION_INTERFACE_CONTACT_GROUPS1, tp_base_contact_list_mixin_groups_iface_init); - G_IMPLEMENT_INTERFACE (TP_TYPE_SVC_CONNECTION_INTERFACE_CONTACT_BLOCKING, + G_IMPLEMENT_INTERFACE (TP_TYPE_SVC_CONNECTION_INTERFACE_CONTACT_BLOCKING1, tp_base_contact_list_mixin_blocking_iface_init); - G_IMPLEMENT_INTERFACE (TP_TYPE_SVC_CONNECTION_INTERFACE_SIMPLE_PRESENCE, - tp_presence_mixin_simple_presence_iface_init); - G_IMPLEMENT_INTERFACE (GABBLE_TYPE_SVC_CONNECTION_INTERFACE_GABBLE_DECLOAK, - conn_decloak_iface_init); - G_IMPLEMENT_INTERFACE (TP_TYPE_SVC_CONNECTION_INTERFACE_LOCATION, + G_IMPLEMENT_INTERFACE (TP_TYPE_SVC_CONNECTION_INTERFACE_PRESENCE1, + tp_presence_mixin_iface_init); + G_IMPLEMENT_INTERFACE (TP_TYPE_SVC_CONNECTION_INTERFACE_LOCATION1, location_iface_init); - G_IMPLEMENT_INTERFACE (GABBLE_TYPE_SVC_OLPC_BUDDY_INFO, - olpc_buddy_info_iface_init); - G_IMPLEMENT_INTERFACE (GABBLE_TYPE_SVC_OLPC_ACTIVITY_PROPERTIES, - olpc_activity_properties_iface_init); G_IMPLEMENT_INTERFACE - (TP_TYPE_SVC_CONNECTION_INTERFACE_CONTACT_CAPABILITIES, + (TP_TYPE_SVC_CONNECTION_INTERFACE_CONTACT_CAPABILITIES1, gabble_conn_contact_caps_iface_init); G_IMPLEMENT_INTERFACE (TP_TYPE_SVC_CONNECTION_INTERFACE_SIDECARS1, conn_sidecars_iface_init); - G_IMPLEMENT_INTERFACE (TP_TYPE_SVC_CONNECTION_INTERFACE_MAIL_NOTIFICATION, + G_IMPLEMENT_INTERFACE (TP_TYPE_SVC_CONNECTION_INTERFACE_MAIL_NOTIFICATION1, conn_mail_notif_iface_init); - G_IMPLEMENT_INTERFACE (TP_TYPE_SVC_CONNECTION_INTERFACE_CLIENT_TYPES, + G_IMPLEMENT_INTERFACE (TP_TYPE_SVC_CONNECTION_INTERFACE_CLIENT_TYPES1, conn_client_types_iface_init); - G_IMPLEMENT_INTERFACE (TP_TYPE_SVC_CONNECTION_INTERFACE_POWER_SAVING, + G_IMPLEMENT_INTERFACE (TP_TYPE_SVC_CONNECTION_INTERFACE_POWER_SAVING1, conn_power_saving_iface_init); - G_IMPLEMENT_INTERFACE (TP_TYPE_SVC_CONNECTION_INTERFACE_ADDRESSING, + G_IMPLEMENT_INTERFACE (TP_TYPE_SVC_CONNECTION_INTERFACE_ADDRESSING1, conn_addressing_iface_init); G_IMPLEMENT_INTERFACE (GABBLE_TYPE_PLUGIN_CONNECTION, gabble_plugin_connection_iface_init); @@ -165,7 +154,6 @@ enum PROP_ALIAS, PROP_FALLBACK_SOCKS5_PROXIES, PROP_KEEPALIVE_INTERVAL, - PROP_DECLOAK_AUTOMATICALLY, PROP_FALLBACK_SERVERS, PROP_EXTRA_CERTIFICATE_IDENTITIES, PROP_POWER_SAVING, @@ -213,8 +201,6 @@ struct _GabbleConnectionPrivate GStrv fallback_socks5_proxies; - gboolean decloak_automatically; - GStrv fallback_servers; guint fallback_server_index; @@ -319,11 +305,6 @@ _gabble_connection_create_channel_managers (TpBaseConnection *conn) GabblePluginLoader *loader; GPtrArray *tmp; - self->roster = gabble_roster_new (self); - g_signal_connect (self->roster, "nicknames-update", G_CALLBACK - (gabble_conn_aliasing_nicknames_updated), self); - g_ptr_array_add (channel_managers, self->roster); - self->priv->im_factory = g_object_new (GABBLE_TYPE_IM_FACTORY, "connection", self, NULL); @@ -415,7 +396,7 @@ gabble_connection_constructor (GType type, DEBUG("Post-construction: (GabbleConnection *)%p", self); tp_base_connection_add_possible_client_interest (base, - TP_IFACE_QUARK_CONNECTION_INTERFACE_MAIL_NOTIFICATION); + TP_IFACE_QUARK_CONNECTION_INTERFACE_MAIL_NOTIFICATION1); self->req_pipeline = gabble_request_pipeline_new (self); self->disco = gabble_disco_new (self); @@ -429,27 +410,20 @@ gabble_connection_constructor (GType type, g_signal_connect (self->presence_cache, "capabilities-update", G_CALLBACK (connection_capabilities_update_cb), self); - tp_contacts_mixin_init (G_OBJECT (self), - G_STRUCT_OFFSET (GabbleConnection, contacts)); - - tp_base_connection_register_with_contacts_mixin (base); - tp_base_contact_list_mixin_register_with_contacts_mixin (base); + self->roster = gabble_roster_new (self); + g_signal_connect (self->roster, "nicknames-update", G_CALLBACK + (gabble_conn_aliasing_nicknames_updated), self); conn_aliasing_init (self); conn_avatars_init (self); conn_contact_info_init (self); conn_presence_init (self); - conn_olpc_activity_properties_init (self); conn_location_init (self); conn_sidecars_init (self); conn_mail_notif_init (self); conn_client_types_init (self); conn_addressing_init (self); - tp_contacts_mixin_add_contact_attributes_iface (G_OBJECT (self), - TP_IFACE_CONNECTION_INTERFACE_CONTACT_CAPABILITIES, - conn_contact_capabilities_fill_contact_attributes); - self->bytestream_factory = gabble_bytestream_factory_new (self); self->avatar_requests = g_hash_table_new (NULL, NULL); @@ -638,10 +612,6 @@ gabble_connection_get_property (GObject *object, g_value_set_uint (value, priv->keepalive_interval); break; - case PROP_DECLOAK_AUTOMATICALLY: - g_value_set_boolean (value, priv->decloak_automatically); - break; - case PROP_FALLBACK_SERVERS: g_value_set_boxed (value, priv->fallback_servers); break; @@ -787,10 +757,6 @@ gabble_connection_set_property (GObject *object, priv->keepalive_interval, NULL); break; - case PROP_DECLOAK_AUTOMATICALLY: - priv->decloak_automatically = g_value_get_boolean (value); - break; - case PROP_FALLBACK_SERVERS: if (priv->fallback_servers != NULL) g_strfreev (priv->fallback_servers); @@ -852,13 +818,13 @@ gabble_connection_get_unique_name (TpBaseConnection *self) */ void _gabble_connection_create_handle_repos (TpBaseConnection *conn, - TpHandleRepoIface *repos[TP_NUM_HANDLE_TYPES]) + TpHandleRepoIface *repos[TP_NUM_ENTITY_TYPES]) { - repos[TP_HANDLE_TYPE_CONTACT] = - tp_dynamic_handle_repo_new (TP_HANDLE_TYPE_CONTACT, + repos[TP_ENTITY_TYPE_CONTACT] = + tp_dynamic_handle_repo_new (TP_ENTITY_TYPE_CONTACT, gabble_normalize_contact, GUINT_TO_POINTER (GABBLE_JID_ANY)); - repos[TP_HANDLE_TYPE_ROOM] = - tp_dynamic_handle_repo_new (TP_HANDLE_TYPE_ROOM, gabble_normalize_room, + repos[TP_ENTITY_TYPE_ROOM] = + tp_dynamic_handle_repo_new (TP_ENTITY_TYPE_ROOM, gabble_normalize_room, conn); } @@ -866,29 +832,24 @@ _gabble_connection_create_handle_repos (TpBaseConnection *conn, static const gchar *implemented_interfaces[] = { /* conditionally present interfaces */ - TP_IFACE_CONNECTION_INTERFACE_MAIL_NOTIFICATION, - GABBLE_IFACE_OLPC_ACTIVITY_PROPERTIES, - GABBLE_IFACE_OLPC_BUDDY_INFO, + TP_IFACE_CONNECTION_INTERFACE_MAIL_NOTIFICATION1, /* always present interfaces */ - TP_IFACE_CONNECTION_INTERFACE_POWER_SAVING, - TP_IFACE_CONNECTION_INTERFACE_ALIASING, - TP_IFACE_CONNECTION_INTERFACE_SIMPLE_PRESENCE, - TP_IFACE_CONNECTION_INTERFACE_AVATARS, - TP_IFACE_CONNECTION_INTERFACE_CONTACT_INFO, - TP_IFACE_CONNECTION_INTERFACE_CONTACTS, - TP_IFACE_CONNECTION_INTERFACE_CONTACT_LIST, - TP_IFACE_CONNECTION_INTERFACE_CONTACT_GROUPS, - TP_IFACE_CONNECTION_INTERFACE_REQUESTS, - TP_IFACE_CONNECTION_INTERFACE_CONTACT_CAPABILITIES, - TP_IFACE_CONNECTION_INTERFACE_LOCATION, - GABBLE_IFACE_CONNECTION_INTERFACE_GABBLE_DECLOAK, + TP_IFACE_CONNECTION_INTERFACE_POWER_SAVING1, + TP_IFACE_CONNECTION_INTERFACE_ALIASING1, + TP_IFACE_CONNECTION_INTERFACE_PRESENCE1, + TP_IFACE_CONNECTION_INTERFACE_AVATARS1, + TP_IFACE_CONNECTION_INTERFACE_CONTACT_INFO1, + TP_IFACE_CONNECTION_INTERFACE_CONTACT_LIST1, + TP_IFACE_CONNECTION_INTERFACE_CONTACT_GROUPS1, + TP_IFACE_CONNECTION_INTERFACE_CONTACT_CAPABILITIES1, + TP_IFACE_CONNECTION_INTERFACE_LOCATION1, TP_IFACE_CONNECTION_INTERFACE_SIDECARS1, - TP_IFACE_CONNECTION_INTERFACE_CLIENT_TYPES, - TP_IFACE_CONNECTION_INTERFACE_ADDRESSING, + TP_IFACE_CONNECTION_INTERFACE_CLIENT_TYPES1, + TP_IFACE_CONNECTION_INTERFACE_ADDRESSING1, NULL }; -static const gchar **interfaces_always_present = implemented_interfaces + 3; +static const gchar **interfaces_always_present = implemented_interfaces + 1; const gchar ** gabble_connection_get_implemented_interfaces (void) @@ -917,6 +878,26 @@ _gabble_connection_get_interfaces_always_present (TpBaseConnection *base) return interfaces; } +static TpDBusPropertiesMixinPropImpl conn_aliasing_properties[] = { + { "AliasFlags", GUINT_TO_POINTER (TP_CONNECTION_ALIAS_FLAG_USER_SET), NULL }, + { NULL } +}; + +static void +conn_aliasing_properties_getter (GObject *object, + GQuark interface, + GQuark name, + GValue *value, + gpointer getter_data) +{ + g_value_set_uint (value, GPOINTER_TO_UINT (getter_data)); +} + +static void gabble_connection_fill_contact_attributes (TpBaseConnection *base, + const gchar *dbus_interface, + TpHandle handle, + TpContactAttributeMap *attributes); + static void gabble_connection_class_init (GabbleConnectionClass *gabble_connection_class) { @@ -929,10 +910,6 @@ gabble_connection_class_init (GabbleConnectionClass *gabble_connection_class) { "SupportedLocationFeatures", NULL, NULL }, { NULL } }; - static TpDBusPropertiesMixinPropImpl decloak_props[] = { - { "DecloakAutomatically", TWICE ("decloak-automatically") }, - { NULL } - }; static TpDBusPropertiesMixinPropImpl mail_notif_props[] = { { "MailNotificationFlags", NULL, NULL }, { "UnreadMailCount", NULL, NULL }, @@ -945,36 +922,36 @@ gabble_connection_class_init (GabbleConnectionClass *gabble_connection_class) { NULL } }; static TpDBusPropertiesMixinIfaceImpl prop_interfaces[] = { - /* 0 */ { TP_IFACE_CONNECTION_INTERFACE_LOCATION, + /* 0 */ { TP_IFACE_CONNECTION_INTERFACE_LOCATION1, conn_location_properties_getter, conn_location_properties_setter, location_props, }, - /* 1 */ { TP_IFACE_CONNECTION_INTERFACE_AVATARS, + /* 1 */ { TP_IFACE_CONNECTION_INTERFACE_AVATARS1, conn_avatars_properties_getter, NULL, NULL, }, - /* 2 */ { TP_IFACE_CONNECTION_INTERFACE_CONTACT_INFO, + /* 2 */ { TP_IFACE_CONNECTION_INTERFACE_CONTACT_INFO1, conn_contact_info_properties_getter, NULL, NULL, }, - /* 3 */ { GABBLE_IFACE_CONNECTION_INTERFACE_GABBLE_DECLOAK, - tp_dbus_properties_mixin_getter_gobject_properties, - tp_dbus_properties_mixin_setter_gobject_properties, - decloak_props, - }, - { TP_IFACE_CONNECTION_INTERFACE_MAIL_NOTIFICATION, + { TP_IFACE_CONNECTION_INTERFACE_MAIL_NOTIFICATION1, conn_mail_notif_properties_getter, NULL, mail_notif_props, }, - { TP_IFACE_CONNECTION_INTERFACE_POWER_SAVING, + { TP_IFACE_CONNECTION_INTERFACE_POWER_SAVING1, tp_dbus_properties_mixin_getter_gobject_properties, NULL, power_saving_props, }, + { TP_IFACE_CONNECTION_INTERFACE_ALIASING1, + conn_aliasing_properties_getter, + NULL, + conn_aliasing_properties, + }, { NULL } }; @@ -990,13 +967,14 @@ gabble_connection_class_init (GabbleConnectionClass *gabble_connection_class) parent_class->create_handle_repos = _gabble_connection_create_handle_repos; parent_class->get_unique_connection_name = gabble_connection_get_unique_name; - parent_class->create_channel_factories = NULL; parent_class->create_channel_managers = _gabble_connection_create_channel_managers; parent_class->shut_down = connection_shut_down; parent_class->start_connecting = _gabble_connection_connect; parent_class->get_interfaces_always_present = _gabble_connection_get_interfaces_always_present; + parent_class->fill_contact_attributes = + gabble_connection_fill_contact_attributes; g_type_class_add_private (gabble_connection_class, sizeof (GabbleConnectionPrivate)); @@ -1182,14 +1160,6 @@ gabble_connection_class_init (GabbleConnectionClass *gabble_connection_class) G_PARAM_CONSTRUCT | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); g_object_class_install_property ( - object_class, PROP_DECLOAK_AUTOMATICALLY, - g_param_spec_boolean ( - "decloak-automatically", "Decloak automatically?", - "Leak presence and capabilities when requested", - FALSE, - G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); - - g_object_class_install_property ( object_class, PROP_DOWNLOAD_AT_CONNECTION, g_param_spec_boolean ( "download-roster-at-connection", @@ -1227,9 +1197,6 @@ gabble_connection_class_init (GabbleConnectionClass *gabble_connection_class) tp_dbus_properties_mixin_class_init (object_class, G_STRUCT_OFFSET (GabbleConnectionClass, properties_class)); - tp_contacts_mixin_class_init (object_class, - G_STRUCT_OFFSET (GabbleConnectionClass, contacts_class)); - conn_presence_class_init (gabble_connection_class); conn_contact_info_class_init (gabble_connection_class); @@ -1274,8 +1241,6 @@ gabble_connection_dispose (GObject *object) tp_clear_object (&self->self_presence); tp_clear_object (&self->presence_cache); - conn_olpc_activity_properties_dispose (self); - g_hash_table_unref (self->avatar_requests); g_hash_table_unref (self->vcard_requests); @@ -1308,10 +1273,6 @@ gabble_connection_dispose (GObject *object) tp_clear_object (&self->pep_location); tp_clear_object (&self->pep_nick); - tp_clear_object (&self->pep_olpc_buddy_props); - tp_clear_object (&self->pep_olpc_activities); - tp_clear_object (&self->pep_olpc_current_act); - tp_clear_object (&self->pep_olpc_act_props); conn_sidecars_dispose (self); @@ -1347,8 +1308,6 @@ gabble_connection_finalize (GObject *object) g_free (priv->alias); g_free (priv->stream_id); - tp_contacts_mixin_finalize (G_OBJECT(self)); - conn_aliasing_finalize (self); conn_presence_finalize (self); conn_contact_info_finalize (self); @@ -1886,7 +1845,7 @@ connector_connected (GabbleConnection *self, GabbleConnectionPrivate *priv = self->priv; TpBaseConnection *base = (TpBaseConnection *) self; TpHandleRepoIface *contact_handles = tp_base_connection_get_handles (base, - TP_HANDLE_TYPE_CONTACT); + TP_ENTITY_TYPE_CONTACT); /* cleanup the cancellable */ tp_clear_object (&priv->cancellable); @@ -1934,10 +1893,6 @@ connector_connected (GabbleConnection *self, wocky_pep_service_start (self->pep_location, self->session); wocky_pep_service_start (self->pep_nick, self->session); - wocky_pep_service_start (self->pep_olpc_buddy_props, self->session); - wocky_pep_service_start (self->pep_olpc_activities, self->session); - wocky_pep_service_start (self->pep_olpc_current_act, self->session); - wocky_pep_service_start (self->pep_olpc_act_props, self->session); /* Don't use wocky_session_start as we don't want to start all the * components (Roster, presence-manager, etc) for now */ @@ -2081,7 +2036,7 @@ connection_iq_last_cb ( if (from != NULL) { TpHandleRepoIface *contact_repo = tp_base_connection_get_handles ( - (TpBaseConnection *) self, TP_HANDLE_TYPE_CONTACT); + (TpBaseConnection *) self, TP_ENTITY_TYPE_CONTACT); TpHandle handle = tp_handle_lookup (contact_repo, from, NULL, NULL); /* If there's no handle for them, they're certainly not on the roster. */ @@ -2408,7 +2363,7 @@ gabble_connection_send_capabilities (GabbleConnection *self, GError **error) { TpHandleRepoIface *contact_repo = tp_base_connection_get_handles ( - (TpBaseConnection *) self, TP_HANDLE_TYPE_CONTACT); + (TpBaseConnection *) self, TP_ENTITY_TYPE_CONTACT); WockyStanza *message; gboolean ret; TpHandle handle; @@ -2438,33 +2393,6 @@ gabble_connection_send_capabilities (GabbleConnection *self, return ret; } -gboolean -gabble_connection_request_decloak (GabbleConnection *self, - const gchar *to, - const gchar *reason, - GError **error) -{ - GabblePresence *presence = self->self_presence; - WockyStanza *message = gabble_presence_as_message (presence, to); - WockyNode *decloak; - gboolean ret; - - gabble_connection_fill_in_caps (self, message); - - decloak = wocky_node_add_child_ns (wocky_stanza_get_top_node (message), - "temppres", NS_TEMPPRES); - - if (reason != NULL && *reason != '\0') - { - wocky_node_set_attribute (decloak, "reason", reason); - } - - ret = _gabble_connection_send (self, message, error); - g_object_unref (message); - - return ret; -} - static gboolean gabble_connection_refresh_capabilities (GabbleConnection *self, GabbleCapabilitySet **old_out) @@ -2773,19 +2701,10 @@ set_status_to_connected (GabbleConnection *conn) return; } - if (conn->features & GABBLE_CONNECTION_FEATURES_PEP) - { - const gchar *ifaces[] = { GABBLE_IFACE_OLPC_BUDDY_INFO, - GABBLE_IFACE_OLPC_ACTIVITY_PROPERTIES, - NULL }; - - tp_base_connection_add_interfaces ((TpBaseConnection *) conn, ifaces); - } - if (conn->features & GABBLE_CONNECTION_FEATURES_GOOGLE_MAIL_NOTIFY) { const gchar *ifaces[] = - { TP_IFACE_CONNECTION_INTERFACE_MAIL_NOTIFICATION, NULL }; + { TP_IFACE_CONNECTION_INTERFACE_MAIL_NOTIFICATION1, NULL }; tp_base_connection_add_interfaces ((TpBaseConnection *) conn, ifaces); } @@ -2793,7 +2712,7 @@ set_status_to_connected (GabbleConnection *conn) if (tp_base_contact_list_can_block (gabble_connection_get_contact_list (conn))) { const gchar *ifaces[] = - { TP_IFACE_CONNECTION_INTERFACE_CONTACT_BLOCKING, NULL }; + { TP_IFACE_CONNECTION_INTERFACE_CONTACT_BLOCKING1, NULL }; tp_base_connection_add_interfaces ((TpBaseConnection *) conn, ifaces); } @@ -3010,7 +2929,7 @@ connection_disco_cb (GabbleDisco *disco, if ((conn->features & GABBLE_CONNECTION_FEATURES_WLM_JID_LOOKUP) != 0) { TpHandleRepoIface *contact_repo = tp_base_connection_get_handles (base, - TP_HANDLE_TYPE_CONTACT); + TP_ENTITY_TYPE_CONTACT); tp_dynamic_handle_repo_set_normalize_async ( (TpDynamicHandleRepo *) contact_repo, @@ -3127,7 +3046,7 @@ _emit_capabilities_changed (GabbleConnection *conn, (GDestroyNotify) gabble_free_rcc_list); g_hash_table_insert (hash, GUINT_TO_POINTER (handle), caps_arr); - tp_svc_connection_interface_contact_capabilities_emit_contact_capabilities_changed ( + tp_svc_connection_interface_contact_capabilities1_emit_contact_capabilities_changed ( conn, hash); g_hash_table_unref (hash); @@ -3293,11 +3212,11 @@ check_data_form_is_valid (GabbleConnection *self, * * Implements D-Bus method UpdateCapabilities * on interface - * org.freedesktop.Telepathy.Connection.Interface.ContactCapabilities + * Telepathy.Connection.Interface.ContactCapabilities */ static void gabble_connection_update_capabilities ( - TpSvcConnectionInterfaceContactCapabilities *iface, + TpSvcConnectionInterfaceContactCapabilities1 *iface, const GPtrArray *clients, DBusGMethodInvocation *context) { @@ -3417,79 +3336,68 @@ gabble_connection_update_capabilities ( gabble_capability_set_free (old_caps); } - tp_svc_connection_interface_contact_capabilities_return_from_update_capabilities ( + tp_svc_connection_interface_contact_capabilities1_return_from_update_capabilities ( context); } static void -conn_contact_capabilities_fill_contact_attributes (GObject *obj, - const GArray *contacts, GHashTable *attributes_hash) +gabble_connection_fill_contact_attributes (TpBaseConnection *base, + const gchar *dbus_interface, + TpHandle handle, + TpContactAttributeMap *attributes) { - GabbleConnection *self = GABBLE_CONNECTION (obj); - guint i; + GabbleConnection *self = GABBLE_CONNECTION (base); - for (i = 0; i < contacts->len; i++) + if (!tp_strdiff (dbus_interface, + TP_IFACE_CONNECTION_INTERFACE_CONTACT_CAPABILITIES1)) { - TpHandle handle = g_array_index (contacts, TpHandle, i); GValue *val = tp_g_value_slice_new_take_boxed ( TP_ARRAY_TYPE_REQUESTABLE_CHANNEL_CLASS_LIST, gabble_connection_get_handle_contact_capabilities (self, handle)); - tp_contacts_mixin_set_contact_attribute (attributes_hash, + tp_contact_attribute_map_take_sliced_gvalue (attributes, handle, - TP_IFACE_CONNECTION_INTERFACE_CONTACT_CAPABILITIES"/capabilities", + TP_TOKEN_CONNECTION_INTERFACE_CONTACT_CAPABILITIES1_CAPABILITIES, val); + return; } -} -/** - * gabble_connection_get_contact_capabilities - * - * Implements D-Bus method GetContactCapabilities - * on interface - * org.freedesktop.Telepathy.Connection.Interface.ContactCapabilities - */ -static void -gabble_connection_get_contact_capabilities ( - TpSvcConnectionInterfaceContactCapabilities *iface, - const GArray *handles, - DBusGMethodInvocation *context) -{ - GabbleConnection *self = GABBLE_CONNECTION (iface); - TpBaseConnection *base = (TpBaseConnection *) self; - TpHandleRepoIface *contact_handles = tp_base_connection_get_handles (base, - TP_HANDLE_TYPE_CONTACT); - guint i; - GHashTable *ret; - GError *error = NULL; + if (tp_base_contact_list_fill_contact_attributes ( + gabble_connection_get_contact_list (self), dbus_interface, handle, + attributes)) + return; - TP_BASE_CONNECTION_ERROR_IF_NOT_CONNECTED (base, context); + if (tp_presence_mixin_fill_contact_attributes ((GObject *) self, + dbus_interface, handle, attributes)) + return; - if (!tp_handles_are_valid (contact_handles, handles, FALSE, &error)) - { - dbus_g_method_return_error (context, error); - g_error_free (error); - return; - } + if (conn_addressing_fill_contact_attributes (self, + dbus_interface, handle, attributes)) + return; - ret = g_hash_table_new_full (NULL, NULL, NULL, - (GDestroyNotify) gabble_free_rcc_list); + if (conn_aliasing_fill_contact_attributes (self, + dbus_interface, handle, attributes)) + return; - for (i = 0; i < handles->len; i++) - { - TpHandle handle = g_array_index (handles, TpHandle, i); - GPtrArray *arr; + if (conn_avatars_fill_contact_attributes (self, + dbus_interface, handle, attributes)) + return; - arr = gabble_connection_get_handle_contact_capabilities (self, handle); - g_hash_table_insert (ret, GUINT_TO_POINTER (handle), arr); - } + if (conn_client_types_fill_contact_attributes (self, + dbus_interface, handle, attributes)) + return; - tp_svc_connection_interface_contact_capabilities_return_from_get_contact_capabilities - (context, ret); + if (conn_contact_info_fill_contact_attributes (self, + dbus_interface, handle, attributes)) + return; - g_hash_table_unref (ret); -} + if (conn_location_fill_contact_attributes (self, + dbus_interface, handle, attributes)) + return; + TP_BASE_CONNECTION_CLASS (gabble_connection_parent_class)-> + fill_contact_attributes (base, dbus_interface, handle, attributes); +} const char * _gabble_connection_find_conference_server (GabbleConnection *conn) @@ -3575,12 +3483,11 @@ gabble_connection_send_presence (GabbleConnection *conn, static void gabble_conn_contact_caps_iface_init (gpointer g_iface, gpointer iface_data) { - TpSvcConnectionInterfaceContactCapabilitiesClass *klass = g_iface; + TpSvcConnectionInterfaceContactCapabilities1Class *klass = g_iface; #define IMPLEMENT(x) \ - tp_svc_connection_interface_contact_capabilities_implement_##x (\ + tp_svc_connection_interface_contact_capabilities1_implement_##x (\ klass, gabble_connection_##x) - IMPLEMENT(get_contact_capabilities); IMPLEMENT(update_capabilities); #undef IMPLEMENT } @@ -3700,7 +3607,7 @@ gabble_connection_get_jid_for_caps (GabblePluginConnection *plugin_conn, } contact_handles = tp_base_connection_get_handles (base, - TP_HANDLE_TYPE_CONTACT); + TP_ENTITY_TYPE_CONTACT); return tp_handle_inspect (contact_handles, handle); } @@ -3723,7 +3630,7 @@ gabble_connection_pick_best_resource_for_caps ( base = (TpBaseConnection *) connection; contact_handles = tp_base_connection_get_handles (base, - TP_HANDLE_TYPE_CONTACT); + TP_ENTITY_TYPE_CONTACT); handle = tp_handle_ensure (contact_handles, jid, NULL, NULL); diff --git a/src/connection.h b/src/connection.h index 842f9e58f..1c68cb0dd 100644 --- a/src/connection.h +++ b/src/connection.h @@ -168,13 +168,11 @@ struct _GabbleConnectionClass { TpBaseConnectionClass parent_class; TpDBusPropertiesMixinClass properties_class; TpPresenceMixinClass presence_class; - TpContactsMixinClass contacts_class; }; struct _GabbleConnection { TpBaseConnection parent; TpPresenceMixin presence; - TpContactsMixin contacts; /* DBus daemon instance */ TpDBusDaemon *daemon; @@ -204,12 +202,6 @@ struct _GabbleConnection { /* vCard lookup helper */ GabbleVCardManager *vcard_manager; - /* OLPC hash tables */ - GHashTable *olpc_activities_info; - GHashTable *olpc_pep_activities; - GHashTable *olpc_invited_activities; - GHashTable *olpc_current_act; - /* bytestream factory */ GabbleBytestreamFactory *bytestream_factory; @@ -231,10 +223,6 @@ struct _GabbleConnection { /* PEP */ WockyPepService *pep_nick; WockyPepService *pep_location; - WockyPepService *pep_olpc_buddy_props; - WockyPepService *pep_olpc_activities; - WockyPepService *pep_olpc_current_act; - WockyPepService *pep_olpc_act_props; /* Sidecars */ /* gchar *interface → GabbleSidecar */ @@ -295,9 +283,6 @@ gboolean gabble_connection_send_presence (GabbleConnection *conn, gboolean gabble_connection_send_capabilities (GabbleConnection *self, const gchar *recipient, GError **error); -gboolean gabble_connection_request_decloak (GabbleConnection *self, - const gchar *to, const gchar *reason, GError **error); - void gabble_connection_fill_in_caps (GabbleConnection *self, WockyStanza *presence_message); @@ -311,7 +296,7 @@ const gchar **gabble_connection_get_guaranteed_interfaces (void); /* extern only for the benefit of the unit tests */ void _gabble_connection_create_handle_repos (TpBaseConnection *conn, - TpHandleRepoIface *repos[TP_NUM_HANDLE_TYPES]); + TpHandleRepoIface *repos[TP_NUM_ENTITY_TYPES]); /* For unit tests only */ void gabble_connection_set_disco_reply_timeout (guint timeout); diff --git a/src/debug.c b/src/debug.c index 8e3dd0c50..c656400f8 100644 --- a/src/debug.c +++ b/src/debug.c @@ -36,7 +36,6 @@ static GDebugKey keys[] = { { "vcard", GABBLE_DEBUG_VCARD }, { "pipeline", GABBLE_DEBUG_PIPELINE }, { "jid", GABBLE_DEBUG_JID }, - { "olpc", GABBLE_DEBUG_OLPC }, { "bytestream", GABBLE_DEBUG_BYTESTREAM }, { "tubes", GABBLE_DEBUG_TUBES }, { "location", GABBLE_DEBUG_LOCATION }, diff --git a/src/ft-channel.c b/src/ft-channel.c index cf7359b7e..9afee0074 100644 --- a/src/ft-channel.c +++ b/src/ft-channel.c @@ -63,9 +63,9 @@ static gboolean set_gtalk_file_collection (GabbleFileTransferChannel *self, G_DEFINE_TYPE_WITH_CODE (GabbleFileTransferChannel, gabble_file_transfer_channel, TP_TYPE_BASE_CHANNEL, - G_IMPLEMENT_INTERFACE (TP_TYPE_SVC_CHANNEL_TYPE_FILE_TRANSFER, + G_IMPLEMENT_INTERFACE (TP_TYPE_SVC_CHANNEL_TYPE_FILE_TRANSFER1, file_transfer_iface_init); - G_IMPLEMENT_INTERFACE (TP_TYPE_SVC_CHANNEL_INTERFACE_FILE_TRANSFER_METADATA, + G_IMPLEMENT_INTERFACE (TP_TYPE_SVC_CHANNEL_INTERFACE_FILE_TRANSFER_METADATA1, NULL); ); @@ -141,7 +141,7 @@ struct _GabbleFileTransferChannelPrivate { }; static void gabble_file_transfer_channel_set_state ( - TpSvcChannelTypeFileTransfer *iface, TpFileTransferState state, + TpSvcChannelTypeFileTransfer1 *iface, TpFileTransferState state, TpFileTransferStateChangeReason reason); static void close_session_and_transport (GabbleFileTransferChannel *self); @@ -154,7 +154,7 @@ gabble_file_transfer_channel_close (TpBaseChannel *base) self->priv->state != TP_FILE_TRANSFER_STATE_CANCELLED) { gabble_file_transfer_channel_set_state ( - TP_SVC_CHANNEL_TYPE_FILE_TRANSFER (self), + TP_SVC_CHANNEL_TYPE_FILE_TRANSFER1 (self), TP_FILE_TRANSFER_STATE_CANCELLED, TP_FILE_TRANSFER_STATE_CHANGE_REASON_LOCAL_STOPPED); @@ -268,7 +268,7 @@ gabble_file_transfer_channel_set_property (GObject *object, { case PROP_STATE: gabble_file_transfer_channel_set_state ( - TP_SVC_CHANNEL_TYPE_FILE_TRANSFER (object), + TP_SVC_CHANNEL_TYPE_FILE_TRANSFER1 (object), g_value_get_uint (value), TP_FILE_TRANSFER_STATE_CHANGE_REASON_NONE); break; @@ -370,7 +370,7 @@ connection_presences_updated_cb (GabblePresenceCache *cache, DEBUG ("peer disconnected. FileTransfer is cancelled"); gabble_file_transfer_channel_set_state ( - TP_SVC_CHANNEL_TYPE_FILE_TRANSFER (self), + TP_SVC_CHANNEL_TYPE_FILE_TRANSFER1 (self), TP_FILE_TRANSFER_STATE_CANCELLED, TP_FILE_TRANSFER_STATE_CHANGE_REASON_REMOTE_STOPPED); } @@ -387,7 +387,7 @@ gabble_file_transfer_channel_constructed (GObject *obj) TpBaseConnection *base_conn = tp_base_channel_get_connection (base); GabbleConnection *conn = GABBLE_CONNECTION (base_conn); TpHandleRepoIface *contact_repo = tp_base_connection_get_handles ( - base_conn, TP_HANDLE_TYPE_CONTACT); + base_conn, TP_ENTITY_TYPE_CONTACT); GArray *socket_access; TpSocketAccessControl access_control; @@ -458,7 +458,7 @@ file_transfer_channel_properties_setter (GObject *object, GabbleFileTransferChannel *self = (GabbleFileTransferChannel *) object; TpBaseChannel *base = TP_BASE_CHANNEL (self); - g_return_val_if_fail (interface == TP_IFACE_QUARK_CHANNEL_TYPE_FILE_TRANSFER, + g_return_val_if_fail (interface == TP_IFACE_QUARK_CHANNEL_TYPE_FILE_TRANSFER1, FALSE); /* There is only one property with write access. So TpDBusPropertiesMixin @@ -491,7 +491,7 @@ file_transfer_channel_properties_setter (GObject *object, self->priv->uri = g_value_dup_string (value); - tp_svc_channel_type_file_transfer_emit_uri_defined (self, self->priv->uri); + tp_svc_channel_type_file_transfer1_emit_uri_defined (self, self->priv->uri); return TRUE; } @@ -507,27 +507,27 @@ gabble_file_transfer_channel_fill_immutable_properties (TpBaseChannel *chan, tp_dbus_properties_mixin_fill_properties_hash ( G_OBJECT (chan), properties, - TP_IFACE_CHANNEL_TYPE_FILE_TRANSFER, "State", - TP_IFACE_CHANNEL_TYPE_FILE_TRANSFER, "ContentType", - TP_IFACE_CHANNEL_TYPE_FILE_TRANSFER, "Filename", - TP_IFACE_CHANNEL_TYPE_FILE_TRANSFER, "Size", - TP_IFACE_CHANNEL_TYPE_FILE_TRANSFER, "ContentHashType", - TP_IFACE_CHANNEL_TYPE_FILE_TRANSFER, "ContentHash", - TP_IFACE_CHANNEL_TYPE_FILE_TRANSFER, "Description", - TP_IFACE_CHANNEL_TYPE_FILE_TRANSFER, "Date", - TP_IFACE_CHANNEL_TYPE_FILE_TRANSFER, "AvailableSocketTypes", - TP_IFACE_CHANNEL_TYPE_FILE_TRANSFER, "TransferredBytes", - TP_IFACE_CHANNEL_TYPE_FILE_TRANSFER, "InitialOffset", - TP_IFACE_CHANNEL_TYPE_FILE_TRANSFER, "FileCollection", - TP_IFACE_CHANNEL_INTERFACE_FILE_TRANSFER_METADATA, "ServiceName", - TP_IFACE_CHANNEL_INTERFACE_FILE_TRANSFER_METADATA, "Metadata", + TP_IFACE_CHANNEL_TYPE_FILE_TRANSFER1, "State", + TP_IFACE_CHANNEL_TYPE_FILE_TRANSFER1, "ContentType", + TP_IFACE_CHANNEL_TYPE_FILE_TRANSFER1, "Filename", + TP_IFACE_CHANNEL_TYPE_FILE_TRANSFER1, "Size", + TP_IFACE_CHANNEL_TYPE_FILE_TRANSFER1, "ContentHashType", + TP_IFACE_CHANNEL_TYPE_FILE_TRANSFER1, "ContentHash", + TP_IFACE_CHANNEL_TYPE_FILE_TRANSFER1, "Description", + TP_IFACE_CHANNEL_TYPE_FILE_TRANSFER1, "Date", + TP_IFACE_CHANNEL_TYPE_FILE_TRANSFER1, "AvailableSocketTypes", + TP_IFACE_CHANNEL_TYPE_FILE_TRANSFER1, "TransferredBytes", + TP_IFACE_CHANNEL_TYPE_FILE_TRANSFER1, "InitialOffset", + TP_IFACE_CHANNEL_TYPE_FILE_TRANSFER1, "FileCollection", + TP_IFACE_CHANNEL_INTERFACE_FILE_TRANSFER_METADATA1, "ServiceName", + TP_IFACE_CHANNEL_INTERFACE_FILE_TRANSFER_METADATA1, "Metadata", NULL); /* URI is immutable only for outgoing transfers */ if (tp_base_channel_is_requested (chan)) { tp_dbus_properties_mixin_fill_properties_hash (G_OBJECT (chan), properties, - TP_IFACE_CHANNEL_TYPE_FILE_TRANSFER, "URI", NULL); + TP_IFACE_CHANNEL_TYPE_FILE_TRANSFER1, "URI", NULL); } } @@ -545,7 +545,7 @@ gabble_file_transfer_channel_get_interfaces (TpBaseChannel *base) interfaces = TP_BASE_CHANNEL_CLASS ( gabble_file_transfer_channel_parent_class)->get_interfaces (base); - g_ptr_array_add (interfaces, TP_IFACE_CHANNEL_INTERFACE_FILE_TRANSFER_METADATA); + g_ptr_array_add (interfaces, TP_IFACE_CHANNEL_INTERFACE_FILE_TRANSFER_METADATA1); return interfaces; } @@ -584,12 +584,12 @@ gabble_file_transfer_channel_class_init ( }; static TpDBusPropertiesMixinIfaceImpl prop_interfaces[] = { - { TP_IFACE_CHANNEL_TYPE_FILE_TRANSFER, + { TP_IFACE_CHANNEL_TYPE_FILE_TRANSFER1, tp_dbus_properties_mixin_getter_gobject_properties, file_transfer_channel_properties_setter, file_props }, - { TP_IFACE_CHANNEL_INTERFACE_FILE_TRANSFER_METADATA, + { TP_IFACE_CHANNEL_INTERFACE_FILE_TRANSFER_METADATA1, tp_dbus_properties_mixin_getter_gobject_properties, NULL, file_metadata_props @@ -606,8 +606,8 @@ gabble_file_transfer_channel_class_init ( object_class->get_property = gabble_file_transfer_channel_get_property; object_class->set_property = gabble_file_transfer_channel_set_property; - base_class->channel_type = TP_IFACE_CHANNEL_TYPE_FILE_TRANSFER; - base_class->target_handle_type = TP_HANDLE_TYPE_CONTACT; + base_class->channel_type = TP_IFACE_CHANNEL_TYPE_FILE_TRANSFER1; + base_class->target_entity_type = TP_ENTITY_TYPE_CONTACT; base_class->get_interfaces = gabble_file_transfer_channel_get_interfaces; base_class->close = gabble_file_transfer_channel_close; base_class->fill_immutable_properties = @@ -895,7 +895,7 @@ static gboolean setup_local_socket (GabbleFileTransferChannel *self, static void gabble_file_transfer_channel_set_state ( - TpSvcChannelTypeFileTransfer *iface, + TpSvcChannelTypeFileTransfer1 *iface, TpFileTransferState state, TpFileTransferStateChangeReason reason) { @@ -905,7 +905,7 @@ gabble_file_transfer_channel_set_state ( return; self->priv->state = state; - tp_svc_channel_type_file_transfer_emit_file_transfer_state_changed (iface, + tp_svc_channel_type_file_transfer1_emit_file_transfer_state_changed (iface, state, reason); } @@ -958,11 +958,11 @@ channel_open (GabbleFileTransferChannel *self) if (self->priv->socket_address != NULL) { /* ProvideFile has already been called. Channel is Open */ - tp_svc_channel_type_file_transfer_emit_initial_offset_defined (self, + tp_svc_channel_type_file_transfer1_emit_initial_offset_defined (self, self->priv->initial_offset); gabble_file_transfer_channel_set_state ( - TP_SVC_CHANNEL_TYPE_FILE_TRANSFER (self), + TP_SVC_CHANNEL_TYPE_FILE_TRANSFER1 (self), TP_FILE_TRANSFER_STATE_OPEN, TP_FILE_TRANSFER_STATE_CHANGE_REASON_NONE); @@ -973,7 +973,7 @@ channel_open (GabbleFileTransferChannel *self) { /* Client has to call ProvideFile to open the channel */ gabble_file_transfer_channel_set_state ( - TP_SVC_CHANNEL_TYPE_FILE_TRANSFER (self), + TP_SVC_CHANNEL_TYPE_FILE_TRANSFER1 (self), TP_FILE_TRANSFER_STATE_ACCEPTED, TP_FILE_TRANSFER_STATE_CHANGE_REASON_NONE); } @@ -990,7 +990,7 @@ bytestream_closed (GabbleFileTransferChannel *self) /* Something did wrong */ gabble_file_transfer_channel_set_state ( - TP_SVC_CHANNEL_TYPE_FILE_TRANSFER (self), + TP_SVC_CHANNEL_TYPE_FILE_TRANSFER1 (self), TP_FILE_TRANSFER_STATE_CANCELLED, receiver ? TP_FILE_TRANSFER_STATE_CHANGE_REASON_LOCAL_ERROR : @@ -1078,7 +1078,7 @@ bytestream_negotiate_cb (GabbleBytestreamIface *bytestream, { DEBUG ("receiver refused file offer"); gabble_file_transfer_channel_set_state ( - TP_SVC_CHANNEL_TYPE_FILE_TRANSFER (self), + TP_SVC_CHANNEL_TYPE_FILE_TRANSFER1 (self), TP_FILE_TRANSFER_STATE_CANCELLED, TP_FILE_TRANSFER_STATE_CHANGE_REASON_REMOTE_STOPPED); return; @@ -1267,7 +1267,7 @@ gabble_file_transfer_channel_gtalk_file_collection_state_changed ( { case GTALK_FILE_COLLECTION_STATE_PENDING: gabble_file_transfer_channel_set_state ( - TP_SVC_CHANNEL_TYPE_FILE_TRANSFER (self), + TP_SVC_CHANNEL_TYPE_FILE_TRANSFER1 (self), TP_FILE_TRANSFER_STATE_PENDING, TP_FILE_TRANSFER_STATE_CHANGE_REASON_NONE); break; @@ -1275,7 +1275,7 @@ gabble_file_transfer_channel_gtalk_file_collection_state_changed ( if (self->priv->state == TP_FILE_TRANSFER_STATE_PENDING) { gabble_file_transfer_channel_set_state ( - TP_SVC_CHANNEL_TYPE_FILE_TRANSFER (self), + TP_SVC_CHANNEL_TYPE_FILE_TRANSFER1 (self), TP_FILE_TRANSFER_STATE_ACCEPTED, TP_FILE_TRANSFER_STATE_CHANGE_REASON_NONE); } @@ -1288,7 +1288,7 @@ gabble_file_transfer_channel_gtalk_file_collection_state_changed ( self->priv->state != TP_FILE_TRANSFER_STATE_CANCELLED) { gabble_file_transfer_channel_set_state ( - TP_SVC_CHANNEL_TYPE_FILE_TRANSFER (self), + TP_SVC_CHANNEL_TYPE_FILE_TRANSFER1 (self), TP_FILE_TRANSFER_STATE_CANCELLED, local_terminator ? TP_FILE_TRANSFER_STATE_CHANGE_REASON_LOCAL_STOPPED: @@ -1299,7 +1299,7 @@ gabble_file_transfer_channel_gtalk_file_collection_state_changed ( case GTALK_FILE_COLLECTION_STATE_ERROR: case GTALK_FILE_COLLECTION_STATE_CONNECTION_FAILED: gabble_file_transfer_channel_set_state ( - TP_SVC_CHANNEL_TYPE_FILE_TRANSFER (self), + TP_SVC_CHANNEL_TYPE_FILE_TRANSFER1 (self), TP_FILE_TRANSFER_STATE_CANCELLED, TP_FILE_TRANSFER_STATE_CHANGE_REASON_LOCAL_ERROR); @@ -1307,7 +1307,7 @@ gabble_file_transfer_channel_gtalk_file_collection_state_changed ( break; case GTALK_FILE_COLLECTION_STATE_COMPLETED: gabble_file_transfer_channel_set_state ( - TP_SVC_CHANNEL_TYPE_FILE_TRANSFER (self), + TP_SVC_CHANNEL_TYPE_FILE_TRANSFER1 (self), TP_FILE_TRANSFER_STATE_COMPLETED, TP_FILE_TRANSFER_STATE_CHANGE_REASON_NONE); @@ -1408,9 +1408,9 @@ gabble_file_transfer_channel_offer_file (GabbleFileTransferChannel *self, } contact_repo = tp_base_connection_get_handles (base_conn, - TP_HANDLE_TYPE_CONTACT); + TP_ENTITY_TYPE_CONTACT); room_repo = tp_base_connection_get_handles (base_conn, - TP_HANDLE_TYPE_ROOM); + TP_ENTITY_TYPE_ROOM); jid = tp_handle_inspect (contact_repo, tp_base_channel_get_target_handle (base)); @@ -1478,12 +1478,12 @@ gabble_file_transfer_channel_offer_file (GabbleFileTransferChannel *self, static void emit_progress_update (GabbleFileTransferChannel *self) { - TpSvcChannelTypeFileTransfer *iface = - TP_SVC_CHANNEL_TYPE_FILE_TRANSFER (self); + TpSvcChannelTypeFileTransfer1 *iface = + TP_SVC_CHANNEL_TYPE_FILE_TRANSFER1 (self); g_get_current_time (&self->priv->last_transferred_bytes_emitted); - tp_svc_channel_type_file_transfer_emit_transferred_bytes_changed ( + tp_svc_channel_type_file_transfer1_emit_transferred_bytes_changed ( iface, self->priv->transferred_bytes); if (self->priv->progress_timer != 0) @@ -1572,7 +1572,7 @@ data_received_cb (GabbleFileTransferChannel *self, const guint8 *data, guint len g_error_free (error); gabble_file_transfer_channel_set_state ( - TP_SVC_CHANNEL_TYPE_FILE_TRANSFER (self), + TP_SVC_CHANNEL_TYPE_FILE_TRANSFER1 (self), TP_FILE_TRANSFER_STATE_CANCELLED, TP_FILE_TRANSFER_STATE_CHANGE_REASON_LOCAL_ERROR); return; @@ -1586,7 +1586,7 @@ data_received_cb (GabbleFileTransferChannel *self, const guint8 *data, guint len { DEBUG ("Received all the file. Transfer is complete"); gabble_file_transfer_channel_set_state ( - TP_SVC_CHANNEL_TYPE_FILE_TRANSFER (self), + TP_SVC_CHANNEL_TYPE_FILE_TRANSFER1 (self), TP_FILE_TRANSFER_STATE_COMPLETED, TP_FILE_TRANSFER_STATE_CHANGE_REASON_NONE); @@ -1658,10 +1658,10 @@ augment_si_reply (WockyNode *si, * gabble_file_transfer_channel_accept_file * * Implements D-Bus method AcceptFile - * on interface org.freedesktop.Telepathy.Channel.Type.FileTransfer + * on interface Channel.Type.FileTransfer */ static void -gabble_file_transfer_channel_accept_file (TpSvcChannelTypeFileTransfer *iface, +gabble_file_transfer_channel_accept_file (TpSvcChannelTypeFileTransfer1 *iface, guint address_type, guint access_control, const GValue *access_control_param, @@ -1713,7 +1713,7 @@ gabble_file_transfer_channel_accept_file (TpSvcChannelTypeFileTransfer *iface, TP_FILE_TRANSFER_STATE_ACCEPTED, TP_FILE_TRANSFER_STATE_CHANGE_REASON_REQUESTED); - tp_svc_channel_type_file_transfer_return_from_accept_file (context, + tp_svc_channel_type_file_transfer1_return_from_accept_file (context, self->priv->socket_address); if (self->priv->resume_supported) @@ -1759,11 +1759,11 @@ gabble_file_transfer_channel_accept_file (TpSvcChannelTypeFileTransfer *iface, * gabble_file_transfer_channel_provide_file * * Implements D-Bus method ProvideFile - * on interface org.freedesktop.Telepathy.Channel.Type.FileTransfer + * on interface Channel.Type.FileTransfer */ static void gabble_file_transfer_channel_provide_file ( - TpSvcChannelTypeFileTransfer *iface, + TpSvcChannelTypeFileTransfer1 *iface, guint address_type, guint access_control, const GValue *access_control_param, @@ -1823,7 +1823,7 @@ gabble_file_transfer_channel_provide_file ( { /* Remote already accepted the file. Channel is Open. * If not channel stay Pending. */ - tp_svc_channel_type_file_transfer_emit_initial_offset_defined (self, + tp_svc_channel_type_file_transfer1_emit_initial_offset_defined (self, self->priv->initial_offset); gabble_file_transfer_channel_set_state (iface, @@ -1831,7 +1831,7 @@ gabble_file_transfer_channel_provide_file ( TP_FILE_TRANSFER_STATE_CHANGE_REASON_REQUESTED); } - tp_svc_channel_type_file_transfer_return_from_provide_file (context, + tp_svc_channel_type_file_transfer1_return_from_provide_file (context, self->priv->socket_address); } @@ -1839,10 +1839,10 @@ static void file_transfer_iface_init (gpointer g_iface, gpointer iface_data) { - TpSvcChannelTypeFileTransferClass *klass = - (TpSvcChannelTypeFileTransferClass *) g_iface; + TpSvcChannelTypeFileTransfer1Class *klass = + (TpSvcChannelTypeFileTransfer1Class *) g_iface; -#define IMPLEMENT(x) tp_svc_channel_type_file_transfer_implement_##x (\ +#define IMPLEMENT(x) tp_svc_channel_type_file_transfer1_implement_##x (\ klass, gabble_file_transfer_channel_##x) IMPLEMENT (accept_file); IMPLEMENT (provide_file); @@ -1922,7 +1922,7 @@ transport_handler (GibberTransport *transport, { DEBUG ("All the file has been sent. Closing the bytestream"); gabble_file_transfer_channel_set_state ( - TP_SVC_CHANNEL_TYPE_FILE_TRANSFER (self), + TP_SVC_CHANNEL_TYPE_FILE_TRANSFER1 (self), TP_FILE_TRANSFER_STATE_COMPLETED, TP_FILE_TRANSFER_STATE_CHANGE_REASON_NONE); gabble_bytestream_iface_close (self->priv->bytestream, NULL); @@ -2006,7 +2006,7 @@ transport_disconnected_cb (GibberTransport *transport, { gabble_file_transfer_channel_set_state ( - TP_SVC_CHANNEL_TYPE_FILE_TRANSFER (self), + TP_SVC_CHANNEL_TYPE_FILE_TRANSFER1 (self), TP_FILE_TRANSFER_STATE_CANCELLED, TP_FILE_TRANSFER_STATE_CHANGE_REASON_LOCAL_ERROR); diff --git a/src/ft-manager.c b/src/ft-manager.c index cca26d4cb..3a366f0eb 100644 --- a/src/ft-manager.c +++ b/src/ft-manager.c @@ -302,7 +302,7 @@ gabble_ft_manager_channels_created (GabbleFtManager *self, GList *channels) self->priv->channels = g_list_append (self->priv->channels, chan); /* The channels can't satisfy a request because this will always be called when we receive an incoming jingle-share session */ - tp_channel_manager_emit_new_channel (self, + tp_channel_manager_emit_new_channel (TP_CHANNEL_MANAGER (self), TP_EXPORTABLE_CHANNEL (chan), NULL); } } @@ -325,8 +325,8 @@ gabble_ft_manager_channel_created (GabbleFtManager *self, if (request_token != NULL) requests = g_slist_prepend (requests, request_token); - tp_channel_manager_emit_new_channel (self, TP_EXPORTABLE_CHANNEL (chan), - requests); + tp_channel_manager_emit_new_channel (TP_CHANNEL_MANAGER (self), + TP_EXPORTABLE_CHANNEL (chan), requests); g_slist_free (requests); } @@ -379,7 +379,7 @@ new_jingle_session_cb (GabbleJingleMint *jm, gchar *filename = NULL; TpHandleRepoIface *contacts = tp_base_connection_get_handles ( TP_BASE_CONNECTION (self->priv->connection), - TP_HANDLE_TYPE_CONTACT); + TP_ENTITY_TYPE_CONTACT); TpHandle peer = tp_handle_ensure (contacts, wocky_jingle_session_get_peer_jid (sess), NULL, NULL); @@ -440,14 +440,14 @@ connection_status_changed_cb (GabbleConnection *conn, static gboolean gabble_ft_manager_handle_request (TpChannelManager *manager, - gpointer request_token, - GHashTable *request_properties) + TpChannelManagerRequest *request, + GHashTable *request_properties) { GabbleFtManager *self = GABBLE_FT_MANAGER (manager); GabbleFileTransferChannel *chan; TpBaseConnection *base_conn = TP_BASE_CONNECTION (self->priv->connection); TpHandleRepoIface *contact_repo = - tp_base_connection_get_handles (base_conn, TP_HANDLE_TYPE_CONTACT); + tp_base_connection_get_handles (base_conn, TP_ENTITY_TYPE_CONTACT); TpHandle handle; const gchar *content_type, *filename, *content_hash, *description; const gchar *file_uri, *service_name; @@ -462,12 +462,12 @@ gabble_ft_manager_handle_request (TpChannelManager *manager, /* We only support file transfer channels */ if (tp_strdiff (tp_asv_get_string (request_properties, TP_IFACE_CHANNEL ".ChannelType"), - TP_IFACE_CHANNEL_TYPE_FILE_TRANSFER)) + TP_IFACE_CHANNEL_TYPE_FILE_TRANSFER1)) return FALSE; /* And only contact handles */ if (tp_asv_get_uint32 (request_properties, - TP_IFACE_CHANNEL ".TargetHandleType", NULL) != TP_HANDLE_TYPE_CONTACT) + TP_IFACE_CHANNEL ".TargetEntityType", NULL) != TP_ENTITY_TYPE_CONTACT) return FALSE; handle = tp_asv_get_uint32 (request_properties, @@ -486,7 +486,7 @@ gabble_ft_manager_handle_request (TpChannelManager *manager, } content_type = tp_asv_get_string (request_properties, - TP_IFACE_CHANNEL_TYPE_FILE_TRANSFER ".ContentType"); + TP_IFACE_CHANNEL_TYPE_FILE_TRANSFER1 ".ContentType"); if (content_type == NULL) { g_set_error (&error, TP_ERROR, TP_ERROR_INVALID_ARGUMENT, @@ -495,7 +495,7 @@ gabble_ft_manager_handle_request (TpChannelManager *manager, } filename = tp_asv_get_string (request_properties, - TP_IFACE_CHANNEL_TYPE_FILE_TRANSFER ".Filename"); + TP_IFACE_CHANNEL_TYPE_FILE_TRANSFER1 ".Filename"); if (filename == NULL) { g_set_error (&error, TP_ERROR, TP_ERROR_INVALID_ARGUMENT, @@ -504,7 +504,7 @@ gabble_ft_manager_handle_request (TpChannelManager *manager, } size = tp_asv_get_uint64 (request_properties, - TP_IFACE_CHANNEL_TYPE_FILE_TRANSFER ".Size", NULL); + TP_IFACE_CHANNEL_TYPE_FILE_TRANSFER1 ".Size", NULL); if (size == 0) { g_set_error (&error, TP_ERROR, TP_ERROR_INVALID_ARGUMENT, @@ -513,7 +513,7 @@ gabble_ft_manager_handle_request (TpChannelManager *manager, } content_hash_type = tp_asv_get_uint32 (request_properties, - TP_IFACE_CHANNEL_TYPE_FILE_TRANSFER ".ContentHashType", &valid); + TP_IFACE_CHANNEL_TYPE_FILE_TRANSFER1 ".ContentHashType", &valid); if (!valid) { /* Assume File_Hash_Type_None */ @@ -532,7 +532,7 @@ gabble_ft_manager_handle_request (TpChannelManager *manager, if (content_hash_type != TP_FILE_HASH_TYPE_NONE) { content_hash = tp_asv_get_string (request_properties, - TP_IFACE_CHANNEL_TYPE_FILE_TRANSFER ".ContentHash"); + TP_IFACE_CHANNEL_TYPE_FILE_TRANSFER1 ".ContentHash"); if (content_hash == NULL) { g_set_error (&error, TP_ERROR, TP_ERROR_INVALID_ARGUMENT, @@ -547,22 +547,22 @@ gabble_ft_manager_handle_request (TpChannelManager *manager, } description = tp_asv_get_string (request_properties, - TP_IFACE_CHANNEL_TYPE_FILE_TRANSFER ".Description"); + TP_IFACE_CHANNEL_TYPE_FILE_TRANSFER1 ".Description"); date = tp_asv_get_uint64 (request_properties, - TP_IFACE_CHANNEL_TYPE_FILE_TRANSFER ".Date", NULL); + TP_IFACE_CHANNEL_TYPE_FILE_TRANSFER1 ".Date", NULL); initial_offset = tp_asv_get_uint64 (request_properties, - TP_IFACE_CHANNEL_TYPE_FILE_TRANSFER ".InitialOffset", NULL); + TP_IFACE_CHANNEL_TYPE_FILE_TRANSFER1 ".InitialOffset", NULL); file_uri = tp_asv_get_string (request_properties, - TP_PROP_CHANNEL_TYPE_FILE_TRANSFER_URI); + TP_PROP_CHANNEL_TYPE_FILE_TRANSFER1_URI); service_name = tp_asv_get_string (request_properties, - TP_PROP_CHANNEL_INTERFACE_FILE_TRANSFER_METADATA_SERVICE_NAME); + TP_PROP_CHANNEL_INTERFACE_FILE_TRANSFER_METADATA1_SERVICE_NAME); metadata = tp_asv_get_boxed (request_properties, - TP_PROP_CHANNEL_INTERFACE_FILE_TRANSFER_METADATA_METADATA, + TP_PROP_CHANNEL_INTERFACE_FILE_TRANSFER_METADATA1_METADATA, TP_HASH_TYPE_METADATA); if (metadata != NULL && g_hash_table_lookup ((GHashTable *) metadata, "FORM_TYPE")) @@ -588,13 +588,13 @@ gabble_ft_manager_handle_request (TpChannelManager *manager, goto error; } - gabble_ft_manager_channel_created (self, chan, request_token); + gabble_ft_manager_channel_created (self, chan, request); return TRUE; error: - tp_channel_manager_emit_request_failed (self, request_token, - error->domain, error->code, error->message); + tp_channel_manager_emit_request_failed (TP_CHANNEL_MANAGER (self), + request, error->domain, error->code, error->message); g_error_free (error); return TRUE; } @@ -603,22 +603,22 @@ error: */ static const gchar * const file_transfer_channel_fixed_properties[] = { TP_IFACE_CHANNEL ".ChannelType", - TP_IFACE_CHANNEL ".TargetHandleType", + TP_IFACE_CHANNEL ".TargetEntityType", NULL }; /* ContentHashType has to be first so we can easily skip it when needed */ #define STANDARD_PROPERTIES \ - TP_PROP_CHANNEL_TYPE_FILE_TRANSFER_CONTENT_HASH_TYPE, \ + TP_PROP_CHANNEL_TYPE_FILE_TRANSFER1_CONTENT_HASH_TYPE, \ TP_PROP_CHANNEL_TARGET_HANDLE, \ TP_PROP_CHANNEL_TARGET_ID, \ - TP_PROP_CHANNEL_TYPE_FILE_TRANSFER_CONTENT_TYPE, \ - TP_PROP_CHANNEL_TYPE_FILE_TRANSFER_FILENAME, \ - TP_PROP_CHANNEL_TYPE_FILE_TRANSFER_SIZE, \ - TP_PROP_CHANNEL_TYPE_FILE_TRANSFER_CONTENT_HASH, \ - TP_PROP_CHANNEL_TYPE_FILE_TRANSFER_DESCRIPTION, \ - TP_PROP_CHANNEL_TYPE_FILE_TRANSFER_DATE, \ - TP_PROP_CHANNEL_TYPE_FILE_TRANSFER_URI + TP_PROP_CHANNEL_TYPE_FILE_TRANSFER1_CONTENT_TYPE, \ + TP_PROP_CHANNEL_TYPE_FILE_TRANSFER1_FILENAME, \ + TP_PROP_CHANNEL_TYPE_FILE_TRANSFER1_SIZE, \ + TP_PROP_CHANNEL_TYPE_FILE_TRANSFER1_CONTENT_HASH, \ + TP_PROP_CHANNEL_TYPE_FILE_TRANSFER1_DESCRIPTION, \ + TP_PROP_CHANNEL_TYPE_FILE_TRANSFER1_DATE, \ + TP_PROP_CHANNEL_TYPE_FILE_TRANSFER1_URI static const gchar * const file_transfer_channel_allowed_properties[] = { @@ -629,15 +629,15 @@ static const gchar * const file_transfer_channel_allowed_properties[] = static const gchar * const file_transfer_channel_allowed_properties_with_metadata_prop[] = { STANDARD_PROPERTIES, - TP_PROP_CHANNEL_INTERFACE_FILE_TRANSFER_METADATA_METADATA, + TP_PROP_CHANNEL_INTERFACE_FILE_TRANSFER_METADATA1_METADATA, NULL }; static const gchar * const file_transfer_channel_allowed_properties_with_both_metadata_props[] = { STANDARD_PROPERTIES, - TP_PROP_CHANNEL_INTERFACE_FILE_TRANSFER_METADATA_SERVICE_NAME, - TP_PROP_CHANNEL_INTERFACE_FILE_TRANSFER_METADATA_METADATA, + TP_PROP_CHANNEL_INTERFACE_FILE_TRANSFER_METADATA1_SERVICE_NAME, + TP_PROP_CHANNEL_INTERFACE_FILE_TRANSFER_METADATA1_METADATA, NULL }; @@ -653,17 +653,17 @@ gabble_ft_manager_type_foreach_channel_class (GType type, NULL, (GDestroyNotify) tp_g_value_slice_free); g_hash_table_insert (table, TP_IFACE_CHANNEL ".ChannelType" , - tp_g_value_slice_new_string (TP_IFACE_CHANNEL_TYPE_FILE_TRANSFER)); + tp_g_value_slice_new_string (TP_IFACE_CHANNEL_TYPE_FILE_TRANSFER1)); - g_hash_table_insert (table, TP_IFACE_CHANNEL ".TargetHandleType", - tp_g_value_slice_new_uint (TP_HANDLE_TYPE_CONTACT)); + g_hash_table_insert (table, TP_IFACE_CHANNEL ".TargetEntityType", + tp_g_value_slice_new_uint (TP_ENTITY_TYPE_CONTACT)); func (type, table, file_transfer_channel_allowed_properties_with_both_metadata_props, user_data); /* MD5 HashType class */ g_hash_table_insert (table, - TP_IFACE_CHANNEL_TYPE_FILE_TRANSFER ".ContentHashType", + TP_IFACE_CHANNEL_TYPE_FILE_TRANSFER1 ".ContentHashType", tp_g_value_slice_new_uint (TP_FILE_HASH_TYPE_MD5)); /* skip ContentHashType in allowed properties */ @@ -936,7 +936,7 @@ add_file_transfer_channel_class (GPtrArray *arr, GValue monster = {0, }; GHashTable *fixed_properties; GValue *channel_type_value; - GValue *target_handle_type_value; + GValue *target_entity_type_value; GValue *service_name_value; const gchar * const *allowed_properties; @@ -949,19 +949,19 @@ add_file_transfer_channel_class (GPtrArray *arr, (GDestroyNotify) tp_g_value_slice_free); channel_type_value = tp_g_value_slice_new_static_string ( - TP_IFACE_CHANNEL_TYPE_FILE_TRANSFER); + TP_IFACE_CHANNEL_TYPE_FILE_TRANSFER1); g_hash_table_insert (fixed_properties, TP_IFACE_CHANNEL ".ChannelType", channel_type_value); - target_handle_type_value = tp_g_value_slice_new_uint (TP_HANDLE_TYPE_CONTACT); - g_hash_table_insert (fixed_properties, TP_IFACE_CHANNEL ".TargetHandleType", - target_handle_type_value); + target_entity_type_value = tp_g_value_slice_new_uint (TP_ENTITY_TYPE_CONTACT); + g_hash_table_insert (fixed_properties, TP_IFACE_CHANNEL ".TargetEntityType", + target_entity_type_value); if (service_name_str != NULL) { service_name_value = tp_g_value_slice_new_string (service_name_str); g_hash_table_insert (fixed_properties, - TP_PROP_CHANNEL_INTERFACE_FILE_TRANSFER_METADATA_SERVICE_NAME, + TP_PROP_CHANNEL_INTERFACE_FILE_TRANSFER_METADATA1_SERVICE_NAME, service_name_value); } @@ -1037,12 +1037,12 @@ gabble_ft_manager_represent_client ( if (tp_strdiff (tp_asv_get_string (channel_class, TP_IFACE_CHANNEL ".ChannelType"), - TP_IFACE_CHANNEL_TYPE_FILE_TRANSFER)) + TP_IFACE_CHANNEL_TYPE_FILE_TRANSFER1)) continue; if (tp_asv_get_uint32 (channel_class, - TP_IFACE_CHANNEL ".TargetHandleType", NULL) - != TP_HANDLE_TYPE_CONTACT) + TP_IFACE_CHANNEL ".TargetEntityType", NULL) + != TP_ENTITY_TYPE_CONTACT) continue; DEBUG ("client %s supports file transfer", client_name); @@ -1060,7 +1060,7 @@ gabble_ft_manager_represent_client ( continue; service_name = tp_asv_get_string (channel_class, - TP_PROP_CHANNEL_INTERFACE_FILE_TRANSFER_METADATA_SERVICE_NAME); + TP_PROP_CHANNEL_INTERFACE_FILE_TRANSFER_METADATA1_SERVICE_NAME); if (service_name == NULL) continue; diff --git a/src/im-channel.c b/src/im-channel.c index 9cbdbfaab..a83dec95e 100644 --- a/src/im-channel.c +++ b/src/im-channel.c @@ -44,12 +44,10 @@ static void destroyable_iface_init (gpointer, gpointer); G_DEFINE_TYPE_WITH_CODE (GabbleIMChannel, gabble_im_channel, TP_TYPE_BASE_CHANNEL, G_IMPLEMENT_INTERFACE (TP_TYPE_SVC_CHANNEL_TYPE_TEXT, - tp_message_mixin_text_iface_init); - G_IMPLEMENT_INTERFACE (TP_TYPE_SVC_CHANNEL_INTERFACE_MESSAGES, - tp_message_mixin_messages_iface_init); - G_IMPLEMENT_INTERFACE (TP_TYPE_SVC_CHANNEL_INTERFACE_CHAT_STATE, + tp_message_mixin_iface_init); + G_IMPLEMENT_INTERFACE (TP_TYPE_SVC_CHANNEL_INTERFACE_CHAT_STATE1, tp_message_mixin_chat_state_iface_init) - G_IMPLEMENT_INTERFACE (TP_TYPE_SVC_CHANNEL_INTERFACE_DESTROYABLE, + G_IMPLEMENT_INTERFACE (TP_TYPE_SVC_CHANNEL_INTERFACE_DESTROYABLE1, destroyable_iface_init)); static void _gabble_im_channel_send_message (GObject *object, @@ -92,9 +90,8 @@ gabble_im_channel_get_interfaces (TpBaseChannel *base) interfaces = TP_BASE_CHANNEL_CLASS ( gabble_im_channel_parent_class)->get_interfaces (base); - g_ptr_array_add (interfaces, TP_IFACE_CHANNEL_INTERFACE_CHAT_STATE); - g_ptr_array_add (interfaces, TP_IFACE_CHANNEL_INTERFACE_MESSAGES); - g_ptr_array_add (interfaces, TP_IFACE_CHANNEL_INTERFACE_DESTROYABLE); + g_ptr_array_add (interfaces, TP_IFACE_CHANNEL_INTERFACE_CHAT_STATE1); + g_ptr_array_add (interfaces, TP_IFACE_CHANNEL_INTERFACE_DESTROYABLE1); return interfaces; } @@ -117,7 +114,7 @@ gabble_im_channel_constructed (GObject *obj) TpBaseConnection *base_conn = tp_base_channel_get_connection (base); GabbleConnection *conn = GABBLE_CONNECTION (base_conn); TpHandleRepoIface *contact_handles = - tp_base_connection_get_handles (base_conn, TP_HANDLE_TYPE_CONTACT); + tp_base_connection_get_handles (base_conn, TP_ENTITY_TYPE_CONTACT); TpHandle target = tp_base_channel_get_target_handle (base); TpChannelTextMessageType types[] = { @@ -173,10 +170,10 @@ gabble_im_channel_fill_immutable_properties (TpBaseChannel *chan, tp_dbus_properties_mixin_fill_properties_hash ( G_OBJECT (chan), properties, - TP_IFACE_CHANNEL_INTERFACE_MESSAGES, "MessagePartSupportFlags", - TP_IFACE_CHANNEL_INTERFACE_MESSAGES, "DeliveryReportingSupport", - TP_IFACE_CHANNEL_INTERFACE_MESSAGES, "SupportedContentTypes", - TP_IFACE_CHANNEL_INTERFACE_MESSAGES, "MessageTypes", + TP_IFACE_CHANNEL_TYPE_TEXT, "MessagePartSupportFlags", + TP_IFACE_CHANNEL_TYPE_TEXT, "DeliveryReportingSupport", + TP_IFACE_CHANNEL_TYPE_TEXT, "SupportedContentTypes", + TP_IFACE_CHANNEL_TYPE_TEXT, "MessageTypes", NULL); } @@ -203,7 +200,7 @@ gabble_im_channel_class_init (GabbleIMChannelClass *gabble_im_channel_class) base_class->channel_type = TP_IFACE_CHANNEL_TYPE_TEXT; base_class->get_interfaces = gabble_im_channel_get_interfaces; - base_class->target_handle_type = TP_HANDLE_TYPE_CONTACT; + base_class->target_entity_type = TP_ENTITY_TYPE_CONTACT; base_class->close = gabble_im_channel_close; base_class->fill_immutable_properties = gabble_im_channel_fill_immutable_properties; @@ -603,7 +600,7 @@ _gabble_im_channel_report_delivery ( * _gabble_im_channel_state_receive * * Send the D-BUS signal ChatStateChanged - * on org.freedesktop.Telepathy.Channel.Interface.ChatState + * on Channel.Interface.ChatState */ void @@ -661,10 +658,10 @@ gabble_im_channel_close (TpBaseChannel *base_chan) * gabble_im_channel_destroy * * Implements D-Bus method Destroy - * on interface org.freedesktop.Telepathy.Channel.Interface.Destroyable + * on interface Channel.Interface.Destroyable */ static void -gabble_im_channel_destroy (TpSvcChannelInterfaceDestroyable *iface, +gabble_im_channel_destroy (TpSvcChannelInterfaceDestroyable1 *iface, DBusGMethodInvocation *context) { g_assert (GABBLE_IS_IM_CHANNEL (iface)); @@ -673,7 +670,7 @@ gabble_im_channel_destroy (TpSvcChannelInterfaceDestroyable *iface, tp_message_mixin_clear ((GObject *) iface); gabble_im_channel_close (TP_BASE_CHANNEL (iface)); - tp_svc_channel_interface_destroyable_return_from_destroy (context); + tp_svc_channel_interface_destroyable1_return_from_destroy (context); } static gboolean @@ -700,9 +697,9 @@ static void destroyable_iface_init (gpointer g_iface, gpointer iface_data) { - TpSvcChannelInterfaceDestroyableClass *klass = g_iface; + TpSvcChannelInterfaceDestroyable1Class *klass = g_iface; -#define IMPLEMENT(x) tp_svc_channel_interface_destroyable_implement_##x (\ +#define IMPLEMENT(x) tp_svc_channel_interface_destroyable1_implement_##x (\ klass, gabble_im_channel_##x) IMPLEMENT(destroy); #undef IMPLEMENT diff --git a/src/im-factory.c b/src/im-factory.c index 4170d1012..4b581e339 100644 --- a/src/im-factory.c +++ b/src/im-factory.c @@ -324,8 +324,8 @@ im_channel_closed_cb (GabbleIMChannel *chan, gpointer user_data) if (tp_base_channel_is_registered (base)) { - tp_channel_manager_emit_channel_closed_for_object (self, - (TpExportableChannel *) chan); + tp_channel_manager_emit_channel_closed_for_object ( + TP_CHANNEL_MANAGER (self), (TpExportableChannel *) chan); } if (priv->channels != NULL) @@ -340,7 +340,7 @@ im_channel_closed_cb (GabbleIMChannel *chan, gpointer user_data) { DEBUG ("reopening channel with handle %u due to pending messages", contact_handle); - tp_channel_manager_emit_new_channel (self, + tp_channel_manager_emit_new_channel (TP_CHANNEL_MANAGER (self), (TpExportableChannel *) chan, NULL); } else @@ -400,7 +400,7 @@ new_im_channel (GabbleImFactory *fac, else request_tokens = NULL; - tp_channel_manager_emit_new_channel (fac, + tp_channel_manager_emit_new_channel (TP_CHANNEL_MANAGER (fac), (TpExportableChannel *) chan, request_tokens); g_slist_free (request_tokens); @@ -431,7 +431,7 @@ get_channel_for_incoming_message ( GabbleImFactoryPrivate *priv = self->priv; TpBaseConnection *conn = (TpBaseConnection *) priv->conn; TpHandleRepoIface *contact_repo = tp_base_connection_get_handles (conn, - TP_HANDLE_TYPE_CONTACT); + TP_ENTITY_TYPE_CONTACT); TpHandle handle; GabbleIMChannel *chan; @@ -610,7 +610,7 @@ gabble_im_factory_get_contact_caps (GabbleCapsChannelManager *manager, GValue monster = {0, }; GHashTable *fixed_properties; GValue *channel_type_value; - GValue *target_handle_type_value; + GValue *target_entity_type_value; gchar *text_allowed_properties[] = { TP_IFACE_CHANNEL ".TargetHandle", @@ -632,10 +632,10 @@ gabble_im_factory_get_contact_caps (GabbleCapsChannelManager *manager, g_hash_table_insert (fixed_properties, TP_IFACE_CHANNEL ".ChannelType", channel_type_value); - target_handle_type_value = tp_g_value_slice_new (G_TYPE_UINT); - g_value_set_uint (target_handle_type_value, TP_HANDLE_TYPE_CONTACT); - g_hash_table_insert (fixed_properties, TP_IFACE_CHANNEL ".TargetHandleType", - target_handle_type_value); + target_entity_type_value = tp_g_value_slice_new (G_TYPE_UINT); + g_value_set_uint (target_entity_type_value, TP_ENTITY_TYPE_CONTACT); + g_hash_table_insert (fixed_properties, TP_IFACE_CHANNEL ".TargetEntityType", + target_entity_type_value); dbus_g_type_struct_set (&monster, 0, fixed_properties, @@ -679,7 +679,7 @@ gabble_im_factory_foreach_channel (TpChannelManager *manager, static const gchar * const im_channel_fixed_properties[] = { TP_IFACE_CHANNEL ".ChannelType", - TP_IFACE_CHANNEL ".TargetHandleType", + TP_IFACE_CHANNEL ".TargetEntityType", NULL }; @@ -705,7 +705,7 @@ gabble_im_factory_type_foreach_channel_class (GType type, value); value = tp_g_value_slice_new (G_TYPE_UINT); - g_value_set_uint (value, TP_HANDLE_TYPE_CONTACT); + g_value_set_uint (value, TP_ENTITY_TYPE_CONTACT); g_hash_table_insert (table, (gchar *) im_channel_fixed_properties[1], value); @@ -730,7 +730,7 @@ gabble_im_factory_requestotron (GabbleImFactory *self, return FALSE; if (tp_asv_get_uint32 (request_properties, - TP_IFACE_CHANNEL ".TargetHandleType", NULL) != TP_HANDLE_TYPE_CONTACT) + TP_IFACE_CHANNEL ".TargetEntityType", NULL) != TP_ENTITY_TYPE_CONTACT) return FALSE; /* validity already checked by TpBaseConnection */ @@ -759,13 +759,13 @@ gabble_im_factory_requestotron (GabbleImFactory *self, goto error; } - tp_channel_manager_emit_request_already_satisfied (self, request_token, - channel); + tp_channel_manager_emit_request_already_satisfied (TP_CHANNEL_MANAGER (self), + request_token, channel); return TRUE; error: - tp_channel_manager_emit_request_failed (self, request_token, - error->domain, error->code, error->message); + tp_channel_manager_emit_request_failed (TP_CHANNEL_MANAGER (self), + request_token, error->domain, error->code, error->message); g_error_free (error); return TRUE; } @@ -773,36 +773,23 @@ error: static gboolean gabble_im_factory_create_channel (TpChannelManager *manager, - gpointer request_token, - GHashTable *request_properties) + TpChannelManagerRequest *request, + GHashTable *request_properties) { GabbleImFactory *self = GABBLE_IM_FACTORY (manager); - return gabble_im_factory_requestotron (self, request_token, + return gabble_im_factory_requestotron (self, request, request_properties, TRUE); } - -static gboolean -gabble_im_factory_request_channel (TpChannelManager *manager, - gpointer request_token, - GHashTable *request_properties) -{ - GabbleImFactory *self = GABBLE_IM_FACTORY (manager); - - return gabble_im_factory_requestotron (self, request_token, - request_properties, FALSE); -} - - static gboolean gabble_im_factory_ensure_channel (TpChannelManager *manager, - gpointer request_token, - GHashTable *request_properties) + TpChannelManagerRequest *request, + GHashTable *request_properties) { GabbleImFactory *self = GABBLE_IM_FACTORY (manager); - return gabble_im_factory_requestotron (self, request_token, + return gabble_im_factory_requestotron (self, request, request_properties, FALSE); } @@ -817,7 +804,6 @@ channel_manager_iface_init (gpointer g_iface, iface->type_foreach_channel_class = gabble_im_factory_type_foreach_channel_class; iface->create_channel = gabble_im_factory_create_channel; - iface->request_channel = gabble_im_factory_request_channel; iface->ensure_channel = gabble_im_factory_ensure_channel; } diff --git a/src/jingle-mint.c b/src/jingle-mint.c index f41a504ea..03f4b53d5 100644 --- a/src/jingle-mint.c +++ b/src/jingle-mint.c @@ -276,7 +276,7 @@ session_about_to_initiate_cb ( GabbleJingleMintPrivate *priv = self->priv; const gchar *peer_jid = wocky_jingle_session_get_peer_jid (session); TpHandleRepoIface *contact_repo = tp_base_connection_get_handles ( - (TpBaseConnection *) priv->conn, TP_HANDLE_TYPE_CONTACT); + (TpBaseConnection *) priv->conn, TP_ENTITY_TYPE_CONTACT); TpHandle peer = tp_handle_ensure (contact_repo, peer_jid, NULL, NULL); /* send directed presence (including our own caps, avatar etc.) to diff --git a/src/media-factory.c b/src/media-factory.c index 039f54911..512f9a588 100644 --- a/src/media-factory.c +++ b/src/media-factory.c @@ -208,7 +208,7 @@ call_channel_closed_cb (GabbleCallChannel *chan, gpointer user_data) GabbleMediaFactory *fac = GABBLE_MEDIA_FACTORY (user_data); GabbleMediaFactoryPrivate *priv = fac->priv; - tp_channel_manager_emit_channel_closed_for_object (fac, + tp_channel_manager_emit_channel_closed_for_object (TP_CHANNEL_MANAGER (fac), TP_EXPORTABLE_CHANNEL (chan)); DEBUG ("removing media channel %p with ref count %d", @@ -236,7 +236,7 @@ call_channel_initialized (GObject *source, priv->call_channels = g_list_prepend (priv->call_channels, g_object_ref (mcr->channel)); - tp_channel_manager_emit_new_channel (mcr->self, + tp_channel_manager_emit_new_channel (TP_CHANNEL_MANAGER (mcr->self), mcr->channel, mcr->request_tokens); g_signal_connect (mcr->channel, "closed", @@ -246,8 +246,8 @@ call_channel_initialized (GObject *source, { GSList *l; for (l = mcr->request_tokens; l != NULL; l = g_slist_next (l)) - tp_channel_manager_emit_request_failed (mcr->self, l->data, - error->domain, error->code, error->message); + tp_channel_manager_emit_request_failed (TP_CHANNEL_MANAGER (mcr->self), + l->data, error->domain, error->code, error->message); } media_channel_request_free (mcr); @@ -356,7 +356,7 @@ new_jingle_session_cb (GabbleJingleMint *jm, } contacts = tp_base_connection_get_handles (TP_BASE_CONNECTION (priv->conn), - TP_HANDLE_TYPE_CONTACT); + TP_ENTITY_TYPE_CONTACT); peer = tp_handle_ensure (contacts, wocky_jingle_session_get_peer_jid (sess), NULL, NULL); @@ -419,47 +419,47 @@ gabble_media_factory_foreach_channel (TpChannelManager *manager, static const gchar * const media_channel_fixed_properties[] = { TP_PROP_CHANNEL_CHANNEL_TYPE, - TP_PROP_CHANNEL_TARGET_HANDLE_TYPE, + TP_PROP_CHANNEL_TARGET_ENTITY_TYPE, NULL }; static const gchar * const call_channel_allowed_properties[] = { TP_PROP_CHANNEL_TARGET_HANDLE, TP_PROP_CHANNEL_TARGET_ID, - TP_PROP_CHANNEL_TYPE_CALL_INITIAL_AUDIO, - TP_PROP_CHANNEL_TYPE_CALL_INITIAL_AUDIO_NAME, - TP_PROP_CHANNEL_TYPE_CALL_INITIAL_VIDEO, - TP_PROP_CHANNEL_TYPE_CALL_INITIAL_VIDEO_NAME, - TP_PROP_CHANNEL_TYPE_CALL_MUTABLE_CONTENTS, + TP_PROP_CHANNEL_TYPE_CALL1_INITIAL_AUDIO, + TP_PROP_CHANNEL_TYPE_CALL1_INITIAL_AUDIO_NAME, + TP_PROP_CHANNEL_TYPE_CALL1_INITIAL_VIDEO, + TP_PROP_CHANNEL_TYPE_CALL1_INITIAL_VIDEO_NAME, + TP_PROP_CHANNEL_TYPE_CALL1_MUTABLE_CONTENTS, NULL }; static const gchar * const call_audio_allowed[] = { - TP_PROP_CHANNEL_TYPE_CALL_INITIAL_AUDIO, - TP_PROP_CHANNEL_TYPE_CALL_INITIAL_AUDIO_NAME, + TP_PROP_CHANNEL_TYPE_CALL1_INITIAL_AUDIO, + TP_PROP_CHANNEL_TYPE_CALL1_INITIAL_AUDIO_NAME, NULL }; static const gchar * const call_video_allowed[] = { - TP_PROP_CHANNEL_TYPE_CALL_INITIAL_VIDEO, - TP_PROP_CHANNEL_TYPE_CALL_INITIAL_VIDEO_NAME, + TP_PROP_CHANNEL_TYPE_CALL1_INITIAL_VIDEO, + TP_PROP_CHANNEL_TYPE_CALL1_INITIAL_VIDEO_NAME, NULL }; static const gchar * const call_both_allowed[] = { - TP_PROP_CHANNEL_TYPE_CALL_INITIAL_AUDIO, - TP_PROP_CHANNEL_TYPE_CALL_INITIAL_AUDIO_NAME, - TP_PROP_CHANNEL_TYPE_CALL_INITIAL_VIDEO, - TP_PROP_CHANNEL_TYPE_CALL_INITIAL_VIDEO_NAME, - TP_PROP_CHANNEL_TYPE_CALL_MUTABLE_CONTENTS, + TP_PROP_CHANNEL_TYPE_CALL1_INITIAL_AUDIO, + TP_PROP_CHANNEL_TYPE_CALL1_INITIAL_AUDIO_NAME, + TP_PROP_CHANNEL_TYPE_CALL1_INITIAL_VIDEO, + TP_PROP_CHANNEL_TYPE_CALL1_INITIAL_VIDEO_NAME, + TP_PROP_CHANNEL_TYPE_CALL1_MUTABLE_CONTENTS, NULL }; static const gchar * const call_both_allowed_immutable[] = { - TP_PROP_CHANNEL_TYPE_CALL_INITIAL_AUDIO, - TP_PROP_CHANNEL_TYPE_CALL_INITIAL_AUDIO_NAME, - TP_PROP_CHANNEL_TYPE_CALL_INITIAL_VIDEO, - TP_PROP_CHANNEL_TYPE_CALL_INITIAL_VIDEO_NAME, + TP_PROP_CHANNEL_TYPE_CALL1_INITIAL_AUDIO, + TP_PROP_CHANNEL_TYPE_CALL1_INITIAL_AUDIO_NAME, + TP_PROP_CHANNEL_TYPE_CALL1_INITIAL_VIDEO, + TP_PROP_CHANNEL_TYPE_CALL1_INITIAL_VIDEO_NAME, NULL }; @@ -479,12 +479,12 @@ static GHashTable * gabble_media_factory_call_channel_class (void) { GHashTable *table = tp_asv_new ( - TP_PROP_CHANNEL_TARGET_HANDLE_TYPE, G_TYPE_UINT, - TP_HANDLE_TYPE_CONTACT, + TP_PROP_CHANNEL_TARGET_ENTITY_TYPE, G_TYPE_UINT, + TP_ENTITY_TYPE_CONTACT, NULL); tp_asv_set_static_string (table, TP_PROP_CHANNEL_CHANNEL_TYPE, - TP_IFACE_CHANNEL_TYPE_CALL); + TP_IFACE_CHANNEL_TYPE_CALL1); return table; } @@ -522,13 +522,13 @@ gabble_media_factory_create_call (TpChannelManager *manager, if (tp_strdiff (tp_asv_get_string (request_properties, TP_PROP_CHANNEL_CHANNEL_TYPE), - TP_IFACE_CHANNEL_TYPE_CALL)) + TP_IFACE_CHANNEL_TYPE_CALL1)) return FALSE; DEBUG ("Creating a new call channel"); if (tp_asv_get_uint32 (request_properties, - TP_PROP_CHANNEL_TARGET_HANDLE_TYPE, NULL) != TP_HANDLE_TYPE_CONTACT) + TP_PROP_CHANNEL_TARGET_ENTITY_TYPE, NULL) != TP_ENTITY_TYPE_CONTACT) return FALSE; if (tp_channel_manager_asv_has_unknown_properties (request_properties, @@ -554,8 +554,9 @@ gabble_media_factory_create_call (TpChannelManager *manager, /* Per the spec, we ignore InitialAudio and InitialVideo when * looking for an existing channel. */ - tp_channel_manager_emit_request_already_satisfied (self, - request_token, TP_EXPORTABLE_CHANNEL (channel)); + tp_channel_manager_emit_request_already_satisfied ( + TP_CHANNEL_MANAGER (self), request_token, + TP_EXPORTABLE_CHANNEL (channel)); return TRUE; } } @@ -579,9 +580,9 @@ gabble_media_factory_create_call (TpChannelManager *manager, } initial_audio = tp_asv_get_boolean (request_properties, - TP_PROP_CHANNEL_TYPE_CALL_INITIAL_AUDIO, NULL); + TP_PROP_CHANNEL_TYPE_CALL1_INITIAL_AUDIO, NULL); initial_video = tp_asv_get_boolean (request_properties, - TP_PROP_CHANNEL_TYPE_CALL_INITIAL_VIDEO, NULL); + TP_PROP_CHANNEL_TYPE_CALL1_INITIAL_VIDEO, NULL); if (!initial_audio && !initial_video) { @@ -596,9 +597,9 @@ gabble_media_factory_create_call (TpChannelManager *manager, */ initial_audio_name = tp_asv_get_string (request_properties, - TP_PROP_CHANNEL_TYPE_CALL_INITIAL_AUDIO_NAME); + TP_PROP_CHANNEL_TYPE_CALL1_INITIAL_AUDIO_NAME); initial_video_name = tp_asv_get_string (request_properties, - TP_PROP_CHANNEL_TYPE_CALL_INITIAL_VIDEO_NAME); + TP_PROP_CHANNEL_TYPE_CALL1_INITIAL_VIDEO_NAME); new_call_channel (self, NULL, target, initial_audio, initial_audio_name, @@ -608,28 +609,28 @@ gabble_media_factory_create_call (TpChannelManager *manager, return TRUE; error: - tp_channel_manager_emit_request_failed (self, request_token, - error->domain, error->code, error->message); + tp_channel_manager_emit_request_failed (TP_CHANNEL_MANAGER (self), + request_token, error->domain, error->code, error->message); g_error_free (error); return TRUE; } static gboolean gabble_media_factory_create_channel (TpChannelManager *manager, - gpointer request_token, - GHashTable *request_properties) + TpChannelManagerRequest *request, + GHashTable *request_properties) { - return gabble_media_factory_create_call (manager, request_token, + return gabble_media_factory_create_call (manager, request, request_properties, METHOD_CREATE); } static gboolean gabble_media_factory_ensure_channel (TpChannelManager *manager, - gpointer request_token, - GHashTable *request_properties) + TpChannelManagerRequest *request, + GHashTable *request_properties) { - return gabble_media_factory_create_call (manager, request_token, + return gabble_media_factory_create_call (manager, request, request_properties, METHOD_ENSURE); } @@ -825,7 +826,7 @@ gabble_media_factory_represent_client (GabbleCapsChannelManager *manager, GabbleCapabilitySet *cap_set, GPtrArray *data_forms) { - static GQuark qc_gtalk_p2p = 0, qc_ice_udp = 0, qc_h264 = 0, qc_ice = 0; + static GQuark qc_gtalk_p2p = 0, qc_h264 = 0, qc_ice = 0; gboolean gtalk_p2p = FALSE, h264 = FALSE, audio = FALSE, video = FALSE, ice_udp = FALSE; guint i; @@ -834,15 +835,11 @@ gabble_media_factory_represent_client (GabbleCapsChannelManager *manager, if (G_UNLIKELY (qc_gtalk_p2p == 0)) { qc_gtalk_p2p = g_quark_from_static_string ( - TP_TOKEN_CHANNEL_TYPE_CALL_GTALK_P2P); + TP_TOKEN_CHANNEL_TYPE_CALL1_GTALK_P2P); qc_ice = g_quark_from_static_string ( - TP_TOKEN_CHANNEL_TYPE_CALL_ICE); - /* 'ice-udp' isn't the proper cap name, 'ice' is. We keep supporting - * 'ice-udp' for now to not break existing clients. */ - qc_ice_udp = g_quark_from_static_string ( - TP_IFACE_CHANNEL_TYPE_CALL "/ice-udp"); + TP_TOKEN_CHANNEL_TYPE_CALL1_ICE); qc_h264 = g_quark_from_static_string ( - TP_IFACE_CHANNEL_TYPE_CALL "/video/h264"); + TP_IFACE_CHANNEL_TYPE_CALL1 "/video/h264"); } if (cap_tokens != NULL) @@ -857,7 +854,6 @@ gabble_media_factory_represent_client (GabbleCapsChannelManager *manager, gboolean *cap; } q2cap[] = { { qc_gtalk_p2p, >alk_p2p }, - { qc_ice_udp, &ice_udp }, { qc_ice, &ice_udp }, { qc_h264, &h264 }, { 0, NULL }, @@ -886,16 +882,16 @@ gabble_media_factory_represent_client (GabbleCapsChannelManager *manager, if (tp_strdiff (tp_asv_get_string (filter, TP_PROP_CHANNEL_CHANNEL_TYPE), - TP_IFACE_CHANNEL_TYPE_CALL)) + TP_IFACE_CHANNEL_TYPE_CALL1)) { /* not interesting to this channel manager */ continue; } - if (tp_asv_lookup (filter, TP_PROP_CHANNEL_TARGET_HANDLE_TYPE) + if (tp_asv_lookup (filter, TP_PROP_CHANNEL_TARGET_ENTITY_TYPE) != NULL && - tp_asv_get_uint32 (filter, TP_PROP_CHANNEL_TARGET_HANDLE_TYPE, - NULL) != TP_HANDLE_TYPE_CONTACT) + tp_asv_get_uint32 (filter, TP_PROP_CHANNEL_TARGET_ENTITY_TYPE, + NULL) != TP_ENTITY_TYPE_CONTACT) { /* not interesting to this channel manager: we only care about * Jingle calls involving contacts (or about clients that support @@ -904,11 +900,11 @@ gabble_media_factory_represent_client (GabbleCapsChannelManager *manager, } if (tp_asv_get_boolean (filter, - TP_PROP_CHANNEL_TYPE_CALL_INITIAL_AUDIO, NULL)) + TP_PROP_CHANNEL_TYPE_CALL1_INITIAL_AUDIO, NULL)) audio = TRUE; if (tp_asv_get_boolean (filter, - TP_PROP_CHANNEL_TYPE_CALL_INITIAL_VIDEO, NULL)) + TP_PROP_CHANNEL_TYPE_CALL1_INITIAL_VIDEO, NULL)) video = TRUE; /* If we've picked up all the capabilities we're ever going to, then diff --git a/src/muc-channel.c b/src/muc-channel.c index 78f79c74d..69fe9ed81 100644 --- a/src/muc-channel.c +++ b/src/muc-channel.c @@ -70,21 +70,19 @@ static void muc_call_channel_finish_requests (GabbleMucChannel *self, G_DEFINE_TYPE_WITH_CODE (GabbleMucChannel, gabble_muc_channel, TP_TYPE_BASE_CHANNEL, - G_IMPLEMENT_INTERFACE (TP_TYPE_SVC_CHANNEL_INTERFACE_GROUP, + G_IMPLEMENT_INTERFACE (TP_TYPE_SVC_CHANNEL_INTERFACE_GROUP1, tp_group_mixin_iface_init); - G_IMPLEMENT_INTERFACE (TP_TYPE_SVC_CHANNEL_INTERFACE_PASSWORD, + G_IMPLEMENT_INTERFACE (TP_TYPE_SVC_CHANNEL_INTERFACE_PASSWORD1, password_iface_init); G_IMPLEMENT_INTERFACE (TP_TYPE_SVC_CHANNEL_TYPE_TEXT, - tp_message_mixin_text_iface_init); - G_IMPLEMENT_INTERFACE (TP_TYPE_SVC_CHANNEL_INTERFACE_MESSAGES, - tp_message_mixin_messages_iface_init); - G_IMPLEMENT_INTERFACE (TP_TYPE_SVC_CHANNEL_INTERFACE_CHAT_STATE, + tp_message_mixin_iface_init); + G_IMPLEMENT_INTERFACE (TP_TYPE_SVC_CHANNEL_INTERFACE_CHAT_STATE1, tp_message_mixin_chat_state_iface_init) - G_IMPLEMENT_INTERFACE (TP_TYPE_SVC_CHANNEL_INTERFACE_CONFERENCE, NULL); - G_IMPLEMENT_INTERFACE (TP_TYPE_SVC_CHANNEL_INTERFACE_ROOM, NULL); - G_IMPLEMENT_INTERFACE (TP_TYPE_SVC_CHANNEL_INTERFACE_ROOM_CONFIG, + G_IMPLEMENT_INTERFACE (TP_TYPE_SVC_CHANNEL_INTERFACE_CONFERENCE1, NULL); + G_IMPLEMENT_INTERFACE (TP_TYPE_SVC_CHANNEL_INTERFACE_ROOM1, NULL); + G_IMPLEMENT_INTERFACE (TP_TYPE_SVC_CHANNEL_INTERFACE_ROOM_CONFIG1, tp_base_room_config_iface_init); - G_IMPLEMENT_INTERFACE (TP_TYPE_SVC_CHANNEL_INTERFACE_SUBJECT, + G_IMPLEMENT_INTERFACE (TP_TYPE_SVC_CHANNEL_INTERFACE_SUBJECT1, subject_iface_init); ) @@ -232,14 +230,13 @@ gabble_muc_channel_get_interfaces (TpBaseChannel *base) interfaces = TP_BASE_CHANNEL_CLASS ( gabble_muc_channel_parent_class)->get_interfaces (base); - g_ptr_array_add (interfaces, TP_IFACE_CHANNEL_INTERFACE_GROUP); - g_ptr_array_add (interfaces, TP_IFACE_CHANNEL_INTERFACE_PASSWORD); - g_ptr_array_add (interfaces, TP_IFACE_CHANNEL_INTERFACE_CHAT_STATE); - g_ptr_array_add (interfaces, TP_IFACE_CHANNEL_INTERFACE_MESSAGES); - g_ptr_array_add (interfaces, TP_IFACE_CHANNEL_INTERFACE_CONFERENCE); - g_ptr_array_add (interfaces, TP_IFACE_CHANNEL_INTERFACE_ROOM); - g_ptr_array_add (interfaces, TP_IFACE_CHANNEL_INTERFACE_ROOM_CONFIG); - g_ptr_array_add (interfaces, TP_IFACE_CHANNEL_INTERFACE_SUBJECT); + g_ptr_array_add (interfaces, TP_IFACE_CHANNEL_INTERFACE_GROUP1); + g_ptr_array_add (interfaces, TP_IFACE_CHANNEL_INTERFACE_PASSWORD1); + g_ptr_array_add (interfaces, TP_IFACE_CHANNEL_INTERFACE_CHAT_STATE1); + g_ptr_array_add (interfaces, TP_IFACE_CHANNEL_INTERFACE_CONFERENCE1); + g_ptr_array_add (interfaces, TP_IFACE_CHANNEL_INTERFACE_ROOM1); + g_ptr_array_add (interfaces, TP_IFACE_CHANNEL_INTERFACE_ROOM_CONFIG1); + g_ptr_array_add (interfaces, TP_IFACE_CHANNEL_INTERFACE_SUBJECT1); return interfaces; } @@ -339,17 +336,43 @@ static void handle_errmsg (GObject *source, /* Signatures for some other stuff. */ static void _gabble_muc_channel_handle_subject (GabbleMucChannel *chan, - TpHandleType handle_type, + TpEntityType handle_type, TpHandle sender, GDateTime *datetime, const gchar *subject, WockyStanza *msg, const GError *error); static void _gabble_muc_channel_receive (GabbleMucChannel *chan, - TpChannelTextMessageType msg_type, TpHandleType handle_type, + TpChannelTextMessageType msg_type, TpEntityType handle_type, TpHandle sender, GDateTime *datetime, const gchar *id, const gchar *text, WockyStanza *msg, const GError *send_error, TpDeliveryStatus delivery_status); static void +change_members (GObject *obj, + const gchar *message, + const TpIntset *add, + const TpIntset *del, + const TpIntset *add_local_pending, + const TpIntset *add_remote_pending, + TpHandle actor, + TpChannelGroupChangeReason reason) +{ + GHashTable *details; + + details = tp_asv_new ( + "actor", G_TYPE_UINT, actor, + "change-reason", G_TYPE_UINT, reason, + NULL); + + if (message != NULL) + tp_asv_set_string (details, "message", message); + + tp_group_mixin_change_members (obj, + add, del, add_local_pending, add_remote_pending, details); + + g_hash_table_unref (details); +} + +static void gabble_muc_channel_constructed (GObject *obj) { GabbleMucChannel *self = GABBLE_MUC_CHANNEL (obj); @@ -376,9 +399,9 @@ gabble_muc_channel_constructed (GObject *obj) chain_up (obj); room_handles = tp_base_connection_get_handles (base_conn, - TP_HANDLE_TYPE_ROOM); + TP_ENTITY_TYPE_ROOM); contact_handles = tp_base_connection_get_handles (base_conn, - TP_HANDLE_TYPE_CONTACT); + TP_ENTITY_TYPE_CONTACT); /* get, and sanity-check, the room's jid */ target = tp_base_channel_get_target_handle (base); @@ -443,7 +466,6 @@ gabble_muc_channel_constructed (GObject *obj) /* set initial group flags */ tp_group_mixin_change_flags (obj, - TP_CHANNEL_GROUP_FLAG_PROPERTIES | TP_CHANNEL_GROUP_FLAG_CHANNEL_SPECIFIC_HANDLES | TP_CHANNEL_GROUP_FLAG_HANDLE_OWNERS_NOT_AVAILABLE | TP_CHANNEL_GROUP_FLAG_CAN_ADD, @@ -517,7 +539,7 @@ gabble_muc_channel_constructed (GObject *obj) TpIntset *members = tp_intset_new_containing (initiator); TpIntset *pending = tp_intset_new_containing (self_handle); - tp_group_mixin_change_members (obj, priv->invitation_message, + change_members (obj, priv->invitation_message, members, NULL, pending, NULL, initiator, TP_CHANNEL_GROUP_CHANGE_REASON_INVITED); @@ -755,7 +777,7 @@ create_room_identity (GabbleMucChannel *chan) gchar *alias = NULL; GabbleConnectionAliasSource source; - contact_repo = tp_base_connection_get_handles (conn, TP_HANDLE_TYPE_CONTACT); + contact_repo = tp_base_connection_get_handles (conn, TP_ENTITY_TYPE_CONTACT); g_assert (priv->self_jid == NULL); @@ -1007,16 +1029,16 @@ gabble_muc_channel_fill_immutable_properties ( tp_dbus_properties_mixin_fill_properties_hash ( G_OBJECT (chan), properties, - TP_IFACE_CHANNEL_INTERFACE_CONFERENCE, "InitialChannels", - TP_IFACE_CHANNEL_INTERFACE_CONFERENCE, "InitialInviteeHandles", - TP_IFACE_CHANNEL_INTERFACE_CONFERENCE, "InitialInviteeIDs", - TP_IFACE_CHANNEL_INTERFACE_CONFERENCE, "InvitationMessage", - TP_IFACE_CHANNEL_INTERFACE_MESSAGES, "MessagePartSupportFlags", - TP_IFACE_CHANNEL_INTERFACE_MESSAGES, "DeliveryReportingSupport", - TP_IFACE_CHANNEL_INTERFACE_MESSAGES, "SupportedContentTypes", - TP_IFACE_CHANNEL_INTERFACE_MESSAGES, "MessageTypes", - TP_IFACE_CHANNEL_INTERFACE_ROOM, "RoomName", - TP_IFACE_CHANNEL_INTERFACE_ROOM, "Server", + TP_IFACE_CHANNEL_INTERFACE_CONFERENCE1, "InitialChannels", + TP_IFACE_CHANNEL_INTERFACE_CONFERENCE1, "InitialInviteeHandles", + TP_IFACE_CHANNEL_INTERFACE_CONFERENCE1, "InitialInviteeIDs", + TP_IFACE_CHANNEL_INTERFACE_CONFERENCE1, "InvitationMessage", + TP_IFACE_CHANNEL_TYPE_TEXT, "MessagePartSupportFlags", + TP_IFACE_CHANNEL_TYPE_TEXT, "DeliveryReportingSupport", + TP_IFACE_CHANNEL_TYPE_TEXT, "SupportedContentTypes", + TP_IFACE_CHANNEL_TYPE_TEXT, "MessageTypes", + TP_IFACE_CHANNEL_INTERFACE_ROOM1, "RoomName", + TP_IFACE_CHANNEL_INTERFACE_ROOM1, "Server", NULL); } @@ -1046,17 +1068,17 @@ gabble_muc_channel_class_init (GabbleMucChannelClass *gabble_muc_channel_class) }; static TpDBusPropertiesMixinIfaceImpl prop_interfaces[] = { - { TP_IFACE_CHANNEL_INTERFACE_CONFERENCE, + { TP_IFACE_CHANNEL_INTERFACE_CONFERENCE1, tp_dbus_properties_mixin_getter_gobject_properties, NULL, conference_props, }, - { TP_IFACE_CHANNEL_INTERFACE_ROOM, + { TP_IFACE_CHANNEL_INTERFACE_ROOM1, tp_dbus_properties_mixin_getter_gobject_properties, NULL, room_props, }, - { TP_IFACE_CHANNEL_INTERFACE_SUBJECT, + { TP_IFACE_CHANNEL_INTERFACE_SUBJECT1, tp_dbus_properties_mixin_getter_gobject_properties, NULL, subject_props, @@ -1078,7 +1100,7 @@ gabble_muc_channel_class_init (GabbleMucChannelClass *gabble_muc_channel_class) object_class->finalize = gabble_muc_channel_finalize; base_class->channel_type = TP_IFACE_CHANNEL_TYPE_TEXT; - base_class->target_handle_type = TP_HANDLE_TYPE_ROOM; + base_class->target_entity_type = TP_ENTITY_TYPE_ROOM; base_class->get_interfaces = gabble_muc_channel_get_interfaces; base_class->fill_immutable_properties = gabble_muc_channel_fill_immutable_properties; base_class->close = gabble_muc_channel_close; @@ -1419,7 +1441,7 @@ change_must_provide_password ( DEBUG ("emitting password flags changed, added 0x%X, removed 0x%X", added, removed); - tp_svc_channel_interface_password_emit_password_flags_changed ( + tp_svc_channel_interface_password1_emit_password_flags_changed ( chan, added, removed); } @@ -1527,7 +1549,7 @@ return_from_set_subject ( GabbleMucChannelPrivate *priv = self->priv; if (error == NULL) - tp_svc_channel_interface_subject_return_from_set_subject ( + tp_svc_channel_interface_subject1_return_from_set_subject ( priv->set_subject_context); else dbus_g_method_return_error (priv->set_subject_context, error); @@ -1593,7 +1615,7 @@ close_channel (GabbleMucChannel *chan, const gchar *reason, #endif set = tp_intset_new_containing (TP_GROUP_MIXIN (chan)->self_handle); - tp_group_mixin_change_members ((GObject *) chan, reason, + change_members ((GObject *) chan, reason, NULL, set, NULL, NULL, actor, reason_code); tp_intset_destroy (set); @@ -1676,7 +1698,7 @@ handle_nick_conflict (GabbleMucChannel *chan, TpBaseChannel *base = TP_BASE_CHANNEL (chan); TpGroupMixin *mixin = TP_GROUP_MIXIN (chan); TpHandleRepoIface *contact_repo = tp_base_connection_get_handles ( - tp_base_channel_get_connection (base), TP_HANDLE_TYPE_CONTACT); + tp_base_channel_get_connection (base), TP_ENTITY_TYPE_CONTACT); TpHandle self_handle; TpIntset *add_rp, *remove_rp; const gchar *from = wocky_stanza_get_from (stanza); @@ -1721,7 +1743,7 @@ handle_nick_conflict (GabbleMucChannel *chan, tp_intset_add (remove_rp, mixin->self_handle); tp_group_mixin_change_self_handle ((GObject *) chan, self_handle); - tp_group_mixin_change_members ((GObject *) chan, NULL, NULL, remove_rp, NULL, + change_members ((GObject *) chan, NULL, NULL, remove_rp, NULL, add_rp, 0, TP_CHANNEL_GROUP_CHANGE_REASON_RENAMED); tp_intset_destroy (add_rp); @@ -1820,7 +1842,7 @@ emit_subject_changed (GabbleMucChannel *chan) const gchar *changed[] = { "Subject", "Actor", "Timestamp", NULL }; tp_dbus_properties_mixin_emit_properties_changed (G_OBJECT (chan), - TP_IFACE_CHANNEL_INTERFACE_SUBJECT, changed); + TP_IFACE_CHANNEL_INTERFACE_SUBJECT1, changed); } static void @@ -1992,13 +2014,13 @@ create_new_tube (GabbleMucChannel *gmuc, { case TUBE_TYPE_DBUS: tube = GABBLE_TUBE_IFACE (gabble_tube_dbus_new (conn, - handle, TP_HANDLE_TYPE_ROOM, self_handle, initiator, + handle, TP_ENTITY_TYPE_ROOM, self_handle, initiator, service, parameters, stream_id, tube_id, bytestream, gmuc, requested)); break; case TUBE_TYPE_STREAM: tube = GABBLE_TUBE_IFACE (gabble_tube_stream_new (conn, - handle, TP_HANDLE_TYPE_ROOM, self_handle, initiator, + handle, TP_ENTITY_TYPE_ROOM, self_handle, initiator, service, parameters, tube_id, gmuc, requested)); break; default: @@ -2051,18 +2073,18 @@ gabble_muc_channel_tube_request (GabbleMucChannel *self, channel_type = tp_asv_get_string (request_properties, TP_PROP_CHANNEL_CHANNEL_TYPE); - if (!tp_strdiff (channel_type, TP_IFACE_CHANNEL_TYPE_STREAM_TUBE)) + if (!tp_strdiff (channel_type, TP_IFACE_CHANNEL_TYPE_STREAM_TUBE1)) { type = TUBE_TYPE_STREAM; service = tp_asv_get_string (request_properties, - TP_PROP_CHANNEL_TYPE_STREAM_TUBE_SERVICE); + TP_PROP_CHANNEL_TYPE_STREAM_TUBE1_SERVICE); } - else if (! tp_strdiff (channel_type, TP_IFACE_CHANNEL_TYPE_DBUS_TUBE)) + else if (! tp_strdiff (channel_type, TP_IFACE_CHANNEL_TYPE_DBUS_TUBE1)) { type = TUBE_TYPE_DBUS; service = tp_asv_get_string (request_properties, - TP_PROP_CHANNEL_TYPE_DBUS_TUBE_SERVICE_NAME); + TP_PROP_CHANNEL_TYPE_DBUS_TUBE1_SERVICE_NAME); } else /* This assertion is safe: this function's caller only calls it in one of @@ -2174,7 +2196,7 @@ tubes_presence_update (GabbleMucChannel *gmuc, GabbleMucChannelPrivate *priv = gmuc->priv; TpHandleRepoIface *contact_repo = tp_base_connection_get_handles ( tp_base_channel_get_connection (TP_BASE_CHANNEL (gmuc)), - TP_HANDLE_TYPE_CONTACT); + TP_ENTITY_TYPE_CONTACT); const gchar *presence_type; WockyNode *tubes_node; GHashTable *old_dbus_tubes; @@ -2373,7 +2395,7 @@ handle_parted (GObject *source, TpChannelGroupChangeReason reason = TP_CHANNEL_GROUP_CHANGE_REASON_NONE; TpHandleRepoIface *contact_repo = tp_base_connection_get_handles (tp_base_channel_get_connection (base), - TP_HANDLE_TYPE_CONTACT); + TP_ENTITY_TYPE_CONTACT); TpIntset *handles = NULL; TpHandle member = 0; TpHandle actor = 0; @@ -2443,7 +2465,7 @@ handle_left (GObject *source, TpChannelGroupChangeReason reason = TP_CHANNEL_GROUP_CHANGE_REASON_NONE; TpHandleRepoIface *contact_repo = tp_base_connection_get_handles (tp_base_channel_get_connection (base), - TP_HANDLE_TYPE_CONTACT); + TP_ENTITY_TYPE_CONTACT); TpIntset *handles = NULL; TpHandle member = 0; TpHandle actor = 0; @@ -2471,7 +2493,7 @@ handle_left (GObject *source, /* handle_tube_presence creates tubes if need be, so bypass it here: */ tubes_presence_update (gmuc, member, wocky_stanza_get_top_node (stanza)); - tp_group_mixin_change_members (data, why, NULL, handles, NULL, NULL, + change_members (data, why, NULL, handles, NULL, NULL, actor, reason); tp_message_mixin_change_chat_state (data, member, TP_CHANNEL_CHAT_STATE_GONE); @@ -2514,7 +2536,7 @@ handle_fill_presence (WockyMuc *muc, TpBaseConnection *base_conn = tp_base_channel_get_connection (base); GabbleConnection *conn = GABBLE_CONNECTION (base_conn); TpHandleRepoIface *contact_repo = tp_base_connection_get_handles (base_conn, - TP_HANDLE_TYPE_CONTACT); + TP_ENTITY_TYPE_CONTACT); TpHandle self_handle; self_handle = tp_handle_ensure (contact_repo, priv->self_jid->str, @@ -2552,7 +2574,7 @@ handle_renamed (GObject *source, TpBaseChannel *base = TP_BASE_CHANNEL (gmuc); TpHandleRepoIface *contact_repo = tp_base_connection_get_handles (tp_base_channel_get_connection (base), - TP_HANDLE_TYPE_CONTACT); + TP_ENTITY_TYPE_CONTACT); TpIntset *old_self = tp_intset_new (); const gchar *me = wocky_muc_jid (wmuc); const gchar *me2 = wocky_muc_user (wmuc); @@ -2564,7 +2586,7 @@ handle_renamed (GObject *source, tp_intset_add (old_self, TP_GROUP_MIXIN (gmuc)->self_handle); tp_group_mixin_change_self_handle (data, myself); tp_group_mixin_add_handle_owner (data, myself, userid); - tp_group_mixin_change_members (data, "", NULL, old_self, NULL, NULL, 0, 0); + change_members (data, "", NULL, old_self, NULL, NULL, 0, 0); handle_tube_presence (gmuc, myself, stanza); @@ -2629,7 +2651,7 @@ handle_join (WockyMuc *muc, TpBaseChannel *base = TP_BASE_CHANNEL (gmuc); TpBaseConnection *base_conn = tp_base_channel_get_connection (base); TpHandleRepoIface *contact_repo = tp_base_connection_get_handles (base_conn, - TP_HANDLE_TYPE_CONTACT); + TP_ENTITY_TYPE_CONTACT); TpHandleSet *members = tp_handle_set_new (contact_repo); TpHandleSet *owners = tp_handle_set_new (contact_repo); GHashTable *omap = g_hash_table_new (g_direct_hash, g_direct_equal); @@ -2652,7 +2674,7 @@ handle_join (WockyMuc *muc, tp_handle_set_add (members, myself); tp_group_mixin_add_handle_owners (G_OBJECT (gmuc), omap); - tp_group_mixin_change_members (G_OBJECT (gmuc), "", + change_members (G_OBJECT (gmuc), "", tp_handle_set_peek (members), NULL, NULL, NULL, 0, 0); /* accept the config of the room if it was created for us: */ @@ -2697,7 +2719,7 @@ handle_presence (GObject *source, TpBaseConnection *base_conn = tp_base_channel_get_connection (base); GabbleConnection *conn = GABBLE_CONNECTION (base_conn); TpHandleRepoIface *contact_repo = - tp_base_connection_get_handles (base_conn, TP_HANDLE_TYPE_CONTACT); + tp_base_connection_get_handles (base_conn, TP_ENTITY_TYPE_CONTACT); TpHandle owner = 0; TpHandle handle = tp_handle_ensure (contact_repo, who->from, GUINT_TO_POINTER (GABBLE_JID_ROOM_MEMBER), NULL); @@ -2724,7 +2746,7 @@ handle_presence (GObject *source, /* add the member in quesion */ tp_handle_set_add (handles, handle); - tp_group_mixin_change_members (data, "", tp_handle_set_peek (handles), + change_members (data, "", tp_handle_set_peek (handles), NULL, NULL, NULL, 0, 0); /* record the owner (0 for no owner) */ @@ -2773,12 +2795,12 @@ handle_message (GObject *source, TpChannelTextMessageType msg_type; TpHandleRepoIface *repo; - TpHandleType handle_type; + TpEntityType handle_type; TpHandle from; if (from_member) { - handle_type = TP_HANDLE_TYPE_CONTACT; + handle_type = TP_ENTITY_TYPE_CONTACT; repo = tp_base_connection_get_handles (conn, handle_type); from = tp_handle_ensure (repo, who->from, GUINT_TO_POINTER (GABBLE_JID_ROOM_MEMBER), NULL); @@ -2791,7 +2813,7 @@ handle_message (GObject *source, } else /* directly from MUC itself */ { - handle_type = TP_HANDLE_TYPE_ROOM; + handle_type = TP_ENTITY_TYPE_ROOM; repo = tp_base_connection_get_handles (conn, handle_type); from = tp_base_channel_get_target_handle (base); } @@ -2862,13 +2884,13 @@ handle_errmsg (GObject *source, gboolean from_member = (who != NULL); TpDeliveryStatus ds = TP_DELIVERY_STATUS_DELIVERED; TpHandleRepoIface *repo = NULL; - TpHandleType handle_type; + TpEntityType handle_type; TpHandle from = 0; const gchar *subject; if (from_member) { - handle_type = TP_HANDLE_TYPE_CONTACT; + handle_type = TP_ENTITY_TYPE_CONTACT; repo = tp_base_connection_get_handles (conn, handle_type); from = tp_handle_ensure (repo, who->from, GUINT_TO_POINTER (GABBLE_JID_ROOM_MEMBER), NULL); @@ -2881,7 +2903,7 @@ handle_errmsg (GObject *source, } else /* directly from MUC itself */ { - handle_type = TP_HANDLE_TYPE_ROOM; + handle_type = TP_ENTITY_TYPE_ROOM; repo = tp_base_connection_get_handles (conn, handle_type); from = tp_base_channel_get_target_handle (base); } @@ -2934,7 +2956,7 @@ handle_errmsg (GObject *source, */ void _gabble_muc_channel_handle_subject (GabbleMucChannel *chan, - TpHandleType handle_type, + TpEntityType handle_type, TpHandle sender, GDateTime *datetime, const gchar *subject, @@ -2972,7 +2994,7 @@ _gabble_muc_channel_handle_subject (GabbleMucChannel *chan, /* Channel.Interface.Subject properties */ - if (handle_type == TP_HANDLE_TYPE_CONTACT) + if (handle_type == TP_ENTITY_TYPE_CONTACT) { TpHandleRepoIface *contact_handles = tp_base_connection_get_handles ( tp_base_channel_get_connection (TP_BASE_CHANNEL (chan)), @@ -3007,7 +3029,7 @@ _gabble_muc_channel_handle_subject (GabbleMucChannel *chan, static void _gabble_muc_channel_receive (GabbleMucChannel *chan, TpChannelTextMessageType msg_type, - TpHandleType sender_handle_type, + TpEntityType sender_handle_type, TpHandle sender, GDateTime *datetime, const gchar *id, @@ -3057,7 +3079,7 @@ _gabble_muc_channel_receive (GabbleMucChannel *chan, * messages like "foo has set the subject to: ..." and "This room is not * anonymous". */ - if (!is_echo && !is_error && sender_handle_type == TP_HANDLE_TYPE_ROOM) + if (!is_echo && !is_error && sender_handle_type == TP_ENTITY_TYPE_ROOM) { STANZA_DEBUG (msg, "ignoring message from muc"); @@ -3146,7 +3168,7 @@ _gabble_muc_channel_receive (GabbleMucChannel *chan, else { /* Messages from the MUC itself should have no sender. */ - if (sender_handle_type == TP_HANDLE_TYPE_CONTACT) + if (sender_handle_type == TP_ENTITY_TYPE_CONTACT) tp_cm_message_set_sender (message, sender); if (timestamp != 0) @@ -3172,10 +3194,10 @@ gabble_muc_channel_close (TpBaseChannel *base) * gabble_muc_channel_get_password_flags * * Implements D-Bus method GetPasswordFlags - * on interface org.freedesktop.Telepathy.Channel.Interface.Password + * on interface Channel.Interface.Password */ static void -gabble_muc_channel_get_password_flags (TpSvcChannelInterfacePassword *iface, +gabble_muc_channel_get_password_flags (TpSvcChannelInterfacePassword1 *iface, DBusGMethodInvocation *context) { GabbleMucChannel *self = GABBLE_MUC_CHANNEL (iface); @@ -3185,7 +3207,7 @@ gabble_muc_channel_get_password_flags (TpSvcChannelInterfacePassword *iface, priv = self->priv; - tp_svc_channel_interface_password_return_from_get_password_flags (context, + tp_svc_channel_interface_password1_return_from_get_password_flags (context, priv->must_provide_password ? TP_CHANNEL_PASSWORD_FLAG_PROVIDE : 0); } @@ -3194,13 +3216,13 @@ gabble_muc_channel_get_password_flags (TpSvcChannelInterfacePassword *iface, * gabble_muc_channel_provide_password * * Implements D-Bus method ProvidePassword - * on interface org.freedesktop.Telepathy.Channel.Interface.Password + * on interface Channel.Interface.Password * * @context: The D-Bus invocation context to use to return values * or throw an error. */ static void -gabble_muc_channel_provide_password (TpSvcChannelInterfacePassword *iface, +gabble_muc_channel_provide_password (TpSvcChannelInterfacePassword1 *iface, const gchar *password, DBusGMethodInvocation *context) { @@ -3259,7 +3281,7 @@ _gabble_muc_channel_message_sent_cb (GObject *source, * gabble_muc_channel_send * * Indirectly implements (via TpMessageMixin) D-Bus method Send on interface - * org.freedesktop.Telepathy.Channel.Type.Text and D-Bus method SendMessage on + * Channel.Type.Text and D-Bus method SendMessage on * Channel.Interface.Messages */ static void @@ -3400,7 +3422,7 @@ gabble_muc_channel_add_member (GObject *obj, tp_group_mixin_add_handle_owner (obj, mixin->self_handle, tp_base_connection_get_self_handle (conn)); - tp_group_mixin_change_members (obj, "", NULL, set_remove_members, + change_members (obj, "", NULL, set_remove_members, NULL, set_remote_pending, 0, priv->invited ? TP_CHANNEL_GROUP_CHANGE_REASON_INVITED @@ -4142,7 +4164,7 @@ sent_subject_cb ( } static void -gabble_muc_channel_set_subject (TpSvcChannelInterfaceSubject *iface, +gabble_muc_channel_set_subject (TpSvcChannelInterfaceSubject1 *iface, const gchar *subject, DBusGMethodInvocation *context) { @@ -4203,10 +4225,10 @@ gabble_muc_channel_set_subject (TpSvcChannelInterfaceSubject *iface, static void password_iface_init (gpointer g_iface, gpointer iface_data) { - TpSvcChannelInterfacePasswordClass *klass = - (TpSvcChannelInterfacePasswordClass *) g_iface; + TpSvcChannelInterfacePassword1Class *klass = + (TpSvcChannelInterfacePassword1Class *) g_iface; -#define IMPLEMENT(x) tp_svc_channel_interface_password_implement_##x (\ +#define IMPLEMENT(x) tp_svc_channel_interface_password1_implement_##x (\ klass, gabble_muc_channel_##x) IMPLEMENT(get_password_flags); IMPLEMENT(provide_password); @@ -4216,10 +4238,10 @@ password_iface_init (gpointer g_iface, gpointer iface_data) static void subject_iface_init (gpointer g_iface, gpointer iface_data) { - TpSvcChannelInterfaceSubjectClass *klass = - (TpSvcChannelInterfaceSubjectClass *) g_iface; + TpSvcChannelInterfaceSubject1Class *klass = + (TpSvcChannelInterfaceSubject1Class *) g_iface; -#define IMPLEMENT(x) tp_svc_channel_interface_subject_implement_##x (\ +#define IMPLEMENT(x) tp_svc_channel_interface_subject1_implement_##x (\ klass, gabble_muc_channel_##x) IMPLEMENT(set_subject); #undef IMPLEMENT diff --git a/src/muc-factory.c b/src/muc-factory.c index 39f468509..2636d8ffa 100644 --- a/src/muc-factory.c +++ b/src/muc-factory.c @@ -33,7 +33,6 @@ #include "gabble/caps-channel-manager.h" #include "connection.h" -#include "conn-olpc.h" #include "debug.h" #include "disco.h" #include "im-channel.h" @@ -238,15 +237,15 @@ muc_channel_closed_cb (GabbleMucChannel *chan, gpointer user_data) /* channel is actually reappearing, announce it */ if (tp_base_channel_is_respawning (base)) { - tp_channel_manager_emit_new_channel (fac, + tp_channel_manager_emit_new_channel (TP_CHANNEL_MANAGER (fac), TP_EXPORTABLE_CHANNEL (chan), NULL); return; } if (tp_base_channel_is_registered (base)) { - tp_channel_manager_emit_channel_closed_for_object (fac, - TP_EXPORTABLE_CHANNEL (chan)); + tp_channel_manager_emit_channel_closed_for_object ( + TP_CHANNEL_MANAGER (fac), TP_EXPORTABLE_CHANNEL (chan)); } if (tp_base_channel_is_destroyed (base) @@ -282,7 +281,7 @@ muc_ready_cb (GabbleMucChannel *text_chan, * have to be) */ if (tp_base_channel_is_registered (base)) { - tp_channel_manager_emit_new_channel (fac, + tp_channel_manager_emit_new_channel (TP_CHANNEL_MANAGER (fac), TP_EXPORTABLE_CHANNEL (text_chan), requests_satisfied_text); } @@ -304,7 +303,8 @@ muc_ready_cb (GabbleMucChannel *text_chan, requests_satisfied_tube = g_slist_reverse (requests_satisfied_tube); - tp_channel_manager_emit_new_channel (fac, tube_chan, + tp_channel_manager_emit_new_channel (TP_CHANNEL_MANAGER (fac), + tube_chan, requests_satisfied_tube); g_slist_free (requests_satisfied_tube); } @@ -332,8 +332,8 @@ muc_join_error_cb (GabbleMucChannel *chan, for (iter = requests_satisfied; iter != NULL; iter = iter->next) { - tp_channel_manager_emit_request_failed (fac, iter->data, - error->domain, error->code, error->message); + tp_channel_manager_emit_request_failed (TP_CHANNEL_MANAGER (fac), + iter->data, error->domain, error->code, error->message); } g_slist_free (requests_satisfied); @@ -356,8 +356,8 @@ muc_join_error_cb (GabbleMucChannel *chan, for (iter = requests_satisfied; iter != NULL; iter = iter->next) { - tp_channel_manager_emit_request_failed (fac, iter->data, - error->domain, error->code, error->message); + tp_channel_manager_emit_request_failed (TP_CHANNEL_MANAGER (fac), + iter->data, error->domain, error->code, error->message); } g_slist_free (requests_satisfied); @@ -374,7 +374,7 @@ muc_sub_channel_closed_cb (TpSvcChannel *chan, GabbleMucFactory *fac = GABBLE_MUC_FACTORY (user_data); GabbleMucChannel *muc; - tp_channel_manager_emit_channel_closed_for_object (fac, + tp_channel_manager_emit_channel_closed_for_object (TP_CHANNEL_MANAGER (fac), TP_EXPORTABLE_CHANNEL (chan)); /* GabbleTubeDBus, GabbleTubeStream, and GabbleMucCallChannel all @@ -402,7 +402,7 @@ muc_channel_new_call (GabbleMucChannel *muc, DEBUG ("Emitting new Call channel"); - tp_channel_manager_emit_new_channel (fac, + tp_channel_manager_emit_new_channel (TP_CHANNEL_MANAGER (fac), TP_EXPORTABLE_CHANNEL (call), requests); g_signal_connect (call, "closed", @@ -420,7 +420,7 @@ muc_channel_new_tube (GabbleMucChannel *channel, /* If the muc channel is ready announce the tube channel right away * otherwise wait for the text channel to be ready */ if (_gabble_muc_channel_is_ready (channel)) - tp_channel_manager_emit_new_channel (fac, + tp_channel_manager_emit_new_channel (TP_CHANNEL_MANAGER (fac), TP_EXPORTABLE_CHANNEL (tube), NULL); else gabble_muc_factory_associate_tube (fac, channel, tube); @@ -524,7 +524,7 @@ do_invite (GabbleMucFactory *fac, { GabbleMucFactoryPrivate *priv = fac->priv; TpHandleRepoIface *room_repo = tp_base_connection_get_handles ( - (TpBaseConnection *) priv->conn, TP_HANDLE_TYPE_ROOM); + (TpBaseConnection *) priv->conn, TP_ENTITY_TYPE_ROOM); TpHandle room_handle; room_handle = tp_handle_ensure (room_repo, room, NULL, NULL); @@ -616,7 +616,7 @@ process_muc_invite (GabbleMucFactory *fac, GabbleMucFactoryPrivate *priv = fac->priv; TpBaseConnection *conn = (TpBaseConnection *) priv->conn; TpHandleRepoIface *contact_repo = tp_base_connection_get_handles (conn, - TP_HANDLE_TYPE_CONTACT); + TP_ENTITY_TYPE_CONTACT); WockyNode *x_node, *invite_node, *reason_node; const gchar *invite_from, *reason = NULL; @@ -688,7 +688,7 @@ process_obsolete_invite (GabbleMucFactory *fac, GabbleMucFactoryPrivate *priv = fac->priv; TpBaseConnection *conn = (TpBaseConnection *) priv->conn; TpHandleRepoIface *contact_repo = tp_base_connection_get_handles (conn, - TP_HANDLE_TYPE_CONTACT); + TP_ENTITY_TYPE_CONTACT); WockyNode *x_node; const gchar *room; @@ -772,7 +772,6 @@ muc_factory_message_cb ( gpointer user_data) { GabbleMucFactory *fac = GABBLE_MUC_FACTORY (user_data); - GabbleMucFactoryPrivate *priv = fac->priv; const gchar *from, *body, *id; time_t stamp; @@ -785,14 +784,6 @@ muc_factory_message_cb ( &msgtype, &id, &body, &state, &send_error, &delivery_status)) return TRUE; - if (conn_olpc_process_activity_properties_message (priv->conn, message, - from)) - return TRUE; - - if (conn_olpc_process_activity_uninvite_message (priv->conn, message, - from)) - return TRUE; - if (process_muc_invite (fac, message, from, send_error)) return TRUE; @@ -870,7 +861,7 @@ cancel_queued_requests ( for (iter = requests_satisfied; iter != NULL; iter = iter->next) { - tp_channel_manager_emit_request_failed (self, + tp_channel_manager_emit_request_failed (TP_CHANNEL_MANAGER (self), iter->data, TP_ERROR, TP_ERROR_DISCONNECTED, "Unable to complete this channel request, we're disconnecting!"); } @@ -1065,7 +1056,7 @@ gabble_muc_factory_handle_si_stream_request (GabbleMucFactory *self, { GabbleMucFactoryPrivate *priv = self->priv; TpHandleRepoIface *room_repo = tp_base_connection_get_handles ( - (TpBaseConnection *) priv->conn, TP_HANDLE_TYPE_ROOM); + (TpBaseConnection *) priv->conn, TP_ENTITY_TYPE_ROOM); GabbleMucChannel *gmuc = NULL; WockyStanzaType stanza_type; WockyStanzaSubType sub_type; @@ -1104,7 +1095,7 @@ gabble_muc_factory_find_text_channel (GabbleMucFactory *self, static const gchar * const muc_channel_fixed_properties[] = { TP_PROP_CHANNEL_CHANNEL_TYPE, - TP_PROP_CHANNEL_TARGET_HANDLE_TYPE, + TP_PROP_CHANNEL_TARGET_ENTITY_TYPE, NULL }; @@ -1114,12 +1105,12 @@ static const gchar * const * muc_tubes_channel_fixed_properties = static const gchar * const muc_channel_allowed_properties[] = { TP_PROP_CHANNEL_TARGET_HANDLE, TP_PROP_CHANNEL_TARGET_ID, - TP_PROP_CHANNEL_INTERFACE_CONFERENCE_INITIAL_CHANNELS, - TP_PROP_CHANNEL_INTERFACE_CONFERENCE_INITIAL_INVITEE_HANDLES, - TP_PROP_CHANNEL_INTERFACE_CONFERENCE_INITIAL_INVITEE_IDS, - TP_PROP_CHANNEL_INTERFACE_CONFERENCE_INVITATION_MESSAGE, - TP_PROP_CHANNEL_INTERFACE_ROOM_ROOM_NAME, - TP_PROP_CHANNEL_INTERFACE_ROOM_SERVER, + TP_PROP_CHANNEL_INTERFACE_CONFERENCE1_INITIAL_CHANNELS, + TP_PROP_CHANNEL_INTERFACE_CONFERENCE1_INITIAL_INVITEE_HANDLES, + TP_PROP_CHANNEL_INTERFACE_CONFERENCE1_INITIAL_INVITEE_IDS, + TP_PROP_CHANNEL_INTERFACE_CONFERENCE1_INVITATION_MESSAGE, + TP_PROP_CHANNEL_INTERFACE_ROOM1_ROOM_NAME, + TP_PROP_CHANNEL_INTERFACE_ROOM1_SERVER, NULL }; @@ -1138,8 +1129,8 @@ gabble_muc_factory_type_foreach_channel_class (GType type, channel_type_value); handle_type_value = tp_g_value_slice_new (G_TYPE_UINT); - g_value_set_uint (handle_type_value, TP_HANDLE_TYPE_ROOM); - g_hash_table_insert (table, TP_PROP_CHANNEL_TARGET_HANDLE_TYPE, + g_value_set_uint (handle_type_value, TP_ENTITY_TYPE_ROOM); + g_hash_table_insert (table, TP_PROP_CHANNEL_TARGET_ENTITY_TYPE, handle_type_value); /* Channel.Type.Text */ @@ -1149,20 +1140,20 @@ gabble_muc_factory_type_foreach_channel_class (GType type, /* Muc Channel.Type.StreamTube */ g_value_set_static_string (channel_type_value, - TP_IFACE_CHANNEL_TYPE_STREAM_TUBE); + TP_IFACE_CHANNEL_TYPE_STREAM_TUBE1); func (type, table, gabble_tube_stream_channel_get_allowed_properties (), user_data); /* Muc Channel.Type.DBusTube */ g_value_set_static_string (channel_type_value, - TP_IFACE_CHANNEL_TYPE_DBUS_TUBE); + TP_IFACE_CHANNEL_TYPE_DBUS_TUBE1); func (type, table, gabble_tube_dbus_channel_get_allowed_properties (), user_data); #ifdef ENABLE_VOIP /* Muc Channel.Type.Call */ g_value_set_static_string (channel_type_value, - TP_IFACE_CHANNEL_TYPE_CALL); + TP_IFACE_CHANNEL_TYPE_CALL1); func (type, table, gabble_media_factory_call_channel_allowed_properties (), user_data); @@ -1188,9 +1179,9 @@ handle_text_channel_request (GabbleMucFactory *self, gboolean ret = TRUE; TpHandleRepoIface *contact_handles = tp_base_connection_get_handles (conn, - TP_HANDLE_TYPE_CONTACT); + TP_ENTITY_TYPE_CONTACT); TpHandleRepoIface *room_handles = tp_base_connection_get_handles (conn, - TP_HANDLE_TYPE_ROOM); + TP_ENTITY_TYPE_ROOM); GPtrArray *initial_channels; GHashTable *final_channels; /* used as a set: (char *) -> NULL */ @@ -1206,21 +1197,21 @@ handle_text_channel_request (GabbleMucFactory *self, return FALSE; initial_channels = tp_asv_get_boxed (request_properties, - TP_PROP_CHANNEL_INTERFACE_CONFERENCE_INITIAL_CHANNELS, + TP_PROP_CHANNEL_INTERFACE_CONFERENCE1_INITIAL_CHANNELS, TP_ARRAY_TYPE_OBJECT_PATH_LIST); initial_handles = tp_asv_get_boxed (request_properties, - TP_PROP_CHANNEL_INTERFACE_CONFERENCE_INITIAL_INVITEE_HANDLES, + TP_PROP_CHANNEL_INTERFACE_CONFERENCE1_INITIAL_INVITEE_HANDLES, DBUS_TYPE_G_UINT_ARRAY); initial_ids = tp_asv_get_boxed (request_properties, - TP_PROP_CHANNEL_INTERFACE_CONFERENCE_INITIAL_INVITEE_IDS, + TP_PROP_CHANNEL_INTERFACE_CONFERENCE1_INITIAL_INVITEE_IDS, G_TYPE_STRV); invite_msg = tp_asv_get_string (request_properties, - TP_PROP_CHANNEL_INTERFACE_CONFERENCE_INVITATION_MESSAGE); + TP_PROP_CHANNEL_INTERFACE_CONFERENCE1_INVITATION_MESSAGE); room_name = tp_asv_get_string (request_properties, - TP_PROP_CHANNEL_INTERFACE_ROOM_ROOM_NAME); + TP_PROP_CHANNEL_INTERFACE_ROOM1_ROOM_NAME); server_prop = tp_asv_get_string (request_properties, - TP_PROP_CHANNEL_INTERFACE_ROOM_SERVER); + TP_PROP_CHANNEL_INTERFACE_ROOM1_SERVER); handles = tp_handle_set_new (contact_handles); continue_handles = tp_intset_new (); @@ -1317,7 +1308,7 @@ handle_text_channel_request (GabbleMucFactory *self, final_ids[i] = (char *) id; } - /* TargetHandleType=None and TargetHandle=0 */ + /* TargetEntityType=None and TargetHandle=0 */ if (room == 0) { char *uuid, *id, *server = ""; @@ -1461,8 +1452,9 @@ handle_text_channel_request (GabbleMucFactory *self, { if (tp_base_channel_is_registered (TP_BASE_CHANNEL (text_chan))) { - tp_channel_manager_emit_request_already_satisfied (self, - request_token, TP_EXPORTABLE_CHANNEL (text_chan)); + tp_channel_manager_emit_request_already_satisfied ( + TP_CHANNEL_MANAGER (self), request_token, + TP_EXPORTABLE_CHANNEL (text_chan)); } else { @@ -1471,7 +1463,8 @@ handle_text_channel_request (GabbleMucFactory *self, tp_base_channel_register (TP_BASE_CHANNEL (text_chan)); tokens = g_slist_append (NULL, request_token); - tp_channel_manager_emit_new_channel (self, + tp_channel_manager_emit_new_channel ( + TP_CHANNEL_MANAGER (self), TP_EXPORTABLE_CHANNEL (text_chan), tokens); g_slist_free (tokens); } @@ -1558,7 +1551,7 @@ handle_tube_channel_request (GabbleMucFactory *self, request_tokens = g_slist_prepend (NULL, request_token); - tp_channel_manager_emit_new_channel (self, + tp_channel_manager_emit_new_channel (TP_CHANNEL_MANAGER (self), TP_EXPORTABLE_CHANNEL (new_channel), request_tokens); g_slist_free (request_tokens); @@ -1594,12 +1587,12 @@ handle_stream_tube_channel_request (GabbleMucFactory *self, /* "Service" is a mandatory, not-fixed property */ service = tp_asv_get_string (request_properties, - TP_PROP_CHANNEL_TYPE_STREAM_TUBE_SERVICE); + TP_PROP_CHANNEL_TYPE_STREAM_TUBE1_SERVICE); if (service == NULL) { g_set_error (error, TP_ERROR, TP_ERROR_NOT_IMPLEMENTED, "Request does not contain the mandatory property '%s'", - TP_PROP_CHANNEL_TYPE_STREAM_TUBE_SERVICE); + TP_PROP_CHANNEL_TYPE_STREAM_TUBE1_SERVICE); return FALSE; } @@ -1625,12 +1618,12 @@ handle_dbus_tube_channel_request (GabbleMucFactory *self, /* "ServiceName" is a mandatory, not-fixed property */ service = tp_asv_get_string (request_properties, - TP_PROP_CHANNEL_TYPE_DBUS_TUBE_SERVICE_NAME); + TP_PROP_CHANNEL_TYPE_DBUS_TUBE1_SERVICE_NAME); if (service == NULL) { g_set_error (error, TP_ERROR, TP_ERROR_NOT_IMPLEMENTED, "Request does not contain the mandatory property '%s'", - TP_PROP_CHANNEL_TYPE_DBUS_TUBE_SERVICE_NAME); + TP_PROP_CHANNEL_TYPE_DBUS_TUBE1_SERVICE_NAME); return FALSE; } @@ -1653,7 +1646,7 @@ call_muc_channel_request_cb (GObject *source, if (!gabble_muc_channel_request_call_finish (channel, result, &error)) { - tp_channel_manager_emit_request_failed (self, + tp_channel_manager_emit_request_failed (TP_CHANNEL_MANAGER (self), request_token, error->domain, error->code, error->message); g_error_free (error); } @@ -1686,9 +1679,9 @@ handle_call_channel_request (GabbleMucFactory *self, return FALSE; initial_audio = tp_asv_get_boolean (request_properties, - TP_PROP_CHANNEL_TYPE_CALL_INITIAL_AUDIO, NULL); + TP_PROP_CHANNEL_TYPE_CALL1_INITIAL_AUDIO, NULL); initial_video = tp_asv_get_boolean (request_properties, - TP_PROP_CHANNEL_TYPE_CALL_INITIAL_VIDEO, NULL); + TP_PROP_CHANNEL_TYPE_CALL1_INITIAL_VIDEO, NULL); if (!initial_audio && !initial_video) { @@ -1711,9 +1704,9 @@ handle_call_channel_request (GabbleMucFactory *self, } else { - tp_channel_manager_emit_request_already_satisfied (self, - request_token, - TP_EXPORTABLE_CHANNEL (call)); + tp_channel_manager_emit_request_already_satisfied ( + TP_CHANNEL_MANAGER (self), request_token, + TP_EXPORTABLE_CHANNEL (call)); goto out; } } @@ -1752,10 +1745,10 @@ typedef struct { static ChannelTypeHandler channel_type_handlers[] = { { TP_IFACE_CHANNEL_TYPE_TEXT, handle_text_channel_request }, - { TP_IFACE_CHANNEL_TYPE_STREAM_TUBE, handle_stream_tube_channel_request }, - { TP_IFACE_CHANNEL_TYPE_DBUS_TUBE, handle_dbus_tube_channel_request }, + { TP_IFACE_CHANNEL_TYPE_STREAM_TUBE1, handle_stream_tube_channel_request }, + { TP_IFACE_CHANNEL_TYPE_DBUS_TUBE1, handle_dbus_tube_channel_request }, #ifdef ENABLE_VOIP - { TP_IFACE_CHANNEL_TYPE_CALL, handle_call_channel_request }, + { TP_IFACE_CHANNEL_TYPE_CALL1, handle_call_channel_request }, #endif { NULL } }; @@ -1767,34 +1760,34 @@ gabble_muc_factory_request (GabbleMucFactory *self, gboolean require_new) { GError *error = NULL; - TpHandleType handle_type; + TpEntityType handle_type; TpHandle handle; gboolean conference, room; const gchar *channel_type; ChannelTypeHandler *h; handle_type = tp_asv_get_uint32 (request_properties, - TP_PROP_CHANNEL_TARGET_HANDLE_TYPE, NULL); + TP_PROP_CHANNEL_TARGET_ENTITY_TYPE, NULL); channel_type = tp_asv_get_string (request_properties, TP_PROP_CHANNEL_CHANNEL_TYPE); /* Conference channels can be anonymous (HandleTypeNone) */ - conference = (handle_type == TP_HANDLE_TYPE_NONE && + conference = (handle_type == TP_ENTITY_TYPE_NONE && !tp_strdiff (channel_type, TP_IFACE_CHANNEL_TYPE_TEXT) && (g_hash_table_lookup (request_properties, - TP_PROP_CHANNEL_INTERFACE_CONFERENCE_INITIAL_CHANNELS) || + TP_PROP_CHANNEL_INTERFACE_CONFERENCE1_INITIAL_CHANNELS) || g_hash_table_lookup (request_properties, - TP_PROP_CHANNEL_INTERFACE_CONFERENCE_INITIAL_INVITEE_HANDLES) || + TP_PROP_CHANNEL_INTERFACE_CONFERENCE1_INITIAL_INVITEE_HANDLES) || g_hash_table_lookup (request_properties, - TP_PROP_CHANNEL_INTERFACE_CONFERENCE_INITIAL_INVITEE_IDS))); + TP_PROP_CHANNEL_INTERFACE_CONFERENCE1_INITIAL_INVITEE_IDS))); - room = (handle_type == TP_HANDLE_TYPE_NONE + room = (handle_type == TP_ENTITY_TYPE_NONE && !tp_strdiff (channel_type, TP_IFACE_CHANNEL_TYPE_TEXT) && g_hash_table_lookup (request_properties, - TP_PROP_CHANNEL_INTERFACE_ROOM_ROOM_NAME)); + TP_PROP_CHANNEL_INTERFACE_ROOM1_ROOM_NAME)); /* the channel must either be a room, or a new conference */ - if (handle_type != TP_HANDLE_TYPE_ROOM && !conference && !room) + if (handle_type != TP_ENTITY_TYPE_ROOM && !conference && !room) return FALSE; /* validity already checked by TpBaseConnection */ @@ -1810,8 +1803,8 @@ gabble_muc_factory_request (GabbleMucFactory *self, if (!h->f (self, request_token, request_properties, require_new, handle, &error)) { - tp_channel_manager_emit_request_failed (self, request_token, - error->domain, error->code, error->message); + tp_channel_manager_emit_request_failed (TP_CHANNEL_MANAGER (self), + request_token, error->domain, error->code, error->message); g_error_free (error); } @@ -1825,36 +1818,24 @@ gabble_muc_factory_request (GabbleMucFactory *self, static gboolean gabble_muc_factory_create_channel (TpChannelManager *manager, - gpointer request_token, - GHashTable *request_properties) + TpChannelManagerRequest *request, + GHashTable *request_properties) { GabbleMucFactory *self = GABBLE_MUC_FACTORY (manager); - return gabble_muc_factory_request (self, request_token, request_properties, + return gabble_muc_factory_request (self, request, request_properties, TRUE); } static gboolean -gabble_muc_factory_request_channel (TpChannelManager *manager, - gpointer request_token, - GHashTable *request_properties) -{ - GabbleMucFactory *self = GABBLE_MUC_FACTORY (manager); - - return gabble_muc_factory_request (self, request_token, request_properties, - FALSE); -} - - -static gboolean gabble_muc_factory_ensure_channel (TpChannelManager *manager, - gpointer request_token, - GHashTable *request_properties) + TpChannelManagerRequest *request, + GHashTable *request_properties) { GabbleMucFactory *self = GABBLE_MUC_FACTORY (manager); - return gabble_muc_factory_request (self, request_token, request_properties, + return gabble_muc_factory_request (self, request, request_properties, FALSE); } @@ -1865,7 +1846,7 @@ gabble_muc_factory_handle_jingle_session (GabbleMucFactory *self, { GabbleMucFactoryPrivate *priv = self->priv; TpHandleRepoIface *room_repo = tp_base_connection_get_handles ( - (TpBaseConnection *) priv->conn, TP_HANDLE_TYPE_ROOM); + (TpBaseConnection *) priv->conn, TP_ENTITY_TYPE_ROOM); TpHandle room; room = gabble_get_room_handle_from_jid (room_repo, @@ -1895,7 +1876,6 @@ channel_manager_iface_init (gpointer g_iface, iface->foreach_channel = gabble_muc_factory_foreach_channel; iface->type_foreach_channel_class = gabble_muc_factory_type_foreach_channel_class; - iface->request_channel = gabble_muc_factory_request_channel; iface->create_channel = gabble_muc_factory_create_channel; iface->ensure_channel = gabble_muc_factory_ensure_channel; } diff --git a/src/muc-tube-dbus.c b/src/muc-tube-dbus.c index 6ba1d827f..28e9d9bd8 100644 --- a/src/muc-tube-dbus.c +++ b/src/muc-tube-dbus.c @@ -32,7 +32,7 @@ gabble_muc_tube_dbus_get_interfaces (TpBaseChannel *base) interfaces = TP_BASE_CHANNEL_CLASS ( gabble_muc_tube_dbus_parent_class)->get_interfaces (base); - g_ptr_array_add (interfaces, TP_IFACE_CHANNEL_INTERFACE_GROUP); + g_ptr_array_add (interfaces, TP_IFACE_CHANNEL_INTERFACE_GROUP1); return interfaces; } @@ -50,5 +50,5 @@ gabble_muc_tube_dbus_class_init ( gabble_muc_tube_dbus_class); base_class->get_interfaces = gabble_muc_tube_dbus_get_interfaces; - base_class->target_handle_type = TP_HANDLE_TYPE_ROOM; + base_class->target_entity_type = TP_ENTITY_TYPE_ROOM; } diff --git a/src/muc-tube-stream.c b/src/muc-tube-stream.c index 96448ab2b..53fd0b5bd 100644 --- a/src/muc-tube-stream.c +++ b/src/muc-tube-stream.c @@ -32,7 +32,7 @@ gabble_muc_tube_stream_get_interfaces (TpBaseChannel *base) interfaces = TP_BASE_CHANNEL_CLASS ( gabble_muc_tube_stream_parent_class)->get_interfaces (base); - g_ptr_array_add (interfaces, TP_IFACE_CHANNEL_INTERFACE_GROUP); + g_ptr_array_add (interfaces, TP_IFACE_CHANNEL_INTERFACE_GROUP1); return interfaces; } @@ -50,5 +50,5 @@ gabble_muc_tube_stream_class_init ( gabble_muc_tube_stream_class); base_class->get_interfaces = gabble_muc_tube_stream_get_interfaces; - base_class->target_handle_type = TP_HANDLE_TYPE_ROOM; + base_class->target_entity_type = TP_ENTITY_TYPE_ROOM; } diff --git a/src/namespaces.h b/src/namespaces.h index 2a2d8f91b..705a0b4c6 100644 --- a/src/namespaces.h +++ b/src/namespaces.h @@ -93,12 +93,6 @@ #define NS_MUC_OWNER "http://jabber.org/protocol/muc#owner" #define NS_NICK "http://jabber.org/protocol/nick" #define NS_OOB "jabber:iq:oob" -#define NS_OLPC_BUDDY_PROPS "http://laptop.org/xmpp/buddy-properties" -#define NS_OLPC_ACTIVITIES "http://laptop.org/xmpp/activities" -#define NS_OLPC_CURRENT_ACTIVITY "http://laptop.org/xmpp/current-activity" -#define NS_OLPC_ACTIVITY_PROPS "http://laptop.org/xmpp/activity-properties" -#define NS_OLPC_BUDDY "http://laptop.org/xmpp/buddy" -#define NS_OLPC_ACTIVITY "http://laptop.org/xmpp/activity" #define NS_PUBSUB "http://jabber.org/protocol/pubsub" #define NS_PRESENCE_INVISIBLE "presence-invisible" #define NS_PRIVACY "jabber:iq:privacy" diff --git a/src/olpc-activity.c b/src/olpc-activity.c deleted file mode 100644 index a5f34a581..000000000 --- a/src/olpc-activity.c +++ /dev/null @@ -1,260 +0,0 @@ -/* - * olpc-activity.c - Source for GabbleOlpcActivity - * Copyright (C) 2008 Collabora Ltd. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include "config.h" - -#include "olpc-activity.h" - -#include <stdlib.h> -#include <string.h> - -#include <glib.h> - -#define DEBUG_FLAG GABBLE_DEBUG_OLPC - -#include "debug.h" -#include "extensions/extensions.h" -#include "gabble-signals-marshal.h" -#include "namespaces.h" -#include "util.h" - -/* properties */ -enum -{ - PROP_CONNECTION = 1, - PROP_ROOM, - PROP_ID, - PROP_PROPERTIES, - LAST_PROPERTY -}; - -struct _GabbleOlpcActivityPrivate -{ - GabbleConnection *conn; - - gboolean dispose_has_run; -}; - -G_DEFINE_TYPE (GabbleOlpcActivity, gabble_olpc_activity, G_TYPE_OBJECT); - -static void -gabble_olpc_activity_init (GabbleOlpcActivity *self) -{ - GabbleOlpcActivityPrivate *priv = G_TYPE_INSTANCE_GET_PRIVATE (self, - GABBLE_TYPE_OLPC_ACTIVITY, GabbleOlpcActivityPrivate); - - self->priv = priv; - - priv->dispose_has_run = FALSE; -} - -static void -gabble_olpc_activity_finalize (GObject *object) -{ - GabbleOlpcActivity *self = GABBLE_OLPC_ACTIVITY (object); - - if (self->id != NULL) - { - g_free (self->id); - self->id = NULL; - } - - if (self->properties != NULL) - { - g_hash_table_unref (self->properties); - self->properties = NULL; - } - - G_OBJECT_CLASS (gabble_olpc_activity_parent_class)->finalize (object); -} - -static void -gabble_olpc_activity_get_property (GObject *object, - guint property_id, - GValue *value, - GParamSpec *pspec) -{ - GabbleOlpcActivity *self = GABBLE_OLPC_ACTIVITY (object); - GabbleOlpcActivityPrivate *priv = self->priv; - - switch (property_id) - { - case PROP_CONNECTION: - g_value_set_object (value, priv->conn); - break; - case PROP_ROOM: - g_value_set_uint (value, self->room); - break; - case PROP_ID: - g_value_set_string (value, self->id); - break; - case PROP_PROPERTIES: - g_value_set_boxed (value, self->properties); - break; - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); - break; - } -} - -static void -gabble_olpc_activity_set_property (GObject *object, - guint property_id, - const GValue *value, - GParamSpec *pspec) -{ - GabbleOlpcActivity *self = GABBLE_OLPC_ACTIVITY (object); - GabbleOlpcActivityPrivate *priv = self->priv; - - switch (property_id) - { - case PROP_CONNECTION: - priv->conn = g_value_get_object (value); - break; - case PROP_ROOM: - self->room = g_value_get_uint (value); - break; - case PROP_ID: - g_free (self->id); - self->id = g_value_dup_string (value); - break; - case PROP_PROPERTIES: - if (self->properties != NULL) - g_hash_table_unref (self->properties); - - self->properties = g_value_get_boxed (value); - break; - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); - break; - } -} - -static GObject * -gabble_olpc_activity_constructor (GType type, - guint n_props, - GObjectConstructParam *props) -{ - GObject *obj; - GabbleOlpcActivity *self; - - obj = G_OBJECT_CLASS (gabble_olpc_activity_parent_class)-> - constructor (type, n_props, props); - - self = GABBLE_OLPC_ACTIVITY (obj); - - g_assert (self->room != 0); - - DEBUG ("new activity %s (%d)", gabble_olpc_activity_get_room (self), - self->room); - - return obj; -} - -static void -gabble_olpc_activity_class_init ( - GabbleOlpcActivityClass *gabble_olpc_activity_class) -{ - GObjectClass *object_class = G_OBJECT_CLASS (gabble_olpc_activity_class); - GParamSpec *param_spec; - - object_class->get_property = gabble_olpc_activity_get_property; - object_class->set_property = gabble_olpc_activity_set_property; - object_class->constructor = gabble_olpc_activity_constructor; - - g_type_class_add_private (gabble_olpc_activity_class, - sizeof (GabbleOlpcActivityPrivate)); - - object_class->finalize = gabble_olpc_activity_finalize; - - param_spec = g_param_spec_object ( - "connection", - "GabbleConnection object", - "Gabble connection object that owns this activity object.", - GABBLE_TYPE_CONNECTION, - G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS); - g_object_class_install_property (object_class, PROP_CONNECTION, param_spec); - - param_spec = g_param_spec_uint ( - "room", - "activity room", - "a TpHandle representing the activity room", - 0, G_MAXUINT, 0, - G_PARAM_CONSTRUCT | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS); - g_object_class_install_property (object_class, PROP_ROOM, param_spec); - - param_spec = g_param_spec_string ( - "id", - "activity id", - "the activity ID", - NULL, - G_PARAM_CONSTRUCT | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS); - g_object_class_install_property (object_class, PROP_ID, param_spec); - - param_spec = g_param_spec_boxed ( - "properties", - "activity properties", - "a GHashTable containing activity's properties", - G_TYPE_HASH_TABLE, - G_PARAM_CONSTRUCT | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS); - g_object_class_install_property (object_class, PROP_PROPERTIES, param_spec); -} - -GabbleOlpcActivity * -gabble_olpc_activity_new (GabbleConnection *conn, - TpHandle room) -{ - return g_object_new (GABBLE_TYPE_OLPC_ACTIVITY, - "connection", conn, - "room", room, - NULL); -} - -const gchar * -gabble_olpc_activity_get_room (GabbleOlpcActivity *self) -{ - TpHandleRepoIface *room_repo = tp_base_connection_get_handles ( - (TpBaseConnection *) self->priv->conn, - TP_HANDLE_TYPE_ROOM); - - return tp_handle_inspect (room_repo, self->room); -} - -gboolean -gabble_olpc_activity_is_visible (GabbleOlpcActivity *self) -{ - GValue *gv; - - /* false if incomplete */ - if (self->id == NULL || self->properties == NULL) - return FALSE; - - gv = g_hash_table_lookup (self->properties, "private"); - if (gv == NULL) - { - return FALSE; - } - - /* if they put something non-boolean in it, err on the side of privacy */ - if (!G_VALUE_HOLDS_BOOLEAN (gv)) - return FALSE; - - /* if they specified a privacy level, go with it */ - return !g_value_get_boolean (gv); -} diff --git a/src/olpc-activity.h b/src/olpc-activity.h deleted file mode 100644 index 4c08df6cf..000000000 --- a/src/olpc-activity.h +++ /dev/null @@ -1,77 +0,0 @@ -/* - * olpc-activity.h - Header for GabbleOlpcActivity - * Copyright (C) 2008 Collabora Ltd. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef __GABBLE_OLPC_ACTIVITY_H__ -#define __GABBLE_OLPC_ACTIVITY_H__ - -#include <glib-object.h> - -#include <telepathy-glib/telepathy-glib.h> - -#include "connection.h" - -G_BEGIN_DECLS - -typedef struct _GabbleOlpcActivity GabbleOlpcActivity; -typedef struct _GabbleOlpcActivityClass GabbleOlpcActivityClass; -typedef struct _GabbleOlpcActivityPrivate GabbleOlpcActivityPrivate; - -struct _GabbleOlpcActivityClass { - GObjectClass parent_class; -}; - -struct _GabbleOlpcActivity { - GObject parent; - - TpHandle room; - gchar *id; - GHashTable *properties; - - GabbleOlpcActivityPrivate *priv; -}; - -GType gabble_olpc_activity_get_type (void); - -/* TYPE MACROS */ -#define GABBLE_TYPE_OLPC_ACTIVITY \ - (gabble_olpc_activity_get_type ()) -#define GABBLE_OLPC_ACTIVITY(obj) \ - (G_TYPE_CHECK_INSTANCE_CAST((obj), GABBLE_TYPE_OLPC_ACTIVITY,\ - GabbleOlpcActivity)) -#define GABBLE_OLPC_ACTIVITY_CLASS(klass) \ - (G_TYPE_CHECK_CLASS_CAST((klass), GABBLE_TYPE_OLPC_ACTIVITY,\ - GabbleOlpcActivityClass)) -#define GABBLE_IS_OLPC_ACTIVITY(obj) \ - (G_TYPE_CHECK_INSTANCE_TYPE((obj), GABBLE_TYPE_OLPC_ACTIVITY)) -#define GABBLE_IS_OLPC_ACTIVITY_CLASS(klass) \ - (G_TYPE_CHECK_CLASS_TYPE((klass), GABBLE_TYPE_OLPC_ACTIVITY)) -#define GABBLE_OLPC_ACTIVITY_GET_CLASS(obj) \ - (G_TYPE_INSTANCE_GET_CLASS ((obj), GABBLE_TYPE_OLPC_ACTIVITY,\ - GabbleOlpcActivityClass)) - -GabbleOlpcActivity * gabble_olpc_activity_new (GabbleConnection *conn, - TpHandle room); - -const gchar * gabble_olpc_activity_get_room (GabbleOlpcActivity *activity); - -gboolean gabble_olpc_activity_is_visible (GabbleOlpcActivity *activity); - -G_END_DECLS - -#endif /* #ifndef __GABBLE_OLPC_ACTIVITY_H__ */ diff --git a/src/presence-cache.c b/src/presence-cache.c index f7d02eecf..8e8834ca5 100644 --- a/src/presence-cache.c +++ b/src/presence-cache.c @@ -55,10 +55,6 @@ * got initial presence from all the contacts. */ #define UNSURE_PERIOD 5 -/* Time period from a de-cloak request in which we're unsure whether the - * contact will disclose their presence later, or not at all. */ -#define DECLOAK_PERIOD 5 - G_DEFINE_TYPE (GabblePresenceCache, gabble_presence_cache, G_TYPE_OBJECT); /* properties */ @@ -100,9 +96,6 @@ struct _GabblePresenceCachePrivate guint caps_serial; guint unsure_id; - /* handle => DecloakContext */ - GHashTable *decloak_requests; - TpHandleSet *decloak_handles; /* The cached contacts' location. * The key is the contact's TpHandle. @@ -309,40 +302,6 @@ capability_info_recvd (GabblePresenceCache *cache, return info->trust; } -typedef struct { - GabblePresenceCache *cache; - TpHandle handle; - guint timeout_id; - const gchar *reason; -} DecloakContext; - -static DecloakContext * -decloak_context_new (GabblePresenceCache *cache, - TpHandle handle, - const gchar *reason) -{ - DecloakContext *dc = g_slice_new0 (DecloakContext); - - dc->cache = cache; - dc->handle = handle; - dc->reason = reason; - dc->timeout_id = 0; - return dc; -} - -static void -decloak_context_free (gpointer data) -{ - DecloakContext *dc = data; - - tp_handle_set_remove (dc->cache->priv->decloak_handles, dc->handle); - - if (dc->timeout_id != 0) - g_source_remove (dc->timeout_id); - - g_slice_free (DecloakContext, dc); -} - static void gabble_presence_cache_init (GabblePresenceCache *presence_cache); static GObject * gabble_presence_cache_constructor (GType type, guint n_props, GObjectConstructParam *props); @@ -484,9 +443,6 @@ gabble_presence_cache_init (GabblePresenceCache *cache) g_free, (GDestroyNotify) disco_waiter_list_free); priv->caps_serial = 1; - priv->decloak_requests = g_hash_table_new_full (NULL, NULL, NULL, - decloak_context_free); - priv->location = g_hash_table_new_full (g_direct_hash, g_direct_equal, NULL, (GDestroyNotify) g_hash_table_unref); } @@ -524,7 +480,6 @@ gabble_presence_cache_constructor (GType type, guint n_props, g_assert (priv->conn != NULL); g_assert (priv->presence_handles != NULL); - g_assert (priv->decloak_handles != NULL); gabble_presence_cache_add_bundles ((GabblePresenceCache *) obj); @@ -555,9 +510,6 @@ gabble_presence_cache_dispose (GObject *object) priv->unsure_id = 0; } - tp_clear_pointer (&priv->decloak_requests, g_hash_table_unref); - tp_clear_pointer (&priv->decloak_handles, tp_handle_set_destroy); - g_assert (priv->message_cb == 0); g_assert (priv->presence_cb == 0); @@ -614,13 +566,11 @@ gabble_presence_cache_set_property (GObject *object, case PROP_CONNECTION: g_assert (priv->conn == NULL); /* construct-only */ g_assert (priv->presence_handles == NULL); /* construct-only */ - g_assert (priv->decloak_handles == NULL); /* construct-only */ priv->conn = g_value_get_object (value); contact_repo = tp_base_connection_get_handles ( - (TpBaseConnection *) priv->conn, TP_HANDLE_TYPE_CONTACT); + (TpBaseConnection *) priv->conn, TP_ENTITY_TYPE_CONTACT); priv->presence_handles = tp_handle_set_new (contact_repo); - priv->decloak_handles = tp_handle_set_new (contact_repo); break; default: @@ -1287,7 +1237,7 @@ _caps_disco_cb (GabbleDisco *disco, priv = cache->priv; base_conn = TP_BASE_CONNECTION (priv->conn); contact_repo = tp_base_connection_get_handles (base_conn, - TP_HANDLE_TYPE_CONTACT); + TP_ENTITY_TYPE_CONTACT); if (NULL == node) { @@ -1527,7 +1477,7 @@ _process_caps_uri (GabblePresenceCache *cache, priv = cache->priv; contact_repo = tp_base_connection_get_handles ( - (TpBaseConnection *) priv->conn, TP_HANDLE_TYPE_CONTACT); + (TpBaseConnection *) priv->conn, TP_ENTITY_TYPE_CONTACT); info = capability_info_get (cache, uri); caps_cache = wocky_caps_cache_dup_shared (); @@ -1756,53 +1706,6 @@ _process_caps (GabblePresenceCache *cache, g_slist_free (uris); } -static void -presence_cache_check_for_decloak_request ( - GabblePresenceCache *cache, - WockyStanza *stanza, - TpHandle handle, - const gchar *from) -{ - GabblePresenceCachePrivate *priv = cache->priv; - WockyNode *presence_node = wocky_stanza_get_top_node (stanza); - WockyNode *child_node; - - /* If we receive (directed or broadcast) presence of any sort from someone, - * it counts as a reply to any pending de-cloak request we might have been - * tracking */ - g_hash_table_remove (priv->decloak_requests, GUINT_TO_POINTER (handle)); - - child_node = wocky_node_get_child_ns (presence_node, "temppres", - NS_TEMPPRES); - - if (child_node != NULL) - { - gboolean decloak; - const gchar *reason; - - /* this is a request to de-cloak, i.e. leak a minimal version of our - * presence to the peer */ - g_object_get (priv->conn, - "decloak-automatically", &decloak, - NULL); - - reason = wocky_node_get_attribute (child_node, "reason"); - - if (reason == NULL) - reason = ""; - - DEBUG ("Considering whether to decloak, reason='%s', conclusion=%d", - reason, decloak); - - conn_decloak_emit_requested (priv->conn, handle, reason, decloak); - - if (decloak) - gabble_connection_send_capabilities (priv->conn, from, NULL); - } - -} - - /* FIXME: in a cruel twist of fate, this is called by GabbleMucChannel! * Presumably this is because the handler priority here is MIN, so WockyMuc * steals the presence stanza before we can scrape our information out of it? @@ -1856,8 +1759,6 @@ gabble_presence_parse_presence_message ( if (prio != NULL) priority = CLAMP (atoi (prio), G_MININT8, G_MAXINT8); - presence_cache_check_for_decloak_request (cache, message, handle, from); - wocky_stanza_get_type_info (message, NULL, &sub_type); switch (sub_type) { @@ -1937,7 +1838,7 @@ _parse_message_message ( GabblePresenceCache *cache = GABBLE_PRESENCE_CACHE (user_data); GabblePresenceCachePrivate *priv = cache->priv; TpHandleRepoIface *contact_repo = tp_base_connection_get_handles ( - (TpBaseConnection *) priv->conn, TP_HANDLE_TYPE_CONTACT); + (TpBaseConnection *) priv->conn, TP_ENTITY_TYPE_CONTACT); const gchar *from = wocky_stanza_get_from (message); TpHandle handle; WockyStanzaSubType sub_type; @@ -1999,7 +1900,7 @@ gabble_presence_cache_presence_cb ( GabblePresenceCache *cache = GABBLE_PRESENCE_CACHE (user_data); GabblePresenceCachePrivate *priv = cache->priv; TpHandleRepoIface *contact_repo = tp_base_connection_get_handles ( - (TpBaseConnection *) priv->conn, TP_HANDLE_TYPE_CONTACT); + (TpBaseConnection *) priv->conn, TP_ENTITY_TYPE_CONTACT); const char *from = wocky_stanza_get_from (message); TpHandle handle; @@ -2033,7 +1934,7 @@ gabble_presence_cache_get (GabblePresenceCache *cache, TpHandle handle) { GabblePresenceCachePrivate *priv = cache->priv; TpHandleRepoIface *contact_repo = tp_base_connection_get_handles ( - (TpBaseConnection *) priv->conn, TP_HANDLE_TYPE_CONTACT); + (TpBaseConnection *) priv->conn, TP_ENTITY_TYPE_CONTACT); g_assert (tp_handle_is_valid (contact_repo, handle, NULL)); @@ -2058,7 +1959,7 @@ gabble_presence_cache_maybe_remove ( { GabblePresenceCachePrivate *priv = cache->priv; TpHandleRepoIface *contact_repo = tp_base_connection_get_handles ( - (TpBaseConnection *) priv->conn, TP_HANDLE_TYPE_CONTACT); + (TpBaseConnection *) priv->conn, TP_ENTITY_TYPE_CONTACT); GabblePresence *presence; presence = gabble_presence_cache_get (cache, handle); @@ -2113,7 +2014,7 @@ gabble_presence_cache_do_update ( if (DEBUGGING) { TpHandleRepoIface *contact_repo = tp_base_connection_get_handles ( - (TpBaseConnection *) priv->conn, TP_HANDLE_TYPE_CONTACT); + (TpBaseConnection *) priv->conn, TP_ENTITY_TYPE_CONTACT); const gchar *jid = tp_handle_inspect (contact_repo, handle); const gchar *presence_name = wocky_enum_to_nick ( GABBLE_TYPE_PRESENCE_ID, presence_id); @@ -2327,7 +2228,7 @@ gabble_presence_cache_really_remove ( { GabblePresenceCachePrivate *priv = cache->priv; TpHandleRepoIface *contact_repo = tp_base_connection_get_handles ( - (TpBaseConnection *) priv->conn, TP_HANDLE_TYPE_CONTACT); + (TpBaseConnection *) priv->conn, TP_ENTITY_TYPE_CONTACT); const gchar *jid; jid = tp_handle_inspect (contact_repo, handle); @@ -2336,86 +2237,6 @@ gabble_presence_cache_really_remove ( tp_handle_set_remove (priv->presence_handles, handle); } -void -gabble_presence_cache_contacts_added_to_olpc_view (GabblePresenceCache *self, - TpHandleSet *handles) -{ - GArray *tmp, *changed; - guint i; - - tmp = tp_handle_set_to_array (handles); - - changed = g_array_new (FALSE, FALSE, sizeof (TpHandle)); - - for (i = 0; i < tmp->len; i++) - { - TpHandle handle; - GabblePresence *presence; - - handle = g_array_index (tmp, TpHandle, i); - - presence = gabble_presence_cache_get (self, handle); - if (presence == NULL) - { - presence = _cache_insert (self, handle); - } - - if (gabble_presence_added_to_view (presence)) - { - g_array_append_val (changed, handle); - } - } - - if (changed->len > 0) - { - g_signal_emit (self, signals[PRESENCES_UPDATED], 0, changed); - } - - g_array_unref (tmp); - g_array_unref (changed); -} - -void -gabble_presence_cache_contacts_removed_from_olpc_view ( - GabblePresenceCache *self, - TpHandleSet *handles) -{ - GArray *tmp, *changed; - guint i; - - tmp = tp_handle_set_to_array (handles); - - changed = g_array_new (FALSE, FALSE, sizeof (TpHandle)); - - for (i = 0; i < tmp->len; i++) - { - TpHandle handle; - GabblePresence *presence; - - handle = g_array_index (tmp, TpHandle, i); - - presence = gabble_presence_cache_get (self, handle); - if (presence == NULL) - { - presence = _cache_insert (self, handle); - } - - if (gabble_presence_removed_from_view (presence)) - { - g_array_append_val (changed, handle); - gabble_presence_cache_maybe_remove (self, handle); - } - } - - if (changed->len > 0) - { - g_signal_emit (self, signals[PRESENCES_UPDATED], 0, changed); - } - - g_array_unref (tmp); - g_array_unref (changed); -} - static gboolean gabble_presence_cache_caps_pending (GabblePresenceCache *cache, TpHandle handle) @@ -2491,94 +2312,10 @@ gabble_presence_cache_is_unsure (GabblePresenceCache *cache, return TRUE; } - /* if we're waiting for a de-cloak response, we're unsure */ - if (tp_handle_set_is_member (priv->decloak_handles, handle)) - { - DEBUG ("Waiting to see if %u will decloak", handle); - return TRUE; - } - DEBUG ("No, I'm sure about %u by now", handle); return FALSE; } -static gboolean -gabble_presence_cache_decloak_timeout_cb (gpointer data) -{ - DecloakContext *dc = data; - GabblePresenceCache *self = dc->cache; - TpHandle handle = dc->handle; - - DEBUG ("De-cloak request for %u timed out", handle); - - /* This frees @dc, do not dereference it afterwards. This needs to be done - * before emitting the signal, so that when recipients of the channel ask - * whether we're unsure about the handle, there is no pending decloak - * request that would make us unsure. */ - g_hash_table_remove (self->priv->decloak_requests, - GUINT_TO_POINTER (handle)); - /* As a side-effect of freeing @dc, this should have happened. */ - g_assert (!tp_handle_set_is_member (self->priv->decloak_handles, handle)); - - /* FIXME: this is an abuse of this signal, but it serves the same - * purpose: poking any pending media channels to tell them that @handle - * might have left the "unsure" state */ - emit_capabilities_discovered (self, handle); - - return FALSE; -} - -/* @reason must be a statically-allocated string. */ -gboolean -gabble_presence_cache_request_decloaking (GabblePresenceCache *self, - TpHandle handle, - const gchar *reason) -{ - DecloakContext *dc; - GabblePresence *presence; - TpHandleRepoIface *contact_repo = tp_base_connection_get_handles ( - (TpBaseConnection *) self->priv->conn, TP_HANDLE_TYPE_CONTACT); - - presence = gabble_presence_cache_get (self, handle); - - if (presence != NULL && - presence->status != GABBLE_PRESENCE_OFFLINE && - presence->status != GABBLE_PRESENCE_UNKNOWN) - { - DEBUG ("We know that this contact is online, no point asking for " - "decloak"); - return FALSE; - } - - /* if we've already asked them to de-cloak for the same reason, do nothing */ - if (tp_handle_set_is_member (self->priv->decloak_handles, handle)) - { - dc = g_hash_table_lookup (self->priv->decloak_requests, - GUINT_TO_POINTER (handle)); - - if (dc != NULL && !tp_strdiff (reason, dc->reason)) - { - DEBUG ("Already asked %u to decloak for reason '%s'", handle, - reason); - return TRUE; - } - } - - DEBUG ("Asking %u to decloak", handle); - - dc = decloak_context_new (self, handle, reason); - dc->timeout_id = g_timeout_add_seconds (DECLOAK_PERIOD, - gabble_presence_cache_decloak_timeout_cb, dc); - g_hash_table_insert (self->priv->decloak_requests, GUINT_TO_POINTER (handle), - dc); - tp_handle_set_add (self->priv->decloak_handles, handle); - - gabble_connection_request_decloak (self->priv->conn, - tp_handle_inspect (contact_repo, handle), reason, NULL); - - return TRUE; -} - void gabble_presence_cache_update_location (GabblePresenceCache *cache, TpHandle handle, diff --git a/src/presence-cache.h b/src/presence-cache.h index 55023447f..4b6001f4f 100644 --- a/src/presence-cache.h +++ b/src/presence-cache.h @@ -127,18 +127,9 @@ gboolean gabble_presence_parse_presence_message ( const gchar *from, WockyStanza *message); -void gabble_presence_cache_contacts_added_to_olpc_view ( - GabblePresenceCache *cache, TpHandleSet *handles); - -void gabble_presence_cache_contacts_removed_from_olpc_view ( - GabblePresenceCache *cache, TpHandleSet *handles); - gboolean gabble_presence_cache_is_unsure (GabblePresenceCache *cache, TpHandle handle); -gboolean gabble_presence_cache_request_decloaking (GabblePresenceCache *self, - TpHandle handle, const gchar *reason); - void gabble_presence_cache_update_location (GabblePresenceCache *cache, TpHandle handle, GHashTable *location); GHashTable* gabble_presence_cache_get_location (GabblePresenceCache *cache, diff --git a/src/presence.c b/src/presence.c index db9830c6e..f968f11a2 100644 --- a/src/presence.c +++ b/src/presence.c @@ -69,7 +69,6 @@ struct _GabblePresencePrivate { gchar *no_resource_status_message; GSList *resources; - guint olpc_views; gchar *active_resource; }; @@ -444,15 +443,6 @@ aggregate_resources (GabblePresence *presence) priv->active_resource = g_strdup (best->name); } - if (presence->status <= GABBLE_PRESENCE_HIDDEN && priv->olpc_views > 0) - { - /* Contact is in at least one view and we didn't receive a better - * presence from him so announce it as available */ - presence->status = GABBLE_PRESENCE_AVAILABLE; - g_free (presence->status_message); - presence->status_message = NULL; - } - return old_client_types != presence->client_types; } @@ -739,7 +729,6 @@ gabble_presence_dump (GabblePresence *presence) gboolean gabble_presence_added_to_view (GabblePresence *self) { - GabblePresencePrivate *priv = self->priv; GabblePresenceId old_status; gchar *old_status_message; gboolean ret = FALSE; @@ -748,7 +737,6 @@ gabble_presence_added_to_view (GabblePresence *self) old_status = self->status; old_status_message = g_strdup (self->status_message); - priv->olpc_views++; aggregate_resources (self); /* detect changes */ @@ -763,7 +751,6 @@ gabble_presence_added_to_view (GabblePresence *self) gboolean gabble_presence_removed_from_view (GabblePresence *self) { - GabblePresencePrivate *priv = self->priv; GabblePresenceId old_status; gchar *old_status_message; gboolean ret = FALSE; @@ -772,7 +759,6 @@ gabble_presence_removed_from_view (GabblePresence *self) old_status = self->status; old_status_message = g_strdup (self->status_message); - priv->olpc_views--; aggregate_resources (self); /* detect changes */ diff --git a/src/private-tubes-factory.c b/src/private-tubes-factory.c index b70f1b069..72d6bf087 100644 --- a/src/private-tubes-factory.c +++ b/src/private-tubes-factory.c @@ -91,7 +91,7 @@ struct _GabblePrivateTubesFactoryPrivate static const gchar * const tubes_channel_fixed_properties[] = { TP_PROP_CHANNEL_CHANNEL_TYPE, - TP_PROP_CHANNEL_TARGET_HANDLE_TYPE, + TP_PROP_CHANNEL_TARGET_ENTITY_TYPE, NULL }; @@ -388,7 +388,7 @@ add_service_to_array (const gchar *service, GValue monster = {0, }; GHashTable *fixed_properties; GValue *channel_type_value; - GValue *target_handle_type_value; + GValue *target_entity_type_value; gchar *tube_allowed_properties[] = { TP_PROP_CHANNEL_TARGET_HANDLE, @@ -409,28 +409,28 @@ add_service_to_array (const gchar *service, channel_type_value = tp_g_value_slice_new (G_TYPE_STRING); if (type == TUBE_TYPE_STREAM) g_value_set_static_string (channel_type_value, - TP_IFACE_CHANNEL_TYPE_STREAM_TUBE); + TP_IFACE_CHANNEL_TYPE_STREAM_TUBE1); else g_value_set_static_string (channel_type_value, - TP_IFACE_CHANNEL_TYPE_DBUS_TUBE); + TP_IFACE_CHANNEL_TYPE_DBUS_TUBE1); g_hash_table_insert (fixed_properties, TP_PROP_CHANNEL_CHANNEL_TYPE, channel_type_value); - target_handle_type_value = tp_g_value_slice_new (G_TYPE_UINT); - g_value_set_uint (target_handle_type_value, TP_HANDLE_TYPE_CONTACT); + target_entity_type_value = tp_g_value_slice_new (G_TYPE_UINT); + g_value_set_uint (target_entity_type_value, TP_ENTITY_TYPE_CONTACT); g_hash_table_insert (fixed_properties, - TP_PROP_CHANNEL_TARGET_HANDLE_TYPE, target_handle_type_value); + TP_PROP_CHANNEL_TARGET_ENTITY_TYPE, target_entity_type_value); - target_handle_type_value = tp_g_value_slice_new (G_TYPE_STRING); - g_value_set_string (target_handle_type_value, service); + target_entity_type_value = tp_g_value_slice_new (G_TYPE_STRING); + g_value_set_string (target_entity_type_value, service); if (type == TUBE_TYPE_STREAM) g_hash_table_insert (fixed_properties, - TP_PROP_CHANNEL_TYPE_STREAM_TUBE_SERVICE, - target_handle_type_value); + TP_PROP_CHANNEL_TYPE_STREAM_TUBE1_SERVICE, + target_entity_type_value); else g_hash_table_insert (fixed_properties, - TP_PROP_CHANNEL_TYPE_DBUS_TUBE_SERVICE_NAME, - target_handle_type_value); + TP_PROP_CHANNEL_TYPE_DBUS_TUBE1_SERVICE_NAME, + target_entity_type_value); dbus_g_type_struct_set (&monster, 0, fixed_properties, @@ -448,7 +448,7 @@ add_generic_tube_caps (GPtrArray *arr) GValue monster1 = {0,}, monster2 = {0,}; GHashTable *fixed_properties; GValue *channel_type_value; - GValue *target_handle_type_value; + GValue *target_entity_type_value; /* StreamTube */ g_value_init (&monster1, TP_STRUCT_TYPE_REQUESTABLE_CHANNEL_CLASS); @@ -461,15 +461,15 @@ add_generic_tube_caps (GPtrArray *arr) channel_type_value = tp_g_value_slice_new (G_TYPE_STRING); g_value_set_static_string (channel_type_value, - TP_IFACE_CHANNEL_TYPE_STREAM_TUBE); + TP_IFACE_CHANNEL_TYPE_STREAM_TUBE1); g_hash_table_insert (fixed_properties, TP_PROP_CHANNEL_CHANNEL_TYPE, channel_type_value); - target_handle_type_value = tp_g_value_slice_new (G_TYPE_UINT); - g_value_set_uint (target_handle_type_value, TP_HANDLE_TYPE_CONTACT); + target_entity_type_value = tp_g_value_slice_new (G_TYPE_UINT); + g_value_set_uint (target_entity_type_value, TP_ENTITY_TYPE_CONTACT); g_hash_table_insert (fixed_properties, - TP_PROP_CHANNEL_TARGET_HANDLE_TYPE, target_handle_type_value); + TP_PROP_CHANNEL_TARGET_ENTITY_TYPE, target_entity_type_value); dbus_g_type_struct_set (&monster1, 0, fixed_properties, @@ -490,15 +490,15 @@ add_generic_tube_caps (GPtrArray *arr) channel_type_value = tp_g_value_slice_new (G_TYPE_STRING); g_value_set_static_string (channel_type_value, - TP_IFACE_CHANNEL_TYPE_DBUS_TUBE); + TP_IFACE_CHANNEL_TYPE_DBUS_TUBE1); g_hash_table_insert (fixed_properties, TP_PROP_CHANNEL_CHANNEL_TYPE, channel_type_value); - target_handle_type_value = tp_g_value_slice_new (G_TYPE_UINT); - g_value_set_uint (target_handle_type_value, TP_HANDLE_TYPE_CONTACT); + target_entity_type_value = tp_g_value_slice_new (G_TYPE_UINT); + g_value_set_uint (target_entity_type_value, TP_ENTITY_TYPE_CONTACT); g_hash_table_insert (fixed_properties, - TP_PROP_CHANNEL_TARGET_HANDLE_TYPE, target_handle_type_value); + TP_PROP_CHANNEL_TARGET_ENTITY_TYPE, target_entity_type_value); dbus_g_type_struct_set (&monster2, 0, fixed_properties, @@ -577,26 +577,26 @@ gabble_private_tubes_factory_add_cap (GabbleCapsChannelManager *manager, TP_PROP_CHANNEL_CHANNEL_TYPE); /* this channel is not for this factory */ - if (tp_strdiff (channel_type, TP_IFACE_CHANNEL_TYPE_STREAM_TUBE) && - tp_strdiff (channel_type, TP_IFACE_CHANNEL_TYPE_DBUS_TUBE)) + if (tp_strdiff (channel_type, TP_IFACE_CHANNEL_TYPE_STREAM_TUBE1) && + tp_strdiff (channel_type, TP_IFACE_CHANNEL_TYPE_DBUS_TUBE1)) return; if (tp_asv_get_uint32 (cap, - TP_PROP_CHANNEL_TARGET_HANDLE_TYPE, NULL) != TP_HANDLE_TYPE_CONTACT) + TP_PROP_CHANNEL_TARGET_ENTITY_TYPE, NULL) != TP_ENTITY_TYPE_CONTACT) return; - if (!tp_strdiff (channel_type, TP_IFACE_CHANNEL_TYPE_STREAM_TUBE)) + if (!tp_strdiff (channel_type, TP_IFACE_CHANNEL_TYPE_STREAM_TUBE1)) { service = tp_asv_get_string (cap, - TP_PROP_CHANNEL_TYPE_STREAM_TUBE_SERVICE); + TP_PROP_CHANNEL_TYPE_STREAM_TUBE1_SERVICE); if (service != NULL) ns = g_strconcat (STREAM_CAP_PREFIX, service, NULL); } - else if (!tp_strdiff (channel_type, TP_IFACE_CHANNEL_TYPE_DBUS_TUBE)) + else if (!tp_strdiff (channel_type, TP_IFACE_CHANNEL_TYPE_DBUS_TUBE1)) { service = tp_asv_get_string (cap, - TP_PROP_CHANNEL_TYPE_DBUS_TUBE_SERVICE_NAME); + TP_PROP_CHANNEL_TYPE_DBUS_TUBE1_SERVICE_NAME); if (service != NULL) ns = g_strconcat (DBUS_CAP_PREFIX, service, NULL); @@ -668,7 +668,7 @@ gabble_private_tubes_factory_handle_si_tube_request ( WockyStanza *msg) { TpHandleRepoIface *contact_repo = tp_base_connection_get_handles ( - (TpBaseConnection *) self->priv->conn, TP_HANDLE_TYPE_CONTACT); + (TpBaseConnection *) self->priv->conn, TP_ENTITY_TYPE_CONTACT); WockyNode *si_node, *tube_node; WockyStanzaType stanza_type; WockyStanzaSubType sub_type; @@ -725,7 +725,7 @@ gabble_private_tubes_factory_handle_si_stream_request ( WockyStanza *msg) { TpHandleRepoIface *contact_repo = tp_base_connection_get_handles ( - (TpBaseConnection *) self->priv->conn, TP_HANDLE_TYPE_CONTACT); + (TpBaseConnection *) self->priv->conn, TP_ENTITY_TYPE_CONTACT); const gchar *tmp; guint64 tube_id; WockyNode *si_node, *stream_node; @@ -795,7 +795,7 @@ tube_msg_checks (GabblePrivateTubesFactory *self, guint64 *out_tube_id) { TpHandleRepoIface *contact_repo = tp_base_connection_get_handles ( - (TpBaseConnection *) self->priv->conn, TP_HANDLE_TYPE_CONTACT); + (TpBaseConnection *) self->priv->conn, TP_ENTITY_TYPE_CONTACT); const gchar *from, *tmp; TpHandle handle; guint64 tube_id; @@ -972,7 +972,7 @@ channel_closed_cb (GabbleTubeIface *tube, "id", &id, NULL); - tp_channel_manager_emit_channel_closed_for_object (self, + tp_channel_manager_emit_channel_closed_for_object (TP_CHANNEL_MANAGER (self), TP_EXPORTABLE_CHANNEL (tube)); if (self->priv->tubes != NULL) @@ -1008,7 +1008,7 @@ new_channel_from_request (GabblePrivateTubesFactory *self, TpHandle handle; const gchar *ctype, *service; - TpHandleType handle_type; + TpEntityType handle_type; GHashTable *parameters; guint64 tube_id; @@ -1016,7 +1016,7 @@ new_channel_from_request (GabblePrivateTubesFactory *self, handle = tp_asv_get_uint32 (request, TP_PROP_CHANNEL_TARGET_HANDLE, NULL); handle_type = tp_asv_get_uint32 (request, - TP_PROP_CHANNEL_TARGET_HANDLE_TYPE, NULL); + TP_PROP_CHANNEL_TARGET_ENTITY_TYPE, NULL); tube_id = generate_tube_id (self); @@ -1024,10 +1024,10 @@ new_channel_from_request (GabblePrivateTubesFactory *self, parameters = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, (GDestroyNotify) tp_g_value_slice_free); - if (!tp_strdiff (ctype, TP_IFACE_CHANNEL_TYPE_STREAM_TUBE)) + if (!tp_strdiff (ctype, TP_IFACE_CHANNEL_TYPE_STREAM_TUBE1)) { service = tp_asv_get_string (request, - TP_PROP_CHANNEL_TYPE_STREAM_TUBE_SERVICE); + TP_PROP_CHANNEL_TYPE_STREAM_TUBE1_SERVICE); tube = GABBLE_TUBE_IFACE (gabble_tube_stream_new (self->priv->conn, handle, handle_type, @@ -1035,10 +1035,10 @@ new_channel_from_request (GabblePrivateTubesFactory *self, tp_base_connection_get_self_handle (base_conn), service, parameters, tube_id, NULL, TRUE)); } - else if (!tp_strdiff (ctype, TP_IFACE_CHANNEL_TYPE_DBUS_TUBE)) + else if (!tp_strdiff (ctype, TP_IFACE_CHANNEL_TYPE_DBUS_TUBE1)) { service = tp_asv_get_string (request, - TP_PROP_CHANNEL_TYPE_DBUS_TUBE_SERVICE_NAME); + TP_PROP_CHANNEL_TYPE_DBUS_TUBE1_SERVICE_NAME); stream_id = gabble_bytestream_factory_generate_stream_id (); @@ -1110,7 +1110,7 @@ new_channel_from_stanza (GabblePrivateTubesFactory *self, GabbleTubeIface *tube; TpBaseConnection *base_conn = TP_BASE_CONNECTION (self->priv->conn); TpHandleRepoIface *contact_repo = tp_base_connection_get_handles ( - (TpBaseConnection *) self->priv->conn, TP_HANDLE_TYPE_CONTACT); + (TpBaseConnection *) self->priv->conn, TP_ENTITY_TYPE_CONTACT); TubeType type; TpHandle handle; @@ -1150,7 +1150,7 @@ new_channel_from_stanza (GabblePrivateTubesFactory *self, if (type == TUBE_TYPE_STREAM) { tube = GABBLE_TUBE_IFACE (gabble_tube_stream_new (self->priv->conn, - handle, TP_HANDLE_TYPE_CONTACT, + handle, TP_ENTITY_TYPE_CONTACT, tp_base_connection_get_self_handle (base_conn), handle, service, parameters, tube_id, NULL, FALSE)); } @@ -1167,7 +1167,7 @@ new_channel_from_stanza (GabblePrivateTubesFactory *self, g_return_val_if_fail (stream_id != NULL, NULL); tube = GABBLE_TUBE_IFACE (gabble_tube_dbus_new (self->priv->conn, - handle, TP_HANDLE_TYPE_CONTACT, + handle, TP_ENTITY_TYPE_CONTACT, tp_base_connection_get_self_handle (base_conn), handle, service, parameters, stream_id, tube_id, bytestream, NULL, FALSE)); @@ -1183,7 +1183,7 @@ new_channel_from_stanza (GabblePrivateTubesFactory *self, g_hash_table_unref (parameters); - tp_channel_manager_emit_new_channel (self, + tp_channel_manager_emit_new_channel (TP_CHANNEL_MANAGER (self), TP_EXPORTABLE_CHANNEL (tube), NULL); return tube; @@ -1213,13 +1213,13 @@ gabble_private_tubes_factory_type_foreach_channel_class (GType type, (GDestroyNotify) tp_g_value_slice_free); value = tp_g_value_slice_new (G_TYPE_STRING); - g_value_set_static_string (value, TP_IFACE_CHANNEL_TYPE_STREAM_TUBE); + g_value_set_static_string (value, TP_IFACE_CHANNEL_TYPE_STREAM_TUBE1); g_hash_table_insert (table, TP_PROP_CHANNEL_CHANNEL_TYPE, value); value = tp_g_value_slice_new (G_TYPE_UINT); - g_value_set_uint (value, TP_HANDLE_TYPE_CONTACT); - g_hash_table_insert (table, TP_PROP_CHANNEL_TARGET_HANDLE_TYPE, + g_value_set_uint (value, TP_ENTITY_TYPE_CONTACT); + g_hash_table_insert (table, TP_PROP_CHANNEL_TARGET_ENTITY_TYPE, value); func (type, table, gabble_tube_stream_channel_get_allowed_properties (), @@ -1232,13 +1232,13 @@ gabble_private_tubes_factory_type_foreach_channel_class (GType type, (GDestroyNotify) tp_g_value_slice_free); value = tp_g_value_slice_new (G_TYPE_STRING); - g_value_set_static_string (value, TP_IFACE_CHANNEL_TYPE_DBUS_TUBE); + g_value_set_static_string (value, TP_IFACE_CHANNEL_TYPE_DBUS_TUBE1); g_hash_table_insert (table, TP_PROP_CHANNEL_CHANNEL_TYPE, value); value = tp_g_value_slice_new (G_TYPE_UINT); - g_value_set_uint (value, TP_HANDLE_TYPE_CONTACT); - g_hash_table_insert (table, TP_PROP_CHANNEL_TARGET_HANDLE_TYPE, + g_value_set_uint (value, TP_ENTITY_TYPE_CONTACT); + g_hash_table_insert (table, TP_PROP_CHANNEL_TARGET_ENTITY_TYPE, value); func (type, table, gabble_tube_dbus_channel_get_allowed_properties (), @@ -1262,17 +1262,17 @@ gabble_private_tubes_factory_requestotron (GabblePrivateTubesFactory *self, const gchar *service = NULL; if (tp_asv_get_uint32 (request_properties, - TP_PROP_CHANNEL_TARGET_HANDLE_TYPE, NULL) != TP_HANDLE_TYPE_CONTACT) + TP_PROP_CHANNEL_TARGET_ENTITY_TYPE, NULL) != TP_ENTITY_TYPE_CONTACT) return FALSE; channel_type = tp_asv_get_string (request_properties, TP_PROP_CHANNEL_CHANNEL_TYPE); - if (tp_strdiff (channel_type, TP_IFACE_CHANNEL_TYPE_STREAM_TUBE) && - tp_strdiff (channel_type, TP_IFACE_CHANNEL_TYPE_DBUS_TUBE)) + if (tp_strdiff (channel_type, TP_IFACE_CHANNEL_TYPE_STREAM_TUBE1) && + tp_strdiff (channel_type, TP_IFACE_CHANNEL_TYPE_DBUS_TUBE1)) return FALSE; - if (! tp_strdiff (channel_type, TP_IFACE_CHANNEL_TYPE_STREAM_TUBE)) + if (! tp_strdiff (channel_type, TP_IFACE_CHANNEL_TYPE_STREAM_TUBE1)) { if (tp_channel_manager_asv_has_unknown_properties (request_properties, tubes_channel_fixed_properties, @@ -1282,16 +1282,16 @@ gabble_private_tubes_factory_requestotron (GabblePrivateTubesFactory *self, /* "Service" is a mandatory, not-fixed property */ service = tp_asv_get_string (request_properties, - TP_PROP_CHANNEL_TYPE_STREAM_TUBE_SERVICE); + TP_PROP_CHANNEL_TYPE_STREAM_TUBE1_SERVICE); if (service == NULL) { g_set_error (&error, TP_ERROR, TP_ERROR_NOT_IMPLEMENTED, "Request does not contain the mandatory property '%s'", - TP_PROP_CHANNEL_TYPE_STREAM_TUBE_SERVICE); + TP_PROP_CHANNEL_TYPE_STREAM_TUBE1_SERVICE); goto error; } } - else if (! tp_strdiff (channel_type, TP_IFACE_CHANNEL_TYPE_DBUS_TUBE)) + else if (! tp_strdiff (channel_type, TP_IFACE_CHANNEL_TYPE_DBUS_TUBE1)) { GError *err = NULL; @@ -1303,12 +1303,12 @@ gabble_private_tubes_factory_requestotron (GabblePrivateTubesFactory *self, /* "ServiceName" is a mandatory, not-fixed property */ service = tp_asv_get_string (request_properties, - TP_PROP_CHANNEL_TYPE_DBUS_TUBE_SERVICE_NAME); + TP_PROP_CHANNEL_TYPE_DBUS_TUBE1_SERVICE_NAME); if (service == NULL) { g_set_error (&error, TP_ERROR, TP_ERROR_NOT_IMPLEMENTED, "Request does not contain the mandatory property '%s'", - TP_PROP_CHANNEL_TYPE_DBUS_TUBE_SERVICE_NAME); + TP_PROP_CHANNEL_TYPE_DBUS_TUBE1_SERVICE_NAME); goto error; } @@ -1347,7 +1347,7 @@ gabble_private_tubes_factory_requestotron (GabblePrivateTubesFactory *self, if (request_token != NULL) request_tokens = g_slist_prepend (NULL, request_token); - tp_channel_manager_emit_new_channel (self, + tp_channel_manager_emit_new_channel (TP_CHANNEL_MANAGER (self), TP_EXPORTABLE_CHANNEL (channel), request_tokens); g_slist_free (request_tokens); @@ -1362,15 +1362,16 @@ gabble_private_tubes_factory_requestotron (GabblePrivateTubesFactory *self, goto error; } - tp_channel_manager_emit_request_already_satisfied (self, - request_token, TP_EXPORTABLE_CHANNEL (channel)); + tp_channel_manager_emit_request_already_satisfied ( + TP_CHANNEL_MANAGER (self), request_token, + TP_EXPORTABLE_CHANNEL (channel)); } return TRUE; error: - tp_channel_manager_emit_request_failed (self, request_token, - error->domain, error->code, error->message); + tp_channel_manager_emit_request_failed (TP_CHANNEL_MANAGER (self), + request_token, error->domain, error->code, error->message); g_error_free (error); return TRUE; } @@ -1378,36 +1379,23 @@ error: static gboolean gabble_private_tubes_factory_create_channel (TpChannelManager *manager, - gpointer request_token, - GHashTable *request_properties) + TpChannelManagerRequest *request, + GHashTable *request_properties) { GabblePrivateTubesFactory *self = GABBLE_PRIVATE_TUBES_FACTORY (manager); - return gabble_private_tubes_factory_requestotron (self, request_token, + return gabble_private_tubes_factory_requestotron (self, request, request_properties, TRUE); } - -static gboolean -gabble_private_tubes_factory_request_channel (TpChannelManager *manager, - gpointer request_token, - GHashTable *request_properties) -{ - GabblePrivateTubesFactory *self = GABBLE_PRIVATE_TUBES_FACTORY (manager); - - return gabble_private_tubes_factory_requestotron (self, request_token, - request_properties, FALSE); -} - - static gboolean gabble_private_tubes_factory_ensure_channel (TpChannelManager *manager, - gpointer request_token, - GHashTable *request_properties) + TpChannelManagerRequest *request, + GHashTable *request_properties) { GabblePrivateTubesFactory *self = GABBLE_PRIVATE_TUBES_FACTORY (manager); - return gabble_private_tubes_factory_requestotron (self, request_token, + return gabble_private_tubes_factory_requestotron (self, request, request_properties, FALSE); } @@ -1421,7 +1409,6 @@ channel_manager_iface_init (gpointer g_iface, iface->type_foreach_channel_class = gabble_private_tubes_factory_type_foreach_channel_class; iface->create_channel = gabble_private_tubes_factory_create_channel; - iface->request_channel = gabble_private_tubes_factory_request_channel; iface->ensure_channel = gabble_private_tubes_factory_ensure_channel; } diff --git a/src/protocol.c b/src/protocol.c index d89b8a11b..988b97a36 100644 --- a/src/protocol.c +++ b/src/protocol.c @@ -162,19 +162,12 @@ static TpCMParamSpec jabber_params[] = { TP_CONN_MGR_PARAM_FLAG_HAS_DEFAULT, GUINT_TO_POINTER (30), 0 /* unused */, NULL, NULL }, - { TP_PROP_CONNECTION_INTERFACE_CONTACT_LIST_DOWNLOAD_AT_CONNECTION, + { TP_PROP_CONNECTION_INTERFACE_CONTACT_LIST1_DOWNLOAD_AT_CONNECTION, DBUS_TYPE_BOOLEAN_AS_STRING, G_TYPE_BOOLEAN, TP_CONN_MGR_PARAM_FLAG_HAS_DEFAULT | TP_CONN_MGR_PARAM_FLAG_DBUS_PROPERTY, GUINT_TO_POINTER (TRUE), 0 /* unused */, NULL, NULL }, - { GABBLE_PROP_CONNECTION_INTERFACE_GABBLE_DECLOAK_DECLOAK_AUTOMATICALLY, - DBUS_TYPE_BOOLEAN_AS_STRING, G_TYPE_BOOLEAN, - TP_CONN_MGR_PARAM_FLAG_HAS_DEFAULT | - TP_CONN_MGR_PARAM_FLAG_DBUS_PROPERTY, - GINT_TO_POINTER (TRUE), - 0 /* unused */, NULL, NULL }, - { "fallback-servers", "as", 0, 0, NULL, 0 /* unused */, NULL, NULL }, @@ -255,10 +248,8 @@ struct ParamMapping { SAME ("alias"), SAME ("fallback-socks5-proxies"), SAME ("keepalive-interval"), - MAP (TP_PROP_CONNECTION_INTERFACE_CONTACT_LIST_DOWNLOAD_AT_CONNECTION, + MAP (TP_PROP_CONNECTION_INTERFACE_CONTACT_LIST1_DOWNLOAD_AT_CONNECTION, "download-roster-at-connection"), - MAP (GABBLE_PROP_CONNECTION_INTERFACE_GABBLE_DECLOAK_DECLOAK_AUTOMATICALLY, - "decloak-automatically"), SAME ("fallback-servers"), SAME ("extra-certificate-identities"), SAME (NULL) @@ -329,9 +320,9 @@ get_interfaces_array (TpBaseProtocol *self) interfaces = TP_BASE_PROTOCOL_CLASS ( gabble_jabber_protocol_parent_class)->get_interfaces_array (self); - g_ptr_array_add (interfaces, TP_IFACE_PROTOCOL_INTERFACE_PRESENCE); - g_ptr_array_add (interfaces, TP_IFACE_PROTOCOL_INTERFACE_ADDRESSING); - g_ptr_array_add (interfaces, TP_IFACE_PROTOCOL_INTERFACE_AVATARS); + g_ptr_array_add (interfaces, TP_IFACE_PROTOCOL_INTERFACE_PRESENCE1); + g_ptr_array_add (interfaces, TP_IFACE_PROTOCOL_INTERFACE_ADDRESSING1); + g_ptr_array_add (interfaces, TP_IFACE_PROTOCOL_INTERFACE_AVATARS1); return interfaces; } @@ -395,8 +386,8 @@ static GStrv dup_authentication_types (TpBaseProtocol *self) { const gchar * const types[] = { - TP_IFACE_CHANNEL_TYPE_SERVER_TLS_CONNECTION, - TP_IFACE_CHANNEL_INTERFACE_SASL_AUTHENTICATION, + TP_IFACE_CHANNEL_TYPE_SERVER_TLS_CONNECTION1, + TP_IFACE_CHANNEL_INTERFACE_SASL_AUTHENTICATION1, NULL }; return g_strdupv ((GStrv) types); diff --git a/src/roomlist-channel.c b/src/roomlist-channel.c index 070cf5ee3..d56a819cf 100644 --- a/src/roomlist-channel.c +++ b/src/roomlist-channel.c @@ -40,7 +40,7 @@ static void roomlist_iface_init (gpointer, gpointer); G_DEFINE_TYPE_WITH_CODE (GabbleRoomlistChannel, gabble_roomlist_channel, TP_TYPE_BASE_CHANNEL, - G_IMPLEMENT_INTERFACE (TP_TYPE_SVC_CHANNEL_TYPE_ROOM_LIST, + G_IMPLEMENT_INTERFACE (TP_TYPE_SVC_CHANNEL_TYPE_ROOM_LIST1, roomlist_iface_init); ); @@ -95,7 +95,7 @@ gabble_roomlist_channel_constructed (GObject *obj) if (parent_class->constructed != NULL) parent_class->constructed (obj); - room_handles = tp_base_connection_get_handles (conn, TP_HANDLE_TYPE_ROOM); + room_handles = tp_base_connection_get_handles (conn, TP_ENTITY_TYPE_ROOM); self->priv->signalled_rooms = tp_handle_set_new (room_handles); tp_base_channel_register (TP_BASE_CHANNEL (obj)); @@ -153,7 +153,7 @@ gabble_roomlist_channel_fill_immutable_properties ( tp_dbus_properties_mixin_fill_properties_hash ( G_OBJECT (chan), properties, - TP_IFACE_CHANNEL_TYPE_ROOM_LIST, "Server", + TP_IFACE_CHANNEL_TYPE_ROOM_LIST1, "Server", NULL); } @@ -182,8 +182,8 @@ gabble_roomlist_channel_class_init (GabbleRoomlistChannelClass *klass) object_class->dispose = gabble_roomlist_channel_dispose; object_class->finalize = gabble_roomlist_channel_finalize; - base_class->channel_type = TP_IFACE_CHANNEL_TYPE_ROOM_LIST; - base_class->target_handle_type = TP_HANDLE_TYPE_NONE; + base_class->channel_type = TP_IFACE_CHANNEL_TYPE_ROOM_LIST1; + base_class->target_entity_type = TP_ENTITY_TYPE_NONE; base_class->get_object_path_suffix = gabble_roomlist_channel_get_object_path_suffix; base_class->fill_immutable_properties = @@ -199,7 +199,7 @@ gabble_roomlist_channel_class_init (GabbleRoomlistChannelClass *klass) param_spec); tp_dbus_properties_mixin_implement_interface (object_class, - TP_IFACE_QUARK_CHANNEL_TYPE_ROOM_LIST, + TP_IFACE_QUARK_CHANNEL_TYPE_ROOM_LIST1, tp_dbus_properties_mixin_getter_gobject_properties, NULL, roomlist_props); } @@ -279,8 +279,8 @@ emit_room_signal (gpointer data) if (priv->pending_room_signals->len == 0) return TRUE; - tp_svc_channel_type_room_list_emit_got_rooms ( - (TpSvcChannelTypeRoomList *) chan, priv->pending_room_signals); + tp_svc_channel_type_room_list1_emit_got_rooms ( + (TpSvcChannelTypeRoomList1 *) chan, priv->pending_room_signals); while (priv->pending_room_signals->len != 0) { @@ -319,7 +319,7 @@ room_info_cb (gpointer pipeline, GabbleDiscoItem *item, gpointer user_data) base = TP_BASE_CHANNEL (chan); priv = chan->priv; room_handles = tp_base_connection_get_handles ( - tp_base_channel_get_connection (base), TP_HANDLE_TYPE_ROOM); + tp_base_channel_get_connection (base), TP_ENTITY_TYPE_ROOM); jid = item->jid; name = item->name; @@ -412,7 +412,7 @@ room_info_cb (gpointer pipeline, GabbleDiscoItem *item, gpointer user_data) dbus_g_type_struct_set (&room, 0, handle, - 1, "org.freedesktop.Telepathy.Channel.Type.Text", + 1, TP_IFACE_CHANNEL_TYPE_TEXT, 2, keys, G_MAXUINT); @@ -431,8 +431,8 @@ rooms_end_cb (gpointer data, gpointer user_data) emit_room_signal (chan); priv->listing = FALSE; - tp_svc_channel_type_room_list_emit_listing_rooms ( - (TpSvcChannelTypeRoomList *) chan, FALSE); + tp_svc_channel_type_room_list1_emit_listing_rooms ( + (TpSvcChannelTypeRoomList1 *) chan, FALSE); g_source_remove (priv->timer_source_id); priv->timer_source_id = 0; @@ -448,8 +448,8 @@ stop_listing (GabbleRoomlistChannel *self) { emit_room_signal (self); priv->listing = FALSE; - tp_svc_channel_type_room_list_emit_listing_rooms ( - (TpSvcChannelTypeRoomList *) self, FALSE); + tp_svc_channel_type_room_list1_emit_listing_rooms ( + (TpSvcChannelTypeRoomList1 *) self, FALSE); } if (priv->disco_pipeline != NULL) @@ -479,7 +479,7 @@ gabble_roomlist_channel_close (TpBaseChannel *base) } static void -gabble_roomlist_channel_get_listing_rooms (TpSvcChannelTypeRoomList *iface, +gabble_roomlist_channel_get_listing_rooms (TpSvcChannelTypeRoomList1 *iface, DBusGMethodInvocation *context) { GabbleRoomlistChannel *self = GABBLE_ROOMLIST_CHANNEL (iface); @@ -488,12 +488,12 @@ gabble_roomlist_channel_get_listing_rooms (TpSvcChannelTypeRoomList *iface, g_assert (GABBLE_IS_ROOMLIST_CHANNEL (self)); priv = self->priv; - tp_svc_channel_type_room_list_return_from_get_listing_rooms ( + tp_svc_channel_type_room_list1_return_from_get_listing_rooms ( context, priv->listing); } static void -gabble_roomlist_channel_list_rooms (TpSvcChannelTypeRoomList *iface, +gabble_roomlist_channel_list_rooms (TpSvcChannelTypeRoomList1 *iface, DBusGMethodInvocation *context) { GabbleRoomlistChannel *self = GABBLE_ROOMLIST_CHANNEL (iface); @@ -503,7 +503,7 @@ gabble_roomlist_channel_list_rooms (TpSvcChannelTypeRoomList *iface, GABBLE_CONNECTION (tp_base_channel_get_connection (base)); priv->listing = TRUE; - tp_svc_channel_type_room_list_emit_listing_rooms (iface, TRUE); + tp_svc_channel_type_room_list1_emit_listing_rooms (iface, TRUE); if (priv->disco_pipeline == NULL) priv->disco_pipeline = gabble_disco_pipeline_init (conn->disco, @@ -514,11 +514,11 @@ gabble_roomlist_channel_list_rooms (TpSvcChannelTypeRoomList *iface, priv->timer_source_id = g_timeout_add (ROOM_SIGNAL_INTERVAL, emit_room_signal, self); - tp_svc_channel_type_room_list_return_from_list_rooms (context); + tp_svc_channel_type_room_list1_return_from_list_rooms (context); } static void -gabble_roomlist_channel_stop_listing (TpSvcChannelTypeRoomList *iface, +gabble_roomlist_channel_stop_listing (TpSvcChannelTypeRoomList1 *iface, DBusGMethodInvocation *context) { GabbleRoomlistChannel *self = GABBLE_ROOMLIST_CHANNEL (iface); @@ -527,16 +527,16 @@ gabble_roomlist_channel_stop_listing (TpSvcChannelTypeRoomList *iface, stop_listing (self); - tp_svc_channel_type_room_list_return_from_stop_listing (context); + tp_svc_channel_type_room_list1_return_from_stop_listing (context); } static void roomlist_iface_init (gpointer g_iface, gpointer iface_data) { - TpSvcChannelTypeRoomListClass *klass = - (TpSvcChannelTypeRoomListClass *) g_iface; + TpSvcChannelTypeRoomList1Class *klass = + (TpSvcChannelTypeRoomList1Class *) g_iface; -#define IMPLEMENT(x) tp_svc_channel_type_room_list_implement_##x (\ +#define IMPLEMENT(x) tp_svc_channel_type_room_list1_implement_##x (\ klass, gabble_roomlist_channel_##x) IMPLEMENT(get_listing_rooms); IMPLEMENT(list_rooms); diff --git a/src/roomlist-manager.c b/src/roomlist-manager.c index ff2f37fef..7776928f8 100644 --- a/src/roomlist-manager.c +++ b/src/roomlist-manager.c @@ -258,12 +258,12 @@ gabble_roomlist_manager_foreach_channel (TpChannelManager *manager, static const gchar * const roomlist_channel_fixed_properties[] = { TP_IFACE_CHANNEL ".ChannelType", - TP_IFACE_CHANNEL ".TargetHandleType", + TP_IFACE_CHANNEL ".TargetEntityType", NULL }; static const gchar * const roomlist_channel_allowed_properties[] = { - TP_IFACE_CHANNEL_TYPE_ROOM_LIST ".Server", + TP_IFACE_CHANNEL_TYPE_ROOM_LIST1 ".Server", NULL }; @@ -278,12 +278,12 @@ gabble_roomlist_manager_type_foreach_channel_class (GType type, GValue *value; value = tp_g_value_slice_new (G_TYPE_STRING); - g_value_set_static_string (value, TP_IFACE_CHANNEL_TYPE_ROOM_LIST); + g_value_set_static_string (value, TP_IFACE_CHANNEL_TYPE_ROOM_LIST1); g_hash_table_insert (table, TP_IFACE_CHANNEL ".ChannelType", value); value = tp_g_value_slice_new (G_TYPE_UINT); - g_value_set_uint (value, TP_HANDLE_TYPE_NONE); - g_hash_table_insert (table, TP_IFACE_CHANNEL ".TargetHandleType", value); + g_value_set_uint (value, TP_ENTITY_TYPE_NONE); + g_hash_table_insert (table, TP_IFACE_CHANNEL ".TargetEntityType", value); func (type, table, roomlist_channel_allowed_properties, user_data); @@ -297,7 +297,7 @@ roomlist_channel_closed_cb (GabbleRoomlistChannel *channel, { GabbleRoomlistManager *self = GABBLE_ROOMLIST_MANAGER (user_data); - tp_channel_manager_emit_channel_closed_for_object (self, + tp_channel_manager_emit_channel_closed_for_object (TP_CHANNEL_MANAGER (self), TP_EXPORTABLE_CHANNEL (channel)); if (self->priv->channels != NULL) @@ -322,11 +322,11 @@ gabble_roomlist_manager_handle_request (TpChannelManager *manager, if (tp_strdiff (tp_asv_get_string (request_properties, TP_IFACE_CHANNEL ".ChannelType"), - TP_IFACE_CHANNEL_TYPE_ROOM_LIST)) + TP_IFACE_CHANNEL_TYPE_ROOM_LIST1)) return FALSE; if (tp_asv_get_uint32 (request_properties, - TP_IFACE_CHANNEL ".TargetHandleType", NULL) != 0) + TP_IFACE_CHANNEL ".TargetEntityType", NULL) != 0) { g_set_error (&error, TP_ERROR, TP_ERROR_NOT_IMPLEMENTED, "RoomList channels can't have a target handle"); @@ -340,7 +340,7 @@ gabble_roomlist_manager_handle_request (TpChannelManager *manager, goto error; server = tp_asv_get_string (request_properties, - TP_IFACE_CHANNEL_TYPE_ROOM_LIST ".Server"); + TP_IFACE_CHANNEL_TYPE_ROOM_LIST1 ".Server"); if (server == NULL || server[0] == '\0') { @@ -375,8 +375,9 @@ gabble_roomlist_manager_handle_request (TpChannelManager *manager, if (good) { - tp_channel_manager_emit_request_already_satisfied (self, - request_token, TP_EXPORTABLE_CHANNEL (channel)); + tp_channel_manager_emit_request_already_satisfied ( + TP_CHANNEL_MANAGER (self), request_token, + TP_EXPORTABLE_CHANNEL (channel)); return TRUE; } } @@ -389,15 +390,15 @@ gabble_roomlist_manager_handle_request (TpChannelManager *manager, g_ptr_array_add (self->priv->channels, channel); request_tokens = g_slist_prepend (NULL, request_token); - tp_channel_manager_emit_new_channel (self, + tp_channel_manager_emit_new_channel (TP_CHANNEL_MANAGER (self), TP_EXPORTABLE_CHANNEL (channel), request_tokens); g_slist_free (request_tokens); return TRUE; error: - tp_channel_manager_emit_request_failed (self, request_token, - error->domain, error->code, error->message); + tp_channel_manager_emit_request_failed (TP_CHANNEL_MANAGER (self), + request_token, error->domain, error->code, error->message); g_error_free (error); return TRUE; } @@ -405,30 +406,20 @@ error: static gboolean gabble_roomlist_manager_create_channel (TpChannelManager *manager, - gpointer request_token, - GHashTable *request_properties) + TpChannelManagerRequest *request, + GHashTable *request_properties) { - return gabble_roomlist_manager_handle_request (manager, request_token, + return gabble_roomlist_manager_handle_request (manager, request, request_properties, TRUE); } static gboolean -gabble_roomlist_manager_request_channel (TpChannelManager *manager, - gpointer request_token, - GHashTable *request_properties) -{ - return gabble_roomlist_manager_handle_request (manager, request_token, - request_properties, FALSE); -} - - -static gboolean gabble_roomlist_manager_ensure_channel (TpChannelManager *manager, - gpointer request_token, - GHashTable *request_properties) + TpChannelManagerRequest *request, + GHashTable *request_properties) { - return gabble_roomlist_manager_handle_request (manager, request_token, + return gabble_roomlist_manager_handle_request (manager, request, request_properties, FALSE); } @@ -442,7 +433,6 @@ channel_manager_iface_init (gpointer g_iface, iface->foreach_channel = gabble_roomlist_manager_foreach_channel; iface->type_foreach_channel_class = gabble_roomlist_manager_type_foreach_channel_class; - iface->request_channel = gabble_roomlist_manager_request_channel; iface->create_channel = gabble_roomlist_manager_create_channel; iface->ensure_channel = gabble_roomlist_manager_ensure_channel; } diff --git a/src/roster.c b/src/roster.c index aa07a6034..ed4cb118a 100644 --- a/src/roster.c +++ b/src/roster.c @@ -174,8 +174,7 @@ G_DEFINE_TYPE_WITH_CODE (GabbleRoster, gabble_roster, G_IMPLEMENT_INTERFACE (TP_TYPE_MUTABLE_CONTACT_GROUP_LIST, mutable_contact_groups_iface_init); G_IMPLEMENT_INTERFACE (TP_TYPE_BLOCKABLE_CONTACT_LIST, - blockable_iface_init); - G_IMPLEMENT_INTERFACE (GABBLE_TYPE_CAPS_CHANNEL_MANAGER, NULL)) + blockable_iface_init)) static void gabble_roster_init (GabbleRoster *obj) @@ -406,7 +405,7 @@ _gabble_roster_item_ensure (GabbleRoster *roster, { GabbleRosterPrivate *priv = roster->priv; TpHandleRepoIface *contact_repo = tp_base_connection_get_handles ( - (TpBaseConnection *) priv->conn, TP_HANDLE_TYPE_CONTACT); + (TpBaseConnection *) priv->conn, TP_ENTITY_TYPE_CONTACT); GabbleRosterItem *item; item = _gabble_roster_item_lookup (roster, handle); @@ -452,7 +451,7 @@ _gabble_roster_item_maybe_remove (GabbleRoster *roster, { GabbleRosterPrivate *priv = roster->priv; TpHandleRepoIface *contact_repo = tp_base_connection_get_handles ( - (TpBaseConnection *) priv->conn, TP_HANDLE_TYPE_CONTACT); + (TpBaseConnection *) priv->conn, TP_ENTITY_TYPE_CONTACT); GabbleRosterItem *item; g_assert (roster != NULL); @@ -589,7 +588,7 @@ _gabble_roster_item_update (GabbleRoster *roster, GHashTable *new_groups, *removed_from, *added_to; TpBaseContactList *base = (TpBaseContactList *) roster; TpHandleRepoIface *contact_repo = tp_base_connection_get_handles ( - (TpBaseConnection *) priv->conn, TP_HANDLE_TYPE_CONTACT); + (TpBaseConnection *) priv->conn, TP_ENTITY_TYPE_CONTACT); g_assert (roster != NULL); g_assert (GABBLE_IS_ROSTER (roster)); @@ -832,7 +831,7 @@ _gabble_roster_item_to_message (GabbleRoster *roster, { GabbleRosterPrivate *priv = roster->priv; TpHandleRepoIface *contact_repo = tp_base_connection_get_handles ( - (TpBaseConnection *) priv->conn, TP_HANDLE_TYPE_CONTACT); + (TpBaseConnection *) priv->conn, TP_ENTITY_TYPE_CONTACT); WockyStanza *message; WockyNode *query_node, *item_node; const gchar *jid; @@ -950,7 +949,7 @@ flicker_prevention_timeout (gpointer ctx_) { TpHandleRepoIface *contact_repo = tp_base_connection_get_handles ( (TpBaseConnection *) ctx->roster->priv->conn, - TP_HANDLE_TYPE_CONTACT); + TP_ENTITY_TYPE_CONTACT); TpHandleSet *rem = tp_handle_set_new (contact_repo); DEBUG ("removing %u from subscribe", ctx->handle); @@ -1112,7 +1111,7 @@ process_roster ( GabbleRosterPrivate *priv = roster->priv; TpBaseConnection *conn = (TpBaseConnection *) priv->conn; TpHandleRepoIface *contact_repo = tp_base_connection_get_handles (conn, - TP_HANDLE_TYPE_CONTACT); + TP_ENTITY_TYPE_CONTACT); GArray *updated_nicknames = g_array_new (FALSE, FALSE, sizeof (TpHandle)); /* asymmetry is because we don't get locally pending subscription @@ -1547,7 +1546,7 @@ gabble_roster_presence_cb (WockyPorter *porter, GabbleRosterPrivate *priv = roster->priv; TpBaseConnection *conn = (TpBaseConnection *) priv->conn; TpHandleRepoIface *contact_repo = tp_base_connection_get_handles (conn, - TP_HANDLE_TYPE_CONTACT); + TP_ENTITY_TYPE_CONTACT); WockyNode *pres_node, *child_node; const char *from; WockyStanzaSubType sub_type; @@ -1880,7 +1879,7 @@ gabble_roster_constructed (GObject *obj) g_assert (GABBLE_IS_CONNECTION (self->priv->conn)); contact_repo = tp_base_connection_get_handles ( - (TpBaseConnection *) self->priv->conn, TP_HANDLE_TYPE_CONTACT); + (TpBaseConnection *) self->priv->conn, TP_ENTITY_TYPE_CONTACT); self->priv->status_changed_id = g_signal_connect (self->priv->conn, "status-changed", (GCallback) connection_status_changed_cb, obj); @@ -1959,7 +1958,7 @@ roster_item_cancel_subscriptions ( GError **error) { TpHandleRepoIface *contact_repo = tp_base_connection_get_handles ( - (TpBaseConnection *) roster->priv->conn, TP_HANDLE_TYPE_CONTACT); + (TpBaseConnection *) roster->priv->conn, TP_ENTITY_TYPE_CONTACT); const gchar *contact_id = tp_handle_inspect (contact_repo, contact); gboolean ret = TRUE; @@ -2273,7 +2272,7 @@ gabble_roster_handle_set_blocked (GabbleRoster *roster, { GabbleRosterPrivate *priv = roster->priv; TpHandleRepoIface *contact_repo = tp_base_connection_get_handles ( - (TpBaseConnection *) priv->conn, TP_HANDLE_TYPE_CONTACT); + (TpBaseConnection *) priv->conn, TP_ENTITY_TYPE_CONTACT); GabbleRosterItem *item; g_return_if_fail (roster != NULL); @@ -2309,7 +2308,7 @@ gabble_roster_handle_has_entry (GabbleRoster *roster, { GabbleRosterPrivate *priv = roster->priv; TpHandleRepoIface *contact_repo = tp_base_connection_get_handles ( - (TpBaseConnection *) priv->conn, TP_HANDLE_TYPE_CONTACT); + (TpBaseConnection *) priv->conn, TP_ENTITY_TYPE_CONTACT); GabbleRosterItem *item; g_return_val_if_fail (roster != NULL, FALSE); @@ -2328,7 +2327,7 @@ gabble_roster_handle_get_name (GabbleRoster *roster, { GabbleRosterPrivate *priv = roster->priv; TpHandleRepoIface *contact_repo = tp_base_connection_get_handles ( - (TpBaseConnection *) priv->conn, TP_HANDLE_TYPE_CONTACT); + (TpBaseConnection *) priv->conn, TP_ENTITY_TYPE_CONTACT); GabbleRosterItem *item; g_return_val_if_fail (roster != NULL, NULL); @@ -2352,7 +2351,7 @@ gabble_roster_handle_set_name (GabbleRoster *roster, { GabbleRosterPrivate *priv = roster->priv; TpHandleRepoIface *contact_repo = tp_base_connection_get_handles ( - (TpBaseConnection *) priv->conn, TP_HANDLE_TYPE_CONTACT); + (TpBaseConnection *) priv->conn, TP_ENTITY_TYPE_CONTACT); GabbleRosterItem *item; g_return_val_if_fail (roster != NULL, FALSE); @@ -2396,7 +2395,7 @@ gabble_roster_handle_remove (GabbleRoster *roster, GabbleRosterPrivate *priv = roster->priv; TpBaseContactList *base = (TpBaseContactList *) roster; TpHandleRepoIface *contact_repo = tp_base_connection_get_handles ( - (TpBaseConnection *) priv->conn, TP_HANDLE_TYPE_CONTACT); + (TpBaseConnection *) priv->conn, TP_ENTITY_TYPE_CONTACT); GabbleRosterItem *item; g_return_if_fail (roster != NULL); @@ -2454,7 +2453,7 @@ gabble_roster_handle_add (GabbleRoster *roster, { GabbleRosterPrivate *priv = roster->priv; TpHandleRepoIface *contact_repo = tp_base_connection_get_handles ( - (TpBaseConnection *) priv->conn, TP_HANDLE_TYPE_CONTACT); + (TpBaseConnection *) priv->conn, TP_ENTITY_TYPE_CONTACT); GabbleRosterItem *item; gboolean do_add = FALSE; @@ -2501,7 +2500,7 @@ gabble_roster_handle_add_to_group (GabbleRoster *roster, { GabbleRosterPrivate *priv = roster->priv; TpHandleRepoIface *contact_repo = tp_base_connection_get_handles ( - (TpBaseConnection *) priv->conn, TP_HANDLE_TYPE_CONTACT); + (TpBaseConnection *) priv->conn, TP_ENTITY_TYPE_CONTACT); GabbleRosterItem *item; g_return_if_fail (roster != NULL); @@ -2543,7 +2542,7 @@ gabble_roster_handle_remove_from_group (GabbleRoster *roster, { GabbleRosterPrivate *priv = roster->priv; TpHandleRepoIface *contact_repo = tp_base_connection_get_handles ( - (TpBaseConnection *) priv->conn, TP_HANDLE_TYPE_CONTACT); + (TpBaseConnection *) priv->conn, TP_ENTITY_TYPE_CONTACT); GabbleRosterItem *item; g_return_if_fail (roster != NULL); @@ -2586,7 +2585,7 @@ gabble_roster_handle_subscribed ( GError **error) { TpHandleRepoIface *contact_repo = tp_base_connection_get_handles ( - (TpBaseConnection *) roster->priv->conn, TP_HANDLE_TYPE_CONTACT); + (TpBaseConnection *) roster->priv->conn, TP_ENTITY_TYPE_CONTACT); const gchar *contact_id = tp_handle_inspect (contact_repo, handle); /* send <presence type="subscribed"> */ @@ -2600,7 +2599,7 @@ gabble_roster_dup_contacts (TpBaseContactList *base) GabbleRoster *self = GABBLE_ROSTER (base); TpHandleSet *set; TpHandleRepoIface *contact_repo = tp_base_connection_get_handles ( - (TpBaseConnection *) self->priv->conn, TP_HANDLE_TYPE_CONTACT); + (TpBaseConnection *) self->priv->conn, TP_ENTITY_TYPE_CONTACT); GHashTableIter iter; gpointer k, v; @@ -2670,7 +2669,7 @@ gabble_roster_request_subscription_added_cb (GObject *source, { GabbleRoster *self = GABBLE_ROSTER (source); TpHandleRepoIface *contact_repo = tp_base_connection_get_handles ( - (TpBaseConnection *) self->priv->conn, TP_HANDLE_TYPE_CONTACT); + (TpBaseConnection *) self->priv->conn, TP_ENTITY_TYPE_CONTACT); SubscribeContext *context = user_data; GError *error = NULL; TpIntsetFastIter iter; @@ -2759,7 +2758,7 @@ gabble_roster_authorize_publication_async (TpBaseContactList *base, TpHandle contact; GError *error = NULL; TpHandleRepoIface *contact_repo = tp_base_connection_get_handles ( - (TpBaseConnection *) self->priv->conn, TP_HANDLE_TYPE_CONTACT); + (TpBaseConnection *) self->priv->conn, TP_ENTITY_TYPE_CONTACT); tp_intset_fast_iter_init (&iter, tp_handle_set_peek (contacts)); @@ -2851,7 +2850,7 @@ gabble_roster_unsubscribe_async (TpBaseContactList *base, { GabbleRoster *self = GABBLE_ROSTER (base); TpHandleRepoIface *contact_repo = tp_base_connection_get_handles ( - (TpBaseConnection *) self->priv->conn, TP_HANDLE_TYPE_CONTACT); + (TpBaseConnection *) self->priv->conn, TP_ENTITY_TYPE_CONTACT); TpHandleSet *changed = tp_handle_set_new (contact_repo); TpHandleSet *removed = tp_handle_set_new (contact_repo); TpIntsetFastIter iter; @@ -2912,7 +2911,7 @@ gabble_roster_unpublish_async (TpBaseContactList *base, { GabbleRoster *self = GABBLE_ROSTER (base); TpHandleRepoIface *contact_repo = tp_base_connection_get_handles ( - (TpBaseConnection *) self->priv->conn, TP_HANDLE_TYPE_CONTACT); + (TpBaseConnection *) self->priv->conn, TP_ENTITY_TYPE_CONTACT); TpHandleSet *changed = tp_handle_set_new (contact_repo); TpHandleSet *removed = tp_handle_set_new (contact_repo); TpIntsetFastIter iter; @@ -3015,13 +3014,23 @@ gabble_roster_download_async (TpBaseContactList *base, g_clear_error (&error); } +static gboolean +gabble_roster_is_blocked (TpBaseContactList *base, + TpHandle contact) +{ + GabbleRoster *self = GABBLE_ROSTER (base); + GabbleRosterItem *item = _gabble_roster_item_lookup (self, contact); + + return (item != NULL && item->blocked); +} + static TpHandleSet * gabble_roster_dup_blocked_contacts (TpBaseContactList *base) { GabbleRoster *self = GABBLE_ROSTER (base); TpHandleSet *set; TpHandleRepoIface *contact_repo = tp_base_connection_get_handles ( - (TpBaseConnection *) self->priv->conn, TP_HANDLE_TYPE_CONTACT); + (TpBaseConnection *) self->priv->conn, TP_ENTITY_TYPE_CONTACT); GHashTableIter iter; gpointer k, v; @@ -3160,7 +3169,7 @@ gabble_roster_dup_group_members (TpBaseContactList *base, GabbleRoster *self = GABBLE_ROSTER (base); TpHandleSet *set; TpHandleRepoIface *contact_repo = tp_base_connection_get_handles ( - (TpBaseConnection *) self->priv->conn, TP_HANDLE_TYPE_CONTACT); + (TpBaseConnection *) self->priv->conn, TP_ENTITY_TYPE_CONTACT); GHashTableIter iter; gpointer k, v; @@ -3191,7 +3200,7 @@ gabble_roster_set_contact_groups_async (TpBaseContactList *base, GabbleRoster *self = GABBLE_ROSTER (base); GabbleRosterItem *item = _gabble_roster_item_ensure (self, contact); TpHandleRepoIface *contact_repo = tp_base_connection_get_handles ( - (TpBaseConnection *) self->priv->conn, TP_HANDLE_TYPE_CONTACT); + (TpBaseConnection *) self->priv->conn, TP_ENTITY_TYPE_CONTACT); GHashTable *groups_set = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL); GPtrArray *groups_created = g_ptr_array_new (); @@ -3428,7 +3437,7 @@ gabble_roster_remove_group_async (TpBaseContactList *base, GHashTableIter iter; gpointer k, v; TpHandleRepoIface *contact_repo = tp_base_connection_get_handles ( - (TpBaseConnection *) self->priv->conn, TP_HANDLE_TYPE_CONTACT); + (TpBaseConnection *) self->priv->conn, TP_ENTITY_TYPE_CONTACT); GSimpleAsyncResult *result; RemoveGroupContext *context; @@ -3485,6 +3494,7 @@ static void blockable_iface_init (TpBlockableContactListInterface *iface) { iface->can_block = gabble_roster_can_block; + iface->is_blocked = gabble_roster_is_blocked; iface->dup_blocked_contacts = gabble_roster_dup_blocked_contacts; iface->block_contacts_async = gabble_roster_block_contacts_async; iface->unblock_contacts_async = gabble_roster_unblock_contacts_async; @@ -3540,7 +3550,7 @@ gabble_roster_handle_sends_presence_to_us (GabbleRoster *self, TpHandle handle) { TpHandleRepoIface *contact_repo = tp_base_connection_get_handles ( - (TpBaseConnection *) self->priv->conn, TP_HANDLE_TYPE_CONTACT); + (TpBaseConnection *) self->priv->conn, TP_ENTITY_TYPE_CONTACT); GabbleRosterItem *item; g_return_val_if_fail (GABBLE_IS_ROSTER (self), FALSE); @@ -3561,7 +3571,7 @@ gabble_roster_handle_gets_presence_from_us (GabbleRoster *self, TpHandle handle) { TpHandleRepoIface *contact_repo = tp_base_connection_get_handles ( - (TpBaseConnection *) self->priv->conn, TP_HANDLE_TYPE_CONTACT); + (TpBaseConnection *) self->priv->conn, TP_ENTITY_TYPE_CONTACT); GabbleRosterItem *item; g_return_val_if_fail (GABBLE_IS_ROSTER (self), FALSE); diff --git a/src/search-channel.c b/src/search-channel.c index ab8a7d12d..89ca7b907 100644 --- a/src/search-channel.c +++ b/src/search-channel.c @@ -96,7 +96,7 @@ static void contact_search_iface_init (gpointer, gpointer); G_DEFINE_TYPE_WITH_CODE (GabbleSearchChannel, gabble_search_channel, TP_TYPE_BASE_CHANNEL, - G_IMPLEMENT_INTERFACE (TP_TYPE_SVC_CHANNEL_TYPE_CONTACT_SEARCH, + G_IMPLEMENT_INTERFACE (TP_TYPE_SVC_CHANNEL_TYPE_CONTACT_SEARCH1, contact_search_iface_init); ) @@ -502,7 +502,7 @@ change_search_state (GabbleSearchChannel *chan, states[state], error_name == NULL ? "" : error_name); priv->state = state; - tp_svc_channel_type_contact_search_emit_search_state_changed ( + tp_svc_channel_type_contact_search1_emit_search_state_changed ( chan, state, (error_name == NULL ? "" : error_name), details); g_hash_table_unref (details); @@ -794,7 +794,7 @@ search_reply_cb (GabbleConnection *conn, if (err == NULL) { /* fire SearchStateChanged */ - tp_svc_channel_type_contact_search_emit_search_result_received (chan, + tp_svc_channel_type_contact_search1_emit_search_result_received (chan, chan->priv->results); change_search_state (chan, TP_CHANNEL_CONTACT_SEARCH_STATE_COMPLETED, @@ -996,7 +996,7 @@ gabble_search_channel_constructor (GType type, conn = tp_base_channel_get_connection (base); chan->priv->result_handles = tp_handle_set_new ( - tp_base_connection_get_handles (conn, TP_HANDLE_TYPE_CONTACT)); + tp_base_connection_get_handles (conn, TP_ENTITY_TYPE_CONTACT)); chan->priv->tp_to_xmpp = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_free); @@ -1097,9 +1097,9 @@ gabble_search_channel_fill_immutable_properties ( tp_dbus_properties_mixin_fill_properties_hash ( G_OBJECT (chan), properties, - TP_IFACE_CHANNEL_TYPE_CONTACT_SEARCH, "AvailableSearchKeys", - TP_IFACE_CHANNEL_TYPE_CONTACT_SEARCH, "Server", - TP_IFACE_CHANNEL_TYPE_CONTACT_SEARCH, "Limit", + TP_IFACE_CHANNEL_TYPE_CONTACT_SEARCH1, "AvailableSearchKeys", + TP_IFACE_CHANNEL_TYPE_CONTACT_SEARCH1, "Server", + TP_IFACE_CHANNEL_TYPE_CONTACT_SEARCH1, "Limit", NULL); } @@ -1138,8 +1138,8 @@ gabble_search_channel_class_init (GabbleSearchChannelClass *klass) object_class->get_property = gabble_search_channel_get_property; object_class->set_property = gabble_search_channel_set_property; - base_class->channel_type = TP_IFACE_CHANNEL_TYPE_CONTACT_SEARCH; - base_class->target_handle_type = TP_HANDLE_TYPE_NONE; + base_class->channel_type = TP_IFACE_CHANNEL_TYPE_CONTACT_SEARCH1; + base_class->target_entity_type = TP_ENTITY_TYPE_NONE; base_class->fill_immutable_properties = gabble_search_channel_fill_immutable_properties; base_class->get_object_path_suffix = @@ -1196,7 +1196,7 @@ gabble_search_channel_class_init (GabbleSearchChannelClass *klass) G_TYPE_NONE, 3, G_TYPE_UINT, G_TYPE_INT, G_TYPE_STRING); tp_dbus_properties_mixin_implement_interface (object_class, - TP_IFACE_QUARK_CHANNEL_TYPE_CONTACT_SEARCH, + TP_IFACE_QUARK_CHANNEL_TYPE_CONTACT_SEARCH1, tp_dbus_properties_mixin_getter_gobject_properties, NULL, search_channel_props); @@ -1204,7 +1204,7 @@ gabble_search_channel_class_init (GabbleSearchChannelClass *klass) } static void -gabble_search_channel_search (TpSvcChannelTypeContactSearch *self, +gabble_search_channel_search (TpSvcChannelTypeContactSearch1 *self, GHashTable *terms, DBusGMethodInvocation *context) { @@ -1221,7 +1221,7 @@ gabble_search_channel_search (TpSvcChannelTypeContactSearch *self, if (do_search (chan, terms, &error)) { - tp_svc_channel_type_contact_search_return_from_search (context); + tp_svc_channel_type_contact_search1_return_from_search (context); return; } @@ -1231,7 +1231,7 @@ err: } static void -gabble_search_channel_stop (TpSvcChannelTypeContactSearch *self, +gabble_search_channel_stop (TpSvcChannelTypeContactSearch1 *self, DBusGMethodInvocation *context) { GabbleSearchChannel *chan = GABBLE_SEARCH_CHANNEL (self); @@ -1249,7 +1249,7 @@ gabble_search_channel_stop (TpSvcChannelTypeContactSearch *self, } case TP_CHANNEL_CONTACT_SEARCH_STATE_COMPLETED: case TP_CHANNEL_CONTACT_SEARCH_STATE_FAILED: - tp_svc_channel_type_contact_search_return_from_stop (context); + tp_svc_channel_type_contact_search1_return_from_stop (context); break; case TP_CHANNEL_CONTACT_SEARCH_STATE_NOT_STARTED: { @@ -1274,9 +1274,9 @@ static void contact_search_iface_init (gpointer g_iface, gpointer iface_data) { - TpSvcChannelTypeContactSearchClass *klass = g_iface; + TpSvcChannelTypeContactSearch1Class *klass = g_iface; -#define IMPLEMENT(x) tp_svc_channel_type_contact_search_implement_##x (\ +#define IMPLEMENT(x) tp_svc_channel_type_contact_search1_implement_##x (\ klass, gabble_search_channel_##x) IMPLEMENT(search); IMPLEMENT(stop); diff --git a/src/search-manager.c b/src/search-manager.c index e0af6eb4a..a6b95e59c 100644 --- a/src/search-manager.c +++ b/src/search-manager.c @@ -147,8 +147,8 @@ disco_done_cb (GabbleDisco *disco, } else { - tp_channel_manager_emit_request_failed (self, request_token, - TP_ERROR, TP_ERROR_INVALID_ARGUMENT, + tp_channel_manager_emit_request_failed (TP_CHANNEL_MANAGER (self), + request_token, TP_ERROR, TP_ERROR_INVALID_ARGUMENT, "No Server has been specified and no server has been " "discovered on the connection"); } @@ -319,7 +319,7 @@ static const gchar * const search_channel_fixed_properties[] = { }; static const gchar * const search_channel_allowed_properties[] = { - TP_IFACE_CHANNEL_TYPE_CONTACT_SEARCH ".Server", + TP_IFACE_CHANNEL_TYPE_CONTACT_SEARCH1 ".Server", NULL }; @@ -334,7 +334,7 @@ gabble_search_manager_type_foreach_channel_class (GType type, GValue *value; value = tp_g_value_slice_new_string ( - TP_IFACE_CHANNEL_TYPE_CONTACT_SEARCH); + TP_IFACE_CHANNEL_TYPE_CONTACT_SEARCH1); g_hash_table_insert (table, (gchar *) search_channel_fixed_properties[0], value); @@ -354,7 +354,7 @@ static void search_channel_closed_cb (GabbleSearchChannel *chan, GabbleSearchManager *self) { - tp_channel_manager_emit_channel_closed_for_object (self, + tp_channel_manager_emit_channel_closed_for_object (TP_CHANNEL_MANAGER (self), (TpExportableChannel *) chan); remove_search_channel (self, chan); } @@ -398,7 +398,7 @@ search_channel_ready_or_not_cb (GabbleSearchChannel *chan, { GSList *request_tokens = g_slist_prepend (NULL, ctx->request_token); - tp_channel_manager_emit_new_channel (ctx->self, + tp_channel_manager_emit_new_channel (TP_CHANNEL_MANAGER (ctx->self), (TpExportableChannel *) chan, request_tokens); g_slist_free (request_tokens); @@ -426,7 +426,7 @@ search_channel_ready_or_not_cb (GabbleSearchChannel *chan, g_assert (domain == TP_ERROR); } - tp_channel_manager_emit_request_failed (ctx->self, + tp_channel_manager_emit_request_failed (TP_CHANNEL_MANAGER (ctx->self), ctx->request_token, domain, code, message); remove_search_channel (ctx->self, chan); } @@ -460,8 +460,8 @@ new_search_channel (GabbleSearchManager *self, static gboolean gabble_search_manager_create_channel (TpChannelManager *manager, - gpointer request_token, - GHashTable *request_properties) + TpChannelManagerRequest *request, + GHashTable *request_properties) { GabbleSearchManager *self = GABBLE_SEARCH_MANAGER (manager); GError *error = NULL; @@ -471,7 +471,7 @@ gabble_search_manager_create_channel (TpChannelManager *manager, channel_type = tp_asv_get_string (request_properties, TP_IFACE_CHANNEL ".ChannelType"); - if (tp_strdiff (channel_type, TP_IFACE_CHANNEL_TYPE_CONTACT_SEARCH)) + if (tp_strdiff (channel_type, TP_IFACE_CHANNEL_TYPE_CONTACT_SEARCH1)) return FALSE; if (tp_channel_manager_asv_has_unknown_properties (request_properties, @@ -480,7 +480,7 @@ gabble_search_manager_create_channel (TpChannelManager *manager, goto error; server = tp_asv_get_string (request_properties, - TP_IFACE_CHANNEL_TYPE_CONTACT_SEARCH ".Server"); + TP_IFACE_CHANNEL_TYPE_CONTACT_SEARCH1 ".Server"); if (tp_str_empty (server)) { @@ -513,7 +513,7 @@ gabble_search_manager_create_channel (TpChannelManager *manager, "the disco process"); self->priv->requests_waiting_disco = g_slist_append ( - self->priv->requests_waiting_disco, request_token); + self->priv->requests_waiting_disco, request); return TRUE; } @@ -521,12 +521,12 @@ gabble_search_manager_create_channel (TpChannelManager *manager, server = self->priv->default_jud; } - new_search_channel (self, server, request_token); + new_search_channel (self, server, request); return TRUE; error: - tp_channel_manager_emit_request_failed (self, request_token, - error->domain, error->code, error->message); + tp_channel_manager_emit_request_failed (TP_CHANNEL_MANAGER (self), + request, error->domain, error->code, error->message); g_error_free (error); return TRUE; } @@ -542,7 +542,6 @@ channel_manager_iface_init (gpointer g_iface, gabble_search_manager_type_foreach_channel_class; iface->create_channel = gabble_search_manager_create_channel; - iface->request_channel = gabble_search_manager_create_channel; /* Ensuring these channels doesn't really make much sense. */ iface->ensure_channel = NULL; diff --git a/src/server-sasl-channel.c b/src/server-sasl-channel.c index 9ff85054a..aae40ee57 100644 --- a/src/server-sasl-channel.c +++ b/src/server-sasl-channel.c @@ -52,11 +52,11 @@ static void sasl_auth_iface_init (gpointer, gpointer); G_DEFINE_TYPE_WITH_CODE (GabbleServerSaslChannel, gabble_server_sasl_channel, TP_TYPE_BASE_CHANNEL, G_IMPLEMENT_INTERFACE ( - TP_TYPE_SVC_CHANNEL_TYPE_SERVER_AUTHENTICATION, + TP_TYPE_SVC_CHANNEL_TYPE_SERVER_AUTHENTICATION1, NULL); - G_IMPLEMENT_INTERFACE (TP_TYPE_SVC_CHANNEL_INTERFACE_SECURABLE, NULL); + G_IMPLEMENT_INTERFACE (TP_TYPE_SVC_CHANNEL_INTERFACE_SECURABLE1, NULL); G_IMPLEMENT_INTERFACE ( - TP_TYPE_SVC_CHANNEL_INTERFACE_SASL_AUTHENTICATION, + TP_TYPE_SVC_CHANNEL_INTERFACE_SASL_AUTHENTICATION1, sasl_auth_iface_init)); enum @@ -106,8 +106,8 @@ gabble_server_sasl_channel_get_interfaces (TpBaseChannel *base) interfaces = TP_BASE_CHANNEL_CLASS ( gabble_server_sasl_channel_parent_class)->get_interfaces (base); - g_ptr_array_add (interfaces, TP_IFACE_CHANNEL_INTERFACE_SASL_AUTHENTICATION); - g_ptr_array_add (interfaces, TP_IFACE_CHANNEL_INTERFACE_SECURABLE); + g_ptr_array_add (interfaces, TP_IFACE_CHANNEL_INTERFACE_SASL_AUTHENTICATION1); + g_ptr_array_add (interfaces, TP_IFACE_CHANNEL_INTERFACE_SECURABLE1); return interfaces; } @@ -136,18 +136,18 @@ gabble_server_sasl_channel_fill_immutable_properties (TpBaseChannel *channel, tp_dbus_properties_mixin_fill_properties_hash (G_OBJECT (channel), properties, - TP_IFACE_CHANNEL_TYPE_SERVER_AUTHENTICATION, "AuthenticationMethod", - TP_IFACE_CHANNEL_INTERFACE_SASL_AUTHENTICATION, + TP_IFACE_CHANNEL_TYPE_SERVER_AUTHENTICATION1, "AuthenticationMethod", + TP_IFACE_CHANNEL_INTERFACE_SASL_AUTHENTICATION1, "AvailableMechanisms", - TP_IFACE_CHANNEL_INTERFACE_SASL_AUTHENTICATION, "HasInitialData", - TP_IFACE_CHANNEL_INTERFACE_SASL_AUTHENTICATION, "CanTryAgain", - TP_IFACE_CHANNEL_INTERFACE_SASL_AUTHENTICATION, + TP_IFACE_CHANNEL_INTERFACE_SASL_AUTHENTICATION1, "HasInitialData", + TP_IFACE_CHANNEL_INTERFACE_SASL_AUTHENTICATION1, "CanTryAgain", + TP_IFACE_CHANNEL_INTERFACE_SASL_AUTHENTICATION1, "AuthorizationIdentity", - TP_IFACE_CHANNEL_INTERFACE_SASL_AUTHENTICATION, "DefaultRealm", - TP_IFACE_CHANNEL_INTERFACE_SASL_AUTHENTICATION, + TP_IFACE_CHANNEL_INTERFACE_SASL_AUTHENTICATION1, "DefaultRealm", + TP_IFACE_CHANNEL_INTERFACE_SASL_AUTHENTICATION1, "DefaultUsername", - TP_IFACE_CHANNEL_INTERFACE_SECURABLE, "Encrypted", - TP_IFACE_CHANNEL_INTERFACE_SECURABLE, "Verified", + TP_IFACE_CHANNEL_INTERFACE_SECURABLE1, "Encrypted", + TP_IFACE_CHANNEL_INTERFACE_SECURABLE1, "Verified", NULL); } @@ -181,7 +181,7 @@ gabble_server_sasl_channel_get_property (GObject *object, break; case PROP_AUTH_METHOD: g_value_set_static_string (value, - TP_IFACE_CHANNEL_INTERFACE_SASL_AUTHENTICATION); + TP_IFACE_CHANNEL_INTERFACE_SASL_AUTHENTICATION1); break; case PROP_AVAILABLE_MECHANISMS: g_value_set_boxed (value, priv->available_mechanisms); @@ -311,17 +311,17 @@ gabble_server_sasl_channel_class_init (GabbleServerSaslChannelClass *klass) { NULL } }; static TpDBusPropertiesMixinIfaceImpl prop_interfaces[] = { - { TP_IFACE_CHANNEL_TYPE_SERVER_AUTHENTICATION, + { TP_IFACE_CHANNEL_TYPE_SERVER_AUTHENTICATION1, tp_dbus_properties_mixin_getter_gobject_properties, NULL, server_auth_props, }, - { TP_IFACE_CHANNEL_INTERFACE_SASL_AUTHENTICATION, + { TP_IFACE_CHANNEL_INTERFACE_SASL_AUTHENTICATION1, tp_dbus_properties_mixin_getter_gobject_properties, NULL, sasl_auth_props, }, - { TP_IFACE_CHANNEL_INTERFACE_SECURABLE, + { TP_IFACE_CHANNEL_INTERFACE_SECURABLE1, tp_dbus_properties_mixin_getter_gobject_properties, NULL, securable_props, @@ -339,9 +339,9 @@ gabble_server_sasl_channel_class_init (GabbleServerSaslChannelClass *klass) object_class->finalize = gabble_server_sasl_channel_finalize; channel_class->channel_type = - TP_IFACE_CHANNEL_TYPE_SERVER_AUTHENTICATION; + TP_IFACE_CHANNEL_TYPE_SERVER_AUTHENTICATION1; channel_class->get_interfaces = gabble_server_sasl_channel_get_interfaces; - channel_class->target_handle_type = TP_HANDLE_TYPE_NONE; + channel_class->target_entity_type = TP_ENTITY_TYPE_NONE; channel_class->fill_immutable_properties = gabble_server_sasl_channel_fill_immutable_properties; channel_class->get_object_path_suffix = @@ -351,7 +351,7 @@ gabble_server_sasl_channel_class_init (GabbleServerSaslChannelClass *klass) param_spec = g_param_spec_string ("auth-method", "Authentication method", "Method of authentication (D-Bus interface)", - TP_IFACE_CHANNEL_INTERFACE_SASL_AUTHENTICATION, + TP_IFACE_CHANNEL_INTERFACE_SASL_AUTHENTICATION1, G_PARAM_READABLE | G_PARAM_STATIC_STRINGS); g_object_class_install_property (object_class, PROP_AUTH_METHOD, param_spec); @@ -458,7 +458,7 @@ change_current_state (GabbleServerSaslChannel *self, { self->priv->sasl_status = status; - tp_svc_channel_interface_sasl_authentication_emit_sasl_status_changed ( + tp_svc_channel_interface_sasl_authentication1_emit_sasl_status_changed ( self, self->priv->sasl_status, self->priv->sasl_error, self->priv->sasl_error_details); @@ -512,7 +512,7 @@ gabble_server_sasl_channel_raise (DBusGMethodInvocation *context, * from D-Bus as StartMechanismWithData, it can't. */ static void gabble_server_sasl_channel_start_mechanism_with_data ( - TpSvcChannelInterfaceSASLAuthentication *iface, + TpSvcChannelInterfaceSASLAuthentication1 *iface, const gchar *in_Mechanism, const GArray *in_InitialData, DBusGMethodInvocation *context) @@ -578,7 +578,7 @@ gabble_server_sasl_channel_start_mechanism_with_data ( static void gabble_server_sasl_channel_start_mechanism ( - TpSvcChannelInterfaceSASLAuthentication *iface, + TpSvcChannelInterfaceSASLAuthentication1 *iface, const gchar *mech, DBusGMethodInvocation *context) { @@ -588,7 +588,7 @@ gabble_server_sasl_channel_start_mechanism ( static void gabble_server_sasl_channel_respond ( - TpSvcChannelInterfaceSASLAuthentication *channel, + TpSvcChannelInterfaceSASLAuthentication1 *channel, const GArray *in_Response_Data, DBusGMethodInvocation *context) { @@ -632,13 +632,13 @@ gabble_server_sasl_channel_respond ( (GDestroyNotify) wocky_g_string_free); complete_operation (self, TRUE); - tp_svc_channel_interface_sasl_authentication_return_from_respond ( + tp_svc_channel_interface_sasl_authentication1_return_from_respond ( context); } static void gabble_server_sasl_channel_accept_sasl ( - TpSvcChannelInterfaceSASLAuthentication *channel, + TpSvcChannelInterfaceSASLAuthentication1 *channel, DBusGMethodInvocation *context) { GabbleServerSaslChannel *self = GABBLE_SERVER_SASL_CHANNEL (channel); @@ -722,13 +722,13 @@ gabble_server_sasl_channel_accept_sasl ( complete_operation (self, FALSE); } - tp_svc_channel_interface_sasl_authentication_return_from_accept_sasl ( + tp_svc_channel_interface_sasl_authentication1_return_from_accept_sasl ( context); } static void gabble_server_sasl_channel_abort_sasl ( - TpSvcChannelInterfaceSASLAuthentication *channel, + TpSvcChannelInterfaceSASLAuthentication1 *channel, guint in_Reason, const gchar *in_Debug_Message, DBusGMethodInvocation *context) @@ -805,7 +805,7 @@ gabble_server_sasl_channel_abort_sasl ( g_assert_not_reached (); } - tp_svc_channel_interface_sasl_authentication_return_from_abort_sasl ( + tp_svc_channel_interface_sasl_authentication1_return_from_abort_sasl ( context); } @@ -814,7 +814,7 @@ sasl_auth_iface_init (gpointer klass, gpointer unused G_GNUC_UNUSED) { #define IMPLEMENT(x) \ - tp_svc_channel_interface_sasl_authentication_implement_##x ( \ + tp_svc_channel_interface_sasl_authentication1_implement_##x ( \ klass, gabble_server_sasl_channel_##x) IMPLEMENT (start_mechanism); IMPLEMENT (start_mechanism_with_data); @@ -878,7 +878,7 @@ gabble_server_sasl_channel_challenge_async (GabbleServerSaslChannel *self, g_array_append_vals (challenge_ay, challenge_data->str, challenge_data->len); - tp_svc_channel_interface_sasl_authentication_emit_new_challenge ( + tp_svc_channel_interface_sasl_authentication1_emit_new_challenge ( self, challenge_ay); break; case TP_SASL_STATUS_CLIENT_FAILED: diff --git a/src/server-tls-channel.c b/src/server-tls-channel.c index aae0aadc8..7b3c0c658 100644 --- a/src/server-tls-channel.c +++ b/src/server-tls-channel.c @@ -34,7 +34,7 @@ G_DEFINE_TYPE_WITH_CODE (GabbleServerTLSChannel, gabble_server_tls_channel, TP_TYPE_BASE_CHANNEL, - G_IMPLEMENT_INTERFACE (TP_TYPE_SVC_CHANNEL_TYPE_SERVER_TLS_CONNECTION, + G_IMPLEMENT_INTERFACE (TP_TYPE_SVC_CHANNEL_TYPE_SERVER_TLS_CONNECTION1, NULL)); static void gabble_server_tls_channel_close (TpBaseChannel *base); @@ -212,9 +212,9 @@ gabble_server_tls_channel_fill_immutable_properties ( tp_dbus_properties_mixin_fill_properties_hash ( G_OBJECT (chan), properties, - TP_IFACE_CHANNEL_TYPE_SERVER_TLS_CONNECTION, "ServerCertificate", - TP_IFACE_CHANNEL_TYPE_SERVER_TLS_CONNECTION, "Hostname", - TP_IFACE_CHANNEL_TYPE_SERVER_TLS_CONNECTION, "ReferenceIdentities", + TP_IFACE_CHANNEL_TYPE_SERVER_TLS_CONNECTION1, "ServerCertificate", + TP_IFACE_CHANNEL_TYPE_SERVER_TLS_CONNECTION1, "Hostname", + TP_IFACE_CHANNEL_TYPE_SERVER_TLS_CONNECTION1, "ReferenceIdentities", NULL); } @@ -255,8 +255,8 @@ gabble_server_tls_channel_class_init (GabbleServerTLSChannelClass *klass) oclass->finalize = gabble_server_tls_channel_finalize; oclass->constructed = gabble_server_tls_channel_constructed; - base_class->channel_type = TP_IFACE_CHANNEL_TYPE_SERVER_TLS_CONNECTION; - base_class->target_handle_type = TP_HANDLE_TYPE_NONE; + base_class->channel_type = TP_IFACE_CHANNEL_TYPE_SERVER_TLS_CONNECTION1; + base_class->target_entity_type = TP_ENTITY_TYPE_NONE; base_class->fill_immutable_properties = gabble_server_tls_channel_fill_immutable_properties; base_class->get_object_path_suffix = @@ -289,7 +289,7 @@ gabble_server_tls_channel_class_init (GabbleServerTLSChannelClass *klass) g_object_class_install_property (oclass, PROP_TLS_SESSION, pspec); tp_dbus_properties_mixin_implement_interface (oclass, - TP_IFACE_QUARK_CHANNEL_TYPE_SERVER_TLS_CONNECTION, + TP_IFACE_QUARK_CHANNEL_TYPE_SERVER_TLS_CONNECTION1, tp_dbus_properties_mixin_getter_gobject_properties, NULL, server_tls_props); } diff --git a/src/server-tls-manager.c b/src/server-tls-manager.c index 6a23c998a..92f7d1b15 100644 --- a/src/server-tls-manager.c +++ b/src/server-tls-manager.c @@ -218,7 +218,7 @@ server_tls_channel_closed_cb (GabbleServerTLSChannel *channel, self->priv->completed_channels, l); } - tp_channel_manager_emit_channel_closed_for_object (self, + tp_channel_manager_emit_channel_closed_for_object (TP_CHANNEL_MANAGER (self), TP_EXPORTABLE_CHANNEL (channel)); g_object_unref (channel); } @@ -389,7 +389,7 @@ gabble_server_tls_manager_verify_async (WockyTLSHandler *handler, G_CALLBACK (tls_certificate_rejected_cb), self); /* emit NewChannel on the ChannelManager iface */ - tp_channel_manager_emit_new_channel (self, + tp_channel_manager_emit_new_channel (TP_CHANNEL_MANAGER (self), (TpExportableChannel *) self->priv->channel, NULL); } @@ -516,7 +516,6 @@ channel_manager_iface_init (gpointer g_iface, /* these channels are not requestable. */ iface->ensure_channel = NULL; iface->create_channel = NULL; - iface->request_channel = NULL; iface->foreach_channel_class = NULL; } diff --git a/src/tube-dbus.c b/src/tube-dbus.c index 3b6197ebc..9e8ac2100 100644 --- a/src/tube-dbus.c +++ b/src/tube-dbus.c @@ -62,18 +62,18 @@ static void dbustube_iface_init (gpointer g_iface, gpointer iface_data); G_DEFINE_TYPE_WITH_CODE (GabbleTubeDBus, gabble_tube_dbus, TP_TYPE_BASE_CHANNEL, G_IMPLEMENT_INTERFACE (GABBLE_TYPE_TUBE_IFACE, tube_iface_init); - G_IMPLEMENT_INTERFACE (TP_TYPE_SVC_CHANNEL_TYPE_DBUS_TUBE, + G_IMPLEMENT_INTERFACE (TP_TYPE_SVC_CHANNEL_TYPE_DBUS_TUBE1, dbustube_iface_init); - G_IMPLEMENT_INTERFACE (TP_TYPE_SVC_CHANNEL_INTERFACE_TUBE, + G_IMPLEMENT_INTERFACE (TP_TYPE_SVC_CHANNEL_INTERFACE_TUBE1, NULL); - G_IMPLEMENT_INTERFACE (TP_TYPE_SVC_CHANNEL_INTERFACE_GROUP, + G_IMPLEMENT_INTERFACE (TP_TYPE_SVC_CHANNEL_INTERFACE_GROUP1, tp_external_group_mixin_iface_init); ); static const gchar * const gabble_tube_dbus_channel_allowed_properties[] = { TP_IFACE_CHANNEL ".TargetHandle", TP_IFACE_CHANNEL ".TargetID", - TP_IFACE_CHANNEL_TYPE_DBUS_TUBE ".ServiceName", + TP_IFACE_CHANNEL_TYPE_DBUS_TUBE1 ".ServiceName", NULL }; @@ -163,7 +163,7 @@ gabble_tube_dbus_get_interfaces (TpBaseChannel *base) interfaces = TP_BASE_CHANNEL_CLASS ( gabble_tube_dbus_parent_class)->get_interfaces (base); - g_ptr_array_add (interfaces, TP_IFACE_CHANNEL_INTERFACE_TUBE); + g_ptr_array_add (interfaces, TP_IFACE_CHANNEL_INTERFACE_TUBE1); return interfaces; } @@ -430,7 +430,7 @@ tube_dbus_open (GabbleTubeDBus *self) dbus_server_setup_with_g_main (priv->dbus_srv, NULL); } - if (cls->target_handle_type == TP_HANDLE_TYPE_ROOM) + if (cls->target_entity_type == TP_ENTITY_TYPE_ROOM) { /* add yourself in dbus names */ gabble_tube_dbus_add_name (self, priv->self_handle, @@ -496,14 +496,14 @@ bytestream_state_changed_cb (GabbleBytestreamIface *bytestream, tp_clear_object (&priv->bytestream); g_signal_emit (G_OBJECT (self), signals[CLOSED], 0); - if (cls->target_handle_type == TP_HANDLE_TYPE_ROOM) + if (cls->target_entity_type == TP_ENTITY_TYPE_ROOM) gabble_muc_channel_send_presence (priv->muc); } else if (state == GABBLE_BYTESTREAM_STATE_OPEN) { tube_dbus_open (self); - tp_svc_channel_interface_tube_emit_tube_channel_state_changed (self, + tp_svc_channel_interface_tube1_emit_tube_channel_state_changed (self, TP_TUBE_CHANNEL_STATE_OPEN); g_signal_emit (G_OBJECT (self), signals[OPENED], 0); @@ -710,7 +710,7 @@ gabble_tube_dbus_constructed (GObject *obj) TpBaseConnection *base_conn = tp_base_channel_get_connection (base); GabbleConnection *conn = GABBLE_CONNECTION (base_conn); TpHandleRepoIface *contact_repo = tp_base_connection_get_handles ( - base_conn, TP_HANDLE_TYPE_CONTACT); + base_conn, TP_ENTITY_TYPE_CONTACT); guint access_control; void (*chain_up) (GObject *) = @@ -723,7 +723,7 @@ gabble_tube_dbus_constructed (GObject *obj) NULL, g_free); g_assert (priv->self_handle != 0); - if (cls->target_handle_type == TP_HANDLE_TYPE_ROOM) + if (cls->target_entity_type == TP_ENTITY_TYPE_ROOM) { /* We have to create a pseudo-IBB bytestream that will be * used by this MUC tube to communicate. @@ -818,15 +818,15 @@ gabble_tube_dbus_fill_immutable_properties (TpBaseChannel *chan, tp_dbus_properties_mixin_fill_properties_hash ( G_OBJECT (chan), properties, - TP_IFACE_CHANNEL_TYPE_DBUS_TUBE, "ServiceName", - TP_IFACE_CHANNEL_TYPE_DBUS_TUBE, "SupportedAccessControls", + TP_IFACE_CHANNEL_TYPE_DBUS_TUBE1, "ServiceName", + TP_IFACE_CHANNEL_TYPE_DBUS_TUBE1, "SupportedAccessControls", NULL); if (!tp_base_channel_is_requested (chan)) { tp_dbus_properties_mixin_fill_properties_hash ( G_OBJECT (chan), properties, - TP_IFACE_CHANNEL_INTERFACE_TUBE, "Parameters", + TP_IFACE_CHANNEL_INTERFACE_TUBE1, "Parameters", NULL); } } @@ -856,12 +856,12 @@ gabble_tube_dbus_class_init (GabbleTubeDBusClass *gabble_tube_dbus_class) { NULL } }; static TpDBusPropertiesMixinIfaceImpl prop_interfaces[] = { - { TP_IFACE_CHANNEL_TYPE_DBUS_TUBE, + { TP_IFACE_CHANNEL_TYPE_DBUS_TUBE1, tp_dbus_properties_mixin_getter_gobject_properties, NULL, dbus_tube_props, }, - { TP_IFACE_CHANNEL_INTERFACE_TUBE, + { TP_IFACE_CHANNEL_INTERFACE_TUBE1, tp_dbus_properties_mixin_getter_gobject_properties, NULL, tube_iface_props, @@ -878,9 +878,9 @@ gabble_tube_dbus_class_init (GabbleTubeDBusClass *gabble_tube_dbus_class) object_class->dispose = gabble_tube_dbus_dispose; object_class->finalize = gabble_tube_dbus_finalize; - base_class->channel_type = TP_IFACE_CHANNEL_TYPE_DBUS_TUBE; + base_class->channel_type = TP_IFACE_CHANNEL_TYPE_DBUS_TUBE1; base_class->get_interfaces = gabble_tube_dbus_get_interfaces; - base_class->target_handle_type = TP_HANDLE_TYPE_CONTACT; + base_class->target_entity_type = TP_ENTITY_TYPE_CONTACT; base_class->close = gabble_tube_dbus_close; base_class->fill_immutable_properties = gabble_tube_dbus_fill_immutable_properties; @@ -1039,10 +1039,10 @@ gabble_tube_dbus_offer (GabbleTubeDBus *tube, return FALSE; } - if (cls->target_handle_type == TP_HANDLE_TYPE_CONTACT) + if (cls->target_entity_type == TP_ENTITY_TYPE_CONTACT) { TpHandleRepoIface *contact_repo = tp_base_connection_get_handles ( - base_conn, TP_HANDLE_TYPE_CONTACT); + base_conn, TP_ENTITY_TYPE_CONTACT); const gchar *jid, *resource; gchar *full_jid; GabblePresence *presence; @@ -1094,7 +1094,7 @@ gabble_tube_dbus_offer (GabbleTubeDBus *tube, g_object_unref (msg); g_free (full_jid); - tp_svc_channel_interface_tube_emit_tube_channel_state_changed (tube, + tp_svc_channel_interface_tube1_emit_tube_channel_state_changed (tube, TP_TUBE_CHANNEL_STATE_REMOTE_PENDING); } else @@ -1141,7 +1141,7 @@ message_received (GabbleTubeDBus *tube, return; } - if (cls->target_handle_type == TP_HANDLE_TYPE_ROOM) + if (cls->target_entity_type == TP_ENTITY_TYPE_ROOM) { destination = dbus_message_get_destination (msg); /* If destination is NULL this msg is broadcasted (signals) so we don't @@ -1227,7 +1227,7 @@ data_received_cb (GabbleBytestreamIface *stream, TpBaseChannel *base = TP_BASE_CHANNEL (tube); TpBaseChannelClass *cls = TP_BASE_CHANNEL_GET_CLASS (base); - if (cls->target_handle_type == TP_HANDLE_TYPE_CONTACT) + if (cls->target_entity_type == TP_ENTITY_TYPE_CONTACT) { GString *buf = priv->reassembly_buffer; @@ -1333,7 +1333,7 @@ data_received_cb (GabbleBytestreamIface *stream, GabbleTubeDBus * gabble_tube_dbus_new (GabbleConnection *conn, TpHandle handle, - TpHandleType handle_type, + TpEntityType handle_type, TpHandle self_handle, TpHandle initiator, const gchar *service, @@ -1347,7 +1347,7 @@ gabble_tube_dbus_new (GabbleConnection *conn, GabbleTubeDBus *tube; GType gtype = GABBLE_TYPE_TUBE_DBUS; - if (handle_type == TP_HANDLE_TYPE_ROOM) + if (handle_type == TP_ENTITY_TYPE_ROOM) gtype = GABBLE_TYPE_MUC_TUBE_DBUS; tube = g_object_new (gtype, @@ -1400,7 +1400,7 @@ gabble_tube_dbus_accept (GabbleTubeIface *tube, if (state != GABBLE_BYTESTREAM_STATE_LOCAL_PENDING) return TRUE; - if (cls->target_handle_type == TP_HANDLE_TYPE_CONTACT) + if (cls->target_entity_type == TP_ENTITY_TYPE_CONTACT) { /* Bytestream was created using a SI request so * we have to accept it */ @@ -1461,12 +1461,12 @@ gabble_tube_dbus_add_name (GabbleTubeDBus *self, TpBaseChannelClass *cls = TP_BASE_CHANNEL_GET_CLASS (base); TpBaseConnection *base_conn = tp_base_channel_get_connection (base); TpHandleRepoIface *contact_repo = tp_base_connection_get_handles ( - base_conn, TP_HANDLE_TYPE_CONTACT); + base_conn, TP_ENTITY_TYPE_CONTACT); gchar *name_copy; GHashTable *added; GArray *removed; - g_assert (cls->target_handle_type == TP_HANDLE_TYPE_ROOM); + g_assert (cls->target_entity_type == TP_ENTITY_TYPE_ROOM); g_assert (g_hash_table_size (priv->dbus_names) == g_hash_table_size (priv->dbus_name_to_handle)); @@ -1516,7 +1516,7 @@ gabble_tube_dbus_add_name (GabbleTubeDBus *self, g_hash_table_insert (added, GUINT_TO_POINTER (handle), (gchar *) name); - tp_svc_channel_type_dbus_tube_emit_dbus_names_changed (self, added, + tp_svc_channel_type_dbus_tube1_emit_dbus_names_changed (self, added, removed); g_hash_table_unref (added); @@ -1536,7 +1536,7 @@ gabble_tube_dbus_remove_name (GabbleTubeDBus *self, GHashTable *added; GArray *removed; - g_assert (cls->target_handle_type == TP_HANDLE_TYPE_ROOM); + g_assert (cls->target_entity_type == TP_ENTITY_TYPE_ROOM); name = g_hash_table_lookup (priv->dbus_names, GUINT_TO_POINTER (handle)); if (name == NULL) @@ -1554,7 +1554,7 @@ gabble_tube_dbus_remove_name (GabbleTubeDBus *self, g_array_append_val (removed, handle); - tp_svc_channel_type_dbus_tube_emit_dbus_names_changed (self, added, + tp_svc_channel_type_dbus_tube1_emit_dbus_names_changed (self, added, removed); g_hash_table_unref (added); @@ -1569,7 +1569,7 @@ gabble_tube_dbus_handle_in_names (GabbleTubeDBus *self, GabbleTubeDBusPrivate *priv = GABBLE_TUBE_DBUS_GET_PRIVATE (self); TpBaseChannelClass *cls = TP_BASE_CHANNEL_GET_CLASS (self); - g_assert (cls->target_handle_type == TP_HANDLE_TYPE_ROOM); + g_assert (cls->target_entity_type == TP_ENTITY_TYPE_ROOM); return (g_hash_table_lookup (priv->dbus_names, GUINT_TO_POINTER (handle)) != NULL); @@ -1656,10 +1656,10 @@ gabble_tube_dbus_check_access_control (GabbleTubeDBus *self, * gabble_tube_dbus_offer_async * * Implemnets D-Bus method Offer on interface - * org.freedesktop.Telepathy.Channel.Type.DBusTube + * Channel.Type.DBusTube */ static void -gabble_tube_dbus_offer_async (TpSvcChannelTypeDBusTube *self, +gabble_tube_dbus_offer_async (TpSvcChannelTypeDBusTube1 *self, GHashTable *parameters, guint access_control, DBusGMethodInvocation *context) @@ -1681,7 +1681,7 @@ gabble_tube_dbus_offer_async (TpSvcChannelTypeDBusTube *self, if (gabble_tube_dbus_offer (tube, &error)) { - tp_svc_channel_type_dbus_tube_return_from_offer (context, + tp_svc_channel_type_dbus_tube1_return_from_offer (context, tube->priv->dbus_srv_addr); } else @@ -1696,10 +1696,10 @@ gabble_tube_dbus_offer_async (TpSvcChannelTypeDBusTube *self, * gabble_tube_dbus_accept_async * * Implements D-Bus method Accept on interface - * org.freedesktop.Telepathy.Channel.Type.DBusTube + * Channel.Type.DBusTube */ static void -gabble_tube_dbus_accept_async (TpSvcChannelTypeDBusTube *self, +gabble_tube_dbus_accept_async (TpSvcChannelTypeDBusTube1 *self, guint access_control, DBusGMethodInvocation *context) { @@ -1715,7 +1715,7 @@ gabble_tube_dbus_accept_async (TpSvcChannelTypeDBusTube *self, if (gabble_tube_dbus_accept (GABBLE_TUBE_IFACE (tube), &error)) { - tp_svc_channel_type_dbus_tube_return_from_accept (context, + tp_svc_channel_type_dbus_tube1_return_from_accept (context, tube->priv->dbus_srv_addr); ; } @@ -1742,10 +1742,10 @@ static void dbustube_iface_init (gpointer g_iface, gpointer iface_data) { - TpSvcChannelTypeDBusTubeClass *klass = - (TpSvcChannelTypeDBusTubeClass *) g_iface; + TpSvcChannelTypeDBusTube1Class *klass = + (TpSvcChannelTypeDBusTube1Class *) g_iface; -#define IMPLEMENT(x, suffix) tp_svc_channel_type_dbus_tube_implement_##x (\ +#define IMPLEMENT(x, suffix) tp_svc_channel_type_dbus_tube1_implement_##x (\ klass, gabble_tube_dbus_##x##suffix) IMPLEMENT(offer,_async); IMPLEMENT(accept,_async); diff --git a/src/tube-dbus.h b/src/tube-dbus.h index b3020a9f4..ba3fd49ab 100644 --- a/src/tube-dbus.h +++ b/src/tube-dbus.h @@ -69,7 +69,7 @@ GType gabble_tube_dbus_get_type (void); GabbleTubeDBusClass)) GabbleTubeDBus *gabble_tube_dbus_new (GabbleConnection *conn, TpHandle handle, - TpHandleType handle_type, TpHandle self_handle, TpHandle initiator, + TpEntityType handle_type, TpHandle self_handle, TpHandle initiator, const gchar *service, GHashTable *parameters, const gchar *stream_id, guint64 id, GabbleBytestreamIface *bytestream, GabbleMucChannel *muc, gboolean requested); diff --git a/src/tube-iface.c b/src/tube-iface.c index aef131e09..ea0a18514 100644 --- a/src/tube-iface.c +++ b/src/tube-iface.c @@ -154,7 +154,7 @@ gabble_tube_iface_publish_in_node (GabbleTubeIface *tube, gchar *service, *id_str; guint64 tube_id; TpHandleRepoIface *contact_repo = tp_base_connection_get_handles ( - conn, TP_HANDLE_TYPE_CONTACT); + conn, TP_ENTITY_TYPE_CONTACT); TpHandle initiator_handle; g_object_get (G_OBJECT (tube), diff --git a/src/tube-stream.c b/src/tube-stream.c index c62381366..fb9c4a484 100644 --- a/src/tube-stream.c +++ b/src/tube-stream.c @@ -67,18 +67,18 @@ G_DEFINE_TYPE_WITH_CODE (GabbleTubeStream, gabble_tube_stream, G_IMPLEMENT_INTERFACE (TP_TYPE_SVC_DBUS_PROPERTIES, tp_dbus_properties_mixin_iface_init); G_IMPLEMENT_INTERFACE (GABBLE_TYPE_TUBE_IFACE, tube_iface_init); - G_IMPLEMENT_INTERFACE (TP_TYPE_SVC_CHANNEL_TYPE_STREAM_TUBE, + G_IMPLEMENT_INTERFACE (TP_TYPE_SVC_CHANNEL_TYPE_STREAM_TUBE1, streamtube_iface_init); - G_IMPLEMENT_INTERFACE (TP_TYPE_SVC_CHANNEL_INTERFACE_TUBE, + G_IMPLEMENT_INTERFACE (TP_TYPE_SVC_CHANNEL_INTERFACE_TUBE1, NULL); - G_IMPLEMENT_INTERFACE (TP_TYPE_SVC_CHANNEL_INTERFACE_GROUP, + G_IMPLEMENT_INTERFACE (TP_TYPE_SVC_CHANNEL_INTERFACE_GROUP1, tp_external_group_mixin_iface_init); ); static const gchar * const gabble_tube_stream_channel_allowed_properties[] = { TP_IFACE_CHANNEL ".TargetHandle", TP_IFACE_CHANNEL ".TargetID", - TP_IFACE_CHANNEL_TYPE_STREAM_TUBE ".Service", + TP_IFACE_CHANNEL_TYPE_STREAM_TUBE1 ".Service", NULL }; @@ -178,7 +178,7 @@ gabble_tube_stream_get_interfaces (TpBaseChannel *base) interfaces = TP_BASE_CHANNEL_CLASS ( gabble_tube_stream_parent_class)->get_interfaces (base); - g_ptr_array_add (interfaces, TP_IFACE_CHANNEL_INTERFACE_TUBE); + g_ptr_array_add (interfaces, TP_IFACE_CHANNEL_INTERFACE_TUBE1); return interfaces; } @@ -252,7 +252,7 @@ fire_connection_closed (GabbleTubeStream *self, * same connection. */ g_hash_table_remove (priv->transport_to_id, transport); - tp_svc_channel_type_stream_tube_emit_connection_closed (self, + tp_svc_channel_type_stream_tube1_emit_connection_closed (self, connection_id, error, debug_msg); } @@ -458,11 +458,11 @@ start_stream_initiation (GabbleTubeStream *self, gchar *full_jid, *stream_id, *id_str; contact_repo = tp_base_connection_get_handles ( - base_conn, TP_HANDLE_TYPE_CONTACT); + base_conn, TP_ENTITY_TYPE_CONTACT); jid = tp_handle_inspect (contact_repo, initiator); - if (cls->target_handle_type == TP_HANDLE_TYPE_CONTACT) + if (cls->target_entity_type == TP_ENTITY_TYPE_CONTACT) { /* Private tube */ GabblePresence *presence; @@ -507,7 +507,7 @@ start_stream_initiation (GabbleTubeStream *self, id_str = g_strdup_printf ("%" G_GUINT64_FORMAT, priv->id); - if (cls->target_handle_type == TP_HANDLE_TYPE_CONTACT) + if (cls->target_entity_type == TP_ENTITY_TYPE_CONTACT) { node = wocky_node_add_child_ns (si_node, "stream", NS_TUBES); } @@ -554,7 +554,7 @@ fire_new_local_connection (GabbleTubeStream *self, connection_id = generate_connection_id (self, transport); - tp_svc_channel_type_stream_tube_emit_new_local_connection (self, + tp_svc_channel_type_stream_tube1_emit_new_local_connection (self, connection_id); } @@ -839,6 +839,10 @@ fire_new_remote_connection (GabbleTubeStream *self, GabbleTubeStreamPrivate *priv = self->priv; GValue access_control_param = {0,}; guint connection_id; + TpBaseChannel *base = TP_BASE_CHANNEL (self); + TpBaseConnection *base_conn = tp_base_channel_get_connection (base); + TpHandleRepoIface *contact_repo = tp_base_connection_get_handles ( + base_conn, TP_ENTITY_TYPE_CONTACT); #ifdef GIBBER_TYPE_UNIX_TRANSPORT if (priv->access_control == TP_SOCKET_ACCESS_CONTROL_CREDENTIALS) @@ -873,8 +877,10 @@ fire_new_remote_connection (GabbleTubeStream *self, transport)); g_assert (connection_id != 0); - tp_svc_channel_type_stream_tube_emit_new_remote_connection (self, - contact, &access_control_param, connection_id); + tp_svc_channel_type_stream_tube1_emit_new_remote_connection (self, + contact, tp_handle_inspect (contact_repo, contact), + &access_control_param, connection_id); + g_value_unset (&access_control_param); } @@ -1357,7 +1363,7 @@ gabble_tube_stream_constructed (GObject *obj) conn->bytestream_factory); } - if (cls->target_handle_type == TP_HANDLE_TYPE_CONTACT) + if (cls->target_entity_type == TP_ENTITY_TYPE_CONTACT) { g_assert (priv->muc == NULL); } @@ -1379,15 +1385,15 @@ gabble_tube_stream_fill_immutable_properties (TpBaseChannel *chan, tp_dbus_properties_mixin_fill_properties_hash ( G_OBJECT (chan), properties, - TP_IFACE_CHANNEL_TYPE_STREAM_TUBE, "Service", - TP_IFACE_CHANNEL_TYPE_STREAM_TUBE, "SupportedSocketTypes", + TP_IFACE_CHANNEL_TYPE_STREAM_TUBE1, "Service", + TP_IFACE_CHANNEL_TYPE_STREAM_TUBE1, "SupportedSocketTypes", NULL); if (!tp_base_channel_is_requested (chan)) { tp_dbus_properties_mixin_fill_properties_hash ( G_OBJECT (chan), properties, - TP_IFACE_CHANNEL_INTERFACE_TUBE, "Parameters", + TP_IFACE_CHANNEL_INTERFACE_TUBE1, "Parameters", NULL); } } @@ -1422,12 +1428,12 @@ gabble_tube_stream_class_init (GabbleTubeStreamClass *gabble_tube_stream_class) { NULL } }; static TpDBusPropertiesMixinIfaceImpl prop_interfaces[] = { - { TP_IFACE_CHANNEL_TYPE_STREAM_TUBE, + { TP_IFACE_CHANNEL_TYPE_STREAM_TUBE1, tp_dbus_properties_mixin_getter_gobject_properties, NULL, stream_tube_props, }, - { TP_IFACE_CHANNEL_INTERFACE_TUBE, + { TP_IFACE_CHANNEL_INTERFACE_TUBE1, tp_dbus_properties_mixin_getter_gobject_properties, NULL, tube_iface_props, @@ -1444,9 +1450,9 @@ gabble_tube_stream_class_init (GabbleTubeStreamClass *gabble_tube_stream_class) object_class->dispose = gabble_tube_stream_dispose; object_class->finalize = gabble_tube_stream_finalize; - base_class->channel_type = TP_IFACE_CHANNEL_TYPE_STREAM_TUBE; + base_class->channel_type = TP_IFACE_CHANNEL_TYPE_STREAM_TUBE1; base_class->get_interfaces = gabble_tube_stream_get_interfaces; - base_class->target_handle_type = TP_HANDLE_TYPE_CONTACT; + base_class->target_entity_type = TP_ENTITY_TYPE_CONTACT; base_class->close = gabble_tube_stream_close; base_class->fill_immutable_properties = gabble_tube_stream_fill_immutable_properties; @@ -1611,7 +1617,7 @@ data_received_cb (GabbleBytestreamIface *bytestream, GabbleTubeStream * gabble_tube_stream_new (GabbleConnection *conn, TpHandle handle, - TpHandleType handle_type, + TpEntityType handle_type, TpHandle self_handle, TpHandle initiator, const gchar *service, @@ -1623,7 +1629,7 @@ gabble_tube_stream_new (GabbleConnection *conn, GabbleTubeStream *obj; GType gtype = GABBLE_TYPE_TUBE_STREAM; - if (handle_type == TP_HANDLE_TYPE_ROOM) + if (handle_type == TP_ENTITY_TYPE_ROOM) gtype = GABBLE_TYPE_MUC_TUBE_STREAM; obj = g_object_new (gtype, @@ -1674,7 +1680,7 @@ gabble_tube_stream_accept (GabbleTubeIface *tube, priv->state = TP_TUBE_CHANNEL_STATE_OPEN; - tp_svc_channel_interface_tube_emit_tube_channel_state_changed (self, + tp_svc_channel_interface_tube1_emit_tube_channel_state_changed (self, TP_TUBE_CHANNEL_STATE_OPEN); g_signal_emit (G_OBJECT (self), signals[OPENED], 0); @@ -1711,12 +1717,12 @@ gabble_tube_iface_stream_close (GabbleTubeIface *tube, g_hash_table_foreach_remove (priv->bytestream_to_transport, close_each_extra_bytestream, self); - if (!closed_remotely && cls->target_handle_type == TP_HANDLE_TYPE_CONTACT) + if (!closed_remotely && cls->target_entity_type == TP_ENTITY_TYPE_CONTACT) { WockyStanza *msg; const gchar *jid; TpHandleRepoIface *contact_repo = tp_base_connection_get_handles ( - base_conn, TP_HANDLE_TYPE_CONTACT); + base_conn, TP_ENTITY_TYPE_CONTACT); gchar *id_str; jid = tp_handle_inspect (contact_repo, @@ -1746,7 +1752,7 @@ gabble_tube_iface_stream_close (GabbleTubeIface *tube, * disappear when we finally remove the Tubes channel type.. */ g_object_ref (self); - if (cls->target_handle_type == TP_HANDLE_TYPE_ROOM) + if (cls->target_entity_type == TP_ENTITY_TYPE_ROOM) gabble_muc_channel_send_presence (priv->muc); g_signal_emit (G_OBJECT (self), signals[CLOSED], 0); @@ -1799,7 +1805,7 @@ gabble_tube_stream_add_bytestream (GabbleTubeIface *tube, DEBUG ("Received first connection. Tube is now open"); priv->state = TP_TUBE_CHANNEL_STATE_OPEN; - tp_svc_channel_interface_tube_emit_tube_channel_state_changed ( + tp_svc_channel_interface_tube1_emit_tube_channel_state_changed ( self, TP_TUBE_CHANNEL_STATE_OPEN); g_signal_emit (G_OBJECT (self), signals[OPENED], 0); @@ -2060,10 +2066,10 @@ send_tube_offer (GabbleTubeStream *self, const gchar *resource; gchar *full_jid; - g_assert (cls->target_handle_type == TP_HANDLE_TYPE_CONTACT); + g_assert (cls->target_entity_type == TP_ENTITY_TYPE_CONTACT); contact_repo = tp_base_connection_get_handles (base_conn, - TP_HANDLE_TYPE_CONTACT); + TP_ENTITY_TYPE_CONTACT); jid = tp_handle_inspect (contact_repo, tp_base_channel_get_target_handle (base)); @@ -2126,7 +2132,7 @@ gabble_tube_stream_offer (GabbleTubeStream *self, g_assert (priv->state == TP_TUBE_CHANNEL_STATE_NOT_OFFERED); - if (cls->target_handle_type == TP_HANDLE_TYPE_CONTACT) + if (cls->target_entity_type == TP_ENTITY_TYPE_CONTACT) { /* 1-1 tube. Send tube offer message */ if (!send_tube_offer (self, error)) @@ -2156,9 +2162,9 @@ destroy_socket_control_list (gpointer data) * gabble_tube_stream_get_supported_socket_types * * Used to implement D-Bus property - * org.freedesktop.Telepathy.Channel.Type.StreamTube.SupportedSocketTypes + * Channel.Type.StreamTube.SupportedSocketTypes * and D-Bus method GetAvailableStreamTubeTypes - * on org.freedesktop.Telepathy.Channel.Type.Tubes + * on Channel.Type.Tubes */ GHashTable * gabble_tube_stream_get_supported_socket_types (void) @@ -2219,10 +2225,10 @@ gabble_tube_stream_get_supported_socket_types (void) * gabble_tube_stream_offer_async * * Implements D-Bus method Offer - * on org.freedesktop.Telepathy.Channel.Type.StreamTube + * on Channel.Type.StreamTube */ static void -gabble_tube_stream_offer_async (TpSvcChannelTypeStreamTube *iface, +gabble_tube_stream_offer_async (TpSvcChannelTypeStreamTube1 *iface, guint address_type, const GValue *address, guint access_control, @@ -2273,28 +2279,28 @@ gabble_tube_stream_offer_async (TpSvcChannelTypeStreamTube *iface, return; } - if (cls->target_handle_type == TP_HANDLE_TYPE_CONTACT) + if (cls->target_entity_type == TP_ENTITY_TYPE_CONTACT) { - tp_svc_channel_interface_tube_emit_tube_channel_state_changed ( + tp_svc_channel_interface_tube1_emit_tube_channel_state_changed ( self, TP_TUBE_CHANNEL_STATE_REMOTE_PENDING); } else { - tp_svc_channel_interface_tube_emit_tube_channel_state_changed ( + tp_svc_channel_interface_tube1_emit_tube_channel_state_changed ( self, TP_TUBE_CHANNEL_STATE_OPEN); } - tp_svc_channel_type_stream_tube_return_from_offer (context); + tp_svc_channel_type_stream_tube1_return_from_offer (context); } /** * gabble_tube_stream_accept_async * * Implements D-Bus method Accept - * on org.freedesktop.Telepathy.Channel.Type.StreamTube + * on Channel.Type.StreamTube */ static void -gabble_tube_stream_accept_async (TpSvcChannelTypeStreamTube *iface, +gabble_tube_stream_accept_async (TpSvcChannelTypeStreamTube1 *iface, guint address_type, guint access_control, const GValue *access_control_param, @@ -2320,11 +2326,11 @@ gabble_tube_stream_accept_async (TpSvcChannelTypeStreamTube *iface, #if 0 /* TODO: add a property "muc" and set it at initialization */ - if (priv->handle_type == TP_HANDLE_TYPE_ROOM) + if (priv->handle_type == TP_ENTITY_TYPE_ROOM) gabble_muc_channel_send_presence (self->muc, NULL); #endif - tp_svc_channel_type_stream_tube_return_from_accept (context, + tp_svc_channel_type_stream_tube1_return_from_accept (context, priv->address); } @@ -2349,10 +2355,10 @@ static void streamtube_iface_init (gpointer g_iface, gpointer iface_data) { - TpSvcChannelTypeStreamTubeClass *klass = - (TpSvcChannelTypeStreamTubeClass *) g_iface; + TpSvcChannelTypeStreamTube1Class *klass = + (TpSvcChannelTypeStreamTube1Class *) g_iface; -#define IMPLEMENT(x, suffix) tp_svc_channel_type_stream_tube_implement_##x (\ +#define IMPLEMENT(x, suffix) tp_svc_channel_type_stream_tube1_implement_##x (\ klass, gabble_tube_stream_##x##suffix) IMPLEMENT(offer,_async); IMPLEMENT(accept,_async); diff --git a/src/tube-stream.h b/src/tube-stream.h index 5b26fcced..1a7ee9b38 100644 --- a/src/tube-stream.h +++ b/src/tube-stream.h @@ -66,7 +66,7 @@ GType gabble_tube_stream_get_type (void); GabbleTubeStreamClass)) GabbleTubeStream *gabble_tube_stream_new (GabbleConnection *conn, - TpHandle handle, TpHandleType handle_type, TpHandle self_handle, + TpHandle handle, TpEntityType handle_type, TpHandle self_handle, TpHandle initiator, const gchar *service, GHashTable *parameters, guint64 id, GabbleMucChannel *muc, gboolean requested); diff --git a/src/util.c b/src/util.c index b36f5745a..dad3859d6 100644 --- a/src/util.c +++ b/src/util.c @@ -152,7 +152,7 @@ lm_message_node_add_own_nick (WockyNode *node, /** * gabble_get_room_handle_from_jid: - * @room_repo: The %TP_HANDLE_TYPE_ROOM handle repository + * @room_repo: The %TP_ENTITY_TYPE_ROOM handle repository * @jid: A JID * * Given a JID seen in the from="" attribute on a stanza, work out whether @@ -277,7 +277,7 @@ gabble_encode_jid ( /* * gabble_normalize_contact - * @repo: The %TP_HANDLE_TYPE_ROOM handle repository or NULL + * @repo: The %TP_ENTITY_TYPE_ROOM handle repository or NULL * @jid: A JID * @context: One of %GabbleNormalizeContactJIDMode casted into gpointer * @error: pointer in which to return a GError in case of failure. @@ -758,7 +758,7 @@ ensure_handle_from_contact ( WockyContact *contact) { TpHandleRepoIface *contact_repo = tp_base_connection_get_handles ( - (TpBaseConnection *) conn, TP_HANDLE_TYPE_CONTACT); + (TpBaseConnection *) conn, TP_ENTITY_TYPE_CONTACT); gchar *jid = wocky_contact_dup_jid (contact); GError *error = NULL; TpHandle handle = tp_handle_ensure (contact_repo, jid, NULL, &error); @@ -1053,7 +1053,7 @@ gabble_peer_to_jid (GabbleConnection *conn, const gchar *resource) { TpHandleRepoIface *repo = tp_base_connection_get_handles ( - TP_BASE_CONNECTION (conn), TP_HANDLE_TYPE_CONTACT); + TP_BASE_CONNECTION (conn), TP_ENTITY_TYPE_CONTACT); const gchar *target = tp_handle_inspect (repo, peer); if (resource == NULL) diff --git a/src/vcard-manager.c b/src/vcard-manager.c index 9f40b7523..7eb8d3330 100644 --- a/src/vcard-manager.c +++ b/src/vcard-manager.c @@ -458,7 +458,7 @@ gabble_vcard_manager_invalidate_cache (GabbleVCardManager *manager, GabbleVCardCacheEntry *entry = g_hash_table_lookup (priv->cache, GUINT_TO_POINTER (handle)); TpHandleRepoIface *contact_repo = tp_base_connection_get_handles ( - (TpBaseConnection *) priv->connection, TP_HANDLE_TYPE_CONTACT); + (TpBaseConnection *) priv->connection, TP_ENTITY_TYPE_CONTACT); g_return_if_fail (tp_handle_is_valid (contact_repo, handle, NULL)); @@ -1261,7 +1261,7 @@ pipeline_reply_cb (GabbleConnection *conn, GabbleVCardManagerPrivate *priv = self->priv; TpBaseConnection *base = (TpBaseConnection *) conn; TpHandleRepoIface *contact_repo = - tp_base_connection_get_handles (base, TP_HANDLE_TYPE_CONTACT); + tp_base_connection_get_handles (base, TP_ENTITY_TYPE_CONTACT); WockyNode *vcard_node = NULL; DEBUG("called for entry %p", entry); @@ -1390,7 +1390,7 @@ request_send (GabbleVCardManagerRequest *request, guint timeout) GabbleConnection *conn = entry->manager->priv->connection; TpBaseConnection *base = (TpBaseConnection *) conn; TpHandleRepoIface *contact_repo = tp_base_connection_get_handles (base, - TP_HANDLE_TYPE_CONTACT); + TP_ENTITY_TYPE_CONTACT); g_assert (request->timer_id == 0); @@ -1465,7 +1465,7 @@ gabble_vcard_manager_request (GabbleVCardManager *self, GabbleVCardManagerPrivate *priv = self->priv; TpBaseConnection *base = (TpBaseConnection *) priv->connection; TpHandleRepoIface *contact_repo = tp_base_connection_get_handles (base, - TP_HANDLE_TYPE_CONTACT); + TP_ENTITY_TYPE_CONTACT); GabbleVCardManagerRequest *request; GabbleVCardCacheEntry *entry = cache_entry_get (self, handle); @@ -1625,7 +1625,7 @@ gabble_vcard_manager_get_cached (GabbleVCardManager *self, GabbleVCardCacheEntry *entry = g_hash_table_lookup (priv->cache, GUINT_TO_POINTER (handle)); TpHandleRepoIface *contact_repo = tp_base_connection_get_handles ( - (TpBaseConnection *) priv->connection, TP_HANDLE_TYPE_CONTACT); + (TpBaseConnection *) priv->connection, TP_ENTITY_TYPE_CONTACT); g_return_val_if_fail (tp_handle_is_valid (contact_repo, handle, NULL), FALSE); @@ -1654,7 +1654,7 @@ gabble_vcard_manager_get_cached_alias (GabbleVCardManager *self, priv = self->priv; contact_repo = tp_base_connection_get_handles ( - (TpBaseConnection *) priv->connection, TP_HANDLE_TYPE_CONTACT); + (TpBaseConnection *) priv->connection, TP_ENTITY_TYPE_CONTACT); g_return_val_if_fail (tp_handle_is_valid (contact_repo, handle, NULL), NULL); @@ -1676,7 +1676,7 @@ gabble_vcard_manager_has_cached_alias (GabbleVCardManager *self, priv = self->priv; contact_repo = tp_base_connection_get_handles ( - (TpBaseConnection *) priv->connection, TP_HANDLE_TYPE_CONTACT); + (TpBaseConnection *) priv->connection, TP_ENTITY_TYPE_CONTACT); g_return_val_if_fail (tp_handle_is_valid (contact_repo, handle, NULL), FALSE); diff --git a/src/write-mgr-file.c b/src/write-mgr-file.c index 90da9fd2a..ff63a2966 100644 --- a/src/write-mgr-file.c +++ b/src/write-mgr-file.c @@ -198,7 +198,7 @@ generate_group_name (GHashTable *props) gchar *chan_type_suffix; gchar *handle_type_name; guint handle_type = tp_asv_get_uint32 (props, - TP_PROP_CHANNEL_TARGET_HANDLE_TYPE, NULL); + TP_PROP_CHANNEL_TARGET_ENTITY_TYPE, NULL); g_assert (chan_type != NULL); chan_type_suffix = strrchr (chan_type, '.'); @@ -207,11 +207,11 @@ generate_group_name (GHashTable *props) switch (handle_type) { - case TP_HANDLE_TYPE_CONTACT: + case TP_ENTITY_TYPE_CONTACT: handle_type_name = "-1on1"; break; - case TP_HANDLE_TYPE_ROOM: + case TP_ENTITY_TYPE_ROOM: handle_type_name = "-multi"; break; @@ -280,8 +280,8 @@ write_presence (GKeyFile *f, gpointer k, v; statuses = tp_asv_get_boxed (props, - TP_PROP_PROTOCOL_INTERFACE_PRESENCE_STATUSES, - TP_HASH_TYPE_SIMPLE_STATUS_SPEC_MAP); + TP_PROP_PROTOCOL_INTERFACE_PRESENCE1_STATUSES, + TP_HASH_TYPE_STATUS_SPEC_MAP); g_return_if_fail (statuses != NULL); g_hash_table_iter_init (&iter, statuses); @@ -349,11 +349,11 @@ mgr_file_contents (const char *busname, auth_types = tp_asv_get_strv (props, TP_PROP_PROTOCOL_AUTHENTICATION_TYPES); addr_vcard_fields = tp_asv_get_strv (props, - TP_PROP_PROTOCOL_INTERFACE_ADDRESSING_ADDRESSABLE_VCARD_FIELDS); + TP_PROP_PROTOCOL_INTERFACE_ADDRESSING1_ADDRESSABLE_VCARD_FIELDS); addr_uri_schemes = tp_asv_get_strv (props, - TP_PROP_PROTOCOL_INTERFACE_ADDRESSING_ADDRESSABLE_URI_SCHEMES); + TP_PROP_PROTOCOL_INTERFACE_ADDRESSING1_ADDRESSABLE_URI_SCHEMES); mime_types = tp_asv_get_strv (props, - TP_PROP_PROTOCOL_INTERFACE_AVATARS_SUPPORTED_AVATAR_MIME_TYPES); + TP_PROP_PROTOCOL_INTERFACE_AVATARS1_SUPPORTED_AVATAR_MIME_TYPES); write_parameters (f, section_name, TP_BASE_PROTOCOL (protocol)); write_rccs (f, section_name, props); @@ -374,31 +374,31 @@ mgr_file_contents (const char *busname, mime_types, g_strv_length ((gchar **) mime_types)); g_key_file_set_integer (f, section_name, "MinimumAvatarHeight", tp_asv_get_uint32 (props, - TP_PROP_PROTOCOL_INTERFACE_AVATARS_MINIMUM_AVATAR_HEIGHT, + TP_PROP_PROTOCOL_INTERFACE_AVATARS1_MINIMUM_AVATAR_HEIGHT, NULL)); g_key_file_set_integer (f, section_name, "RecommendedAvatarHeight", tp_asv_get_uint32 (props, - TP_PROP_PROTOCOL_INTERFACE_AVATARS_RECOMMENDED_AVATAR_HEIGHT, + TP_PROP_PROTOCOL_INTERFACE_AVATARS1_RECOMMENDED_AVATAR_HEIGHT, NULL)); g_key_file_set_integer (f, section_name, "MaximumAvatarHeight", tp_asv_get_uint32 (props, - TP_PROP_PROTOCOL_INTERFACE_AVATARS_MAXIMUM_AVATAR_HEIGHT, + TP_PROP_PROTOCOL_INTERFACE_AVATARS1_MAXIMUM_AVATAR_HEIGHT, NULL)); g_key_file_set_integer (f, section_name, "MinimumAvatarWidth", tp_asv_get_uint32 (props, - TP_PROP_PROTOCOL_INTERFACE_AVATARS_MINIMUM_AVATAR_WIDTH, + TP_PROP_PROTOCOL_INTERFACE_AVATARS1_MINIMUM_AVATAR_WIDTH, NULL)); g_key_file_set_integer (f, section_name, "RecommendedAvatarWidth", tp_asv_get_uint32 (props, - TP_PROP_PROTOCOL_INTERFACE_AVATARS_RECOMMENDED_AVATAR_WIDTH, + TP_PROP_PROTOCOL_INTERFACE_AVATARS1_RECOMMENDED_AVATAR_WIDTH, NULL)); g_key_file_set_integer (f, section_name, "MaximumAvatarWidth", tp_asv_get_uint32 (props, - TP_PROP_PROTOCOL_INTERFACE_AVATARS_MAXIMUM_AVATAR_WIDTH, + TP_PROP_PROTOCOL_INTERFACE_AVATARS1_MAXIMUM_AVATAR_WIDTH, NULL)); g_key_file_set_integer (f, section_name, "MaximumAvatarBytes", tp_asv_get_uint32 (props, - TP_PROP_PROTOCOL_INTERFACE_AVATARS_MAXIMUM_AVATAR_BYTES, + TP_PROP_PROTOCOL_INTERFACE_AVATARS1_MAXIMUM_AVATAR_BYTES, NULL)); write_presence (f, section_name, props); diff --git a/tests/test-handles.c b/tests/test-handles.c index ebc4c3914..6522a749c 100644 --- a/tests/test-handles.c +++ b/tests/test-handles.c @@ -12,7 +12,7 @@ static void test_handles (guint handle_type) { - TpHandleRepoIface *repos[TP_NUM_HANDLE_TYPES]; + TpHandleRepoIface *repos[TP_NUM_ENTITY_TYPES]; TpHandleRepoIface *tp_repo = NULL; GError *error = NULL; guint i; @@ -21,7 +21,7 @@ test_handles (guint handle_type) const gchar *jid = "handle.test@foobar"; const gchar *return_jid; - for (i = 0; i < TP_NUM_HANDLE_TYPES; i++) + for (i = 0; i < TP_NUM_ENTITY_TYPES; i++) { repos[i] = NULL; } @@ -64,7 +64,7 @@ test_handles (guint handle_type) return_jid = tp_handle_inspect (tp_repo, handle); g_assert (!strcmp (return_jid, jid)); - for (i = 0; i < TP_NUM_HANDLE_TYPES; i++) + for (i = 0; i < TP_NUM_ENTITY_TYPES; i++) { if (repos[i]) g_object_unref ((GObject *) repos[i]); @@ -75,7 +75,7 @@ int main (int argc, char **argv) { g_type_init (); - test_handles (TP_HANDLE_TYPE_CONTACT); - test_handles (TP_HANDLE_TYPE_ROOM); + test_handles (TP_ENTITY_TYPE_CONTACT); + test_handles (TP_ENTITY_TYPE_ROOM); return 0; } diff --git a/tests/twisted/Makefile.am b/tests/twisted/Makefile.am index 22cf954ab..8e9845cde 100644 --- a/tests/twisted/Makefile.am +++ b/tests/twisted/Makefile.am @@ -55,16 +55,9 @@ TWISTED_TESTS = \ muc/test-muc-invitation.py \ muc/test-muc-ownership.py \ muc/test-muc.py \ - olpc/change-notifications.py \ - olpc/current-activity.py \ - olpc/olpc-muc-invitation.py \ - olpc/olpc-muc-prop-change.py \ - olpc/test-olpc-bundle.py \ - olpc/test-olpc-set-props-preload.py \ pep-support.py \ plugin-channel-managers.py \ power-save.py \ - presence/decloak.py \ presence/error.py \ presence/initial-contact-presence.py \ presence/initial-presence.py \ @@ -182,7 +175,6 @@ TWISTED_JINGLE_TESTS = \ jingle/call-muc-cancel.py \ jingle/call-muc.py \ jingle/call-muc-re-re-request.py \ - jingle/decloak-peer.py \ jingle/preload-caps-crash.py \ jingle/session-id-collision.py \ jingle/stun-server.py \ @@ -237,7 +229,6 @@ TWISTED_OTHER_FILES = \ jingle-share/jingleshareutils.py \ mucutil.py \ ns.py \ - olpc/util.py \ presence_helper.py \ presence/__init__.py \ presence/invisible_helper.py \ @@ -427,19 +418,19 @@ tools/%.conf: tools/%.conf.in Makefile # We don't use the full filename for the .in because > 99 character filenames # in tarballs are non-portable (and automake 1.8 doesn't let us build # non-archaic tarballs) -tools/servicedir/org.freedesktop.Telepathy.ConnectionManager.%.service: tools/servicedir/%.service.in Makefile +tools/servicedir/im.telepathy.v1.ConnectionManager.%.service: tools/servicedir/%.service.in Makefile $(MKDIR_P) tools/servicedir $(AM_V_GEN)sed -e "s|[@]gabbletestsdir[@]|@gabbletestsdir@|g" $< > $@ -tools/servicedir-uninstalled/org.freedesktop.Telepathy.ConnectionManager.%.service: tools/servicedir-uninstalled/%.service.in +tools/servicedir-uninstalled/im.telepathy.v1.ConnectionManager.%.service: tools/servicedir-uninstalled/%.service.in $(MKDIR_P) tools/servicedir-uninstalled $(AM_V_GEN)sed -e "s|[@]abs_top_builddir[@]|@abs_top_builddir@|g" $< > $@ # D-Bus service file for testing installed_service_in_files = tools/servicedir/gabble.service.in -service_files = tools/servicedir/org.freedesktop.Telepathy.ConnectionManager.gabble.service +service_files = tools/servicedir/im.telepathy.v1.ConnectionManager.gabble.service uninstalled_service_in_files = tools/servicedir-uninstalled/gabble.service.in -uninstalled_service_files = tools/servicedir-uninstalled/org.freedesktop.Telepathy.ConnectionManager.gabble.service +uninstalled_service_files = tools/servicedir-uninstalled/im.telepathy.v1.ConnectionManager.gabble.service # D-Bus config file for testing installed_conf_in_files = tools/servicedir/tmp-session-bus.conf.in diff --git a/tests/twisted/caps/advertise-contact-caps.py b/tests/twisted/caps/advertise-contact-caps.py index ec7ec7b59..8e44d0295 100644 --- a/tests/twisted/caps/advertise-contact-caps.py +++ b/tests/twisted/caps/advertise-contact-caps.py @@ -73,7 +73,7 @@ def run_test(q, bus, conn, stream, initial_video: True}, ], [ media_interface + '/gtalk-p2p', - media_interface + '/ice-udp', + media_interface + '/ice', media_interface + '/video/h264', ]), ]) @@ -91,7 +91,7 @@ def run_test(q, bus, conn, stream, initial_video: True}, ], [ media_interface + '/gtalk-p2p', - media_interface + '/ice-udp', + media_interface + '/ice', ]), ]) (disco_response, namespaces, _, _) = receive_presence_and_ask_caps(q, stream, @@ -127,7 +127,7 @@ def run_test(q, bus, conn, stream, cs.STREAM_TUBE_SERVICE: 'x-abiword' }, ], [ media_interface + '/gtalk-p2p', - media_interface + '/ice-udp', + media_interface + '/ice', media_interface + '/video/h264', ]), ]) @@ -186,7 +186,7 @@ def run_test(q, bus, conn, stream, { cs.CHANNEL_TYPE: media_channel_type, initial_video: True}, ], [ - media_interface + '/ice-udp', + media_interface + '/ice', media_interface + '/video/theora', ]), ]) diff --git a/tests/twisted/caps/receive-jingle.py b/tests/twisted/caps/receive-jingle.py index c35d0dbb8..a9671fdd4 100644 --- a/tests/twisted/caps/receive-jingle.py +++ b/tests/twisted/caps/receive-jingle.py @@ -39,7 +39,7 @@ def test(q, bus, conn, stream): cs.CONN + '/contact-id': 'bob@foo.com', }, }, - conn.Contacts.GetContactAttributes([bob], [cs.CONN_IFACE_CONTACT_CAPS], True)) + conn.Contacts.GetContactAttributes([bob], [cs.CONN_IFACE_CONTACT_CAPS])) # send updated presence with Jingle audio/video caps info. we turn on both # audio and video at the same time to test that all of the capabilities are @@ -97,7 +97,7 @@ def test(q, bus, conn, stream): }, }, conn.Contacts.GetContactAttributes([bob], - [cs.CONN_IFACE_CONTACT_CAPS], True)) + [cs.CONN_IFACE_CONTACT_CAPS])) # send updated presence without video support presence = make_presence('bob@foo.com/Foo', status='hello', @@ -124,7 +124,7 @@ def test(q, bus, conn, stream): }, }, conn.Contacts.GetContactAttributes([bob], - [cs.CONN_IFACE_CONTACT_CAPS], True)) + [cs.CONN_IFACE_CONTACT_CAPS])) # go offline presence = make_presence('bob@foo.com/Foo', type='unavailable') @@ -152,11 +152,11 @@ def test(q, bus, conn, stream): }, }, conn.Contacts.GetContactAttributes([bob], - [cs.CONN_IFACE_CONTACT_CAPS], True)) + [cs.CONN_IFACE_CONTACT_CAPS])) # What about a handle that's not valid? assertEquals({}, conn.Contacts.GetContactAttributes( - [31337], [cs.CONN_IFACE_CONTACT_CAPS], False)) + [31337], [cs.CONN_IFACE_CONTACT_CAPS])) if __name__ == '__main__': exec_test(test) diff --git a/tests/twisted/caps/tube-caps.py b/tests/twisted/caps/tube-caps.py index 1ceb6f8b5..5601fb61f 100644 --- a/tests/twisted/caps/tube-caps.py +++ b/tests/twisted/caps/tube-caps.py @@ -139,7 +139,7 @@ def receive_caps(q, conn, stream, contact, contact_handle, features, # check the Contacts interface give the same caps caps_via_contacts_iface = conn.Contacts.GetContactAttributes( - [contact_handle], [cs.CONN_IFACE_CONTACT_CAPS], False) \ + [contact_handle], [cs.CONN_IFACE_CONTACT_CAPS]) \ [contact_handle][cs.ATTR_CONTACT_CAPABILITIES] assertSameElements(caps[contact_handle], caps_via_contacts_iface) @@ -250,7 +250,7 @@ def advertise_caps(q, conn, stream, filters, expected_features, unexpected_featu # check the Contacts interface give the same caps caps_via_contacts_iface = conn.Contacts.GetContactAttributes( - [self_handle], [cs.CONN_IFACE_CONTACT_CAPS], False) \ + [self_handle], [cs.CONN_IFACE_CONTACT_CAPS]) \ [self_handle][cs.ATTR_CONTACT_CAPABILITIES] assertSameElements(caps[self_handle], caps_via_contacts_iface) @@ -297,7 +297,7 @@ def test_tube_caps_to_contact(q, bus, conn, stream): # check the Contacts interface give the same caps caps_via_contacts_iface = conn.Contacts.GetContactAttributes( - [self_handle], [cs.CONN_IFACE_CONTACT_CAPS], False) \ + [self_handle], [cs.CONN_IFACE_CONTACT_CAPS]) \ [self_handle][cs.ATTR_CONTACT_CAPABILITIES] assertEquals(caps[self_handle], caps_via_contacts_iface) @@ -312,7 +312,7 @@ def test_tube_caps_to_contact(q, bus, conn, stream): # check the Contacts interface give the same caps caps_via_contacts_iface = conn.Contacts.GetContactAttributes( - [self_handle], [cs.CONN_IFACE_CONTACT_CAPS], False) \ + [self_handle], [cs.CONN_IFACE_CONTACT_CAPS]) \ [self_handle][cs.ATTR_CONTACT_CAPABILITIES] assertEquals(caps[self_handle], caps_via_contacts_iface) @@ -329,7 +329,7 @@ def test_tube_caps_to_contact(q, bus, conn, stream): # check the Contacts interface give the same caps caps_via_contacts_iface = conn.Contacts.GetContactAttributes( - [self_handle], [cs.CONN_IFACE_CONTACT_CAPS], False) \ + [self_handle], [cs.CONN_IFACE_CONTACT_CAPS]) \ [self_handle][cs.ATTR_CONTACT_CAPABILITIES] assertEquals(caps[self_handle], caps_via_contacts_iface) diff --git a/tests/twisted/caps_helper.py b/tests/twisted/caps_helper.py index b5579a2e0..3052c9efa 100644 --- a/tests/twisted/caps_helper.py +++ b/tests/twisted/caps_helper.py @@ -316,7 +316,7 @@ def presence_and_disco(q, conn, stream, contact, disco, return h def get_contacts_capabilities_sync(conn, contacts): - h2asv = conn.Contacts.GetContactAttributes(contacts, [cs.CONN_IFACE_CONTACT_CAPS], False) + h2asv = conn.Contacts.GetContactAttributes(contacts, [cs.CONN_IFACE_CONTACT_CAPS]) ret = {} for h in contacts: ret[h] = h2asv[h][cs.ATTR_CONTACT_CAPABILITIES] diff --git a/tests/twisted/client-types.py b/tests/twisted/client-types.py index 7becd11a4..c9ceca387 100644 --- a/tests/twisted/client-types.py +++ b/tests/twisted/client-types.py @@ -63,7 +63,7 @@ def contact_online(q, conn, stream, contact, identities, assertEquals([handle, types], event.args) def get_client_types(conn, handle): - h2asv = conn.Contacts.GetContactAttributes([handle], [cs.CONN_IFACE_CLIENT_TYPES], False) + h2asv = conn.Contacts.GetContactAttributes([handle], [cs.CONN_IFACE_CLIENT_TYPES]) return h2asv[handle][cs.ATTR_CLIENT_TYPES] def test(q, bus, conn, stream): @@ -239,7 +239,7 @@ def test2(q, bus, conn, stream): args=[handle, ['pc']]) attrs = conn.Contacts.GetContactAttributes([handle], - [cs.CONN_IFACE_CLIENT_TYPES], False) + [cs.CONN_IFACE_CLIENT_TYPES]) assertContains(handle, attrs) attr = cs.CONN_IFACE_CLIENT_TYPES + '/client-types' assertContains(attr, attrs[handle]) diff --git a/tests/twisted/console.py b/tests/twisted/console.py index f92e57aa8..d4bf44c9e 100644 --- a/tests/twisted/console.py +++ b/tests/twisted/console.py @@ -27,7 +27,7 @@ def send_unrecognised_get(q, stream): return q.expect('stream-iq', iq_type='error') def test(q, bus, conn, stream): - rccs = conn.Properties.Get(cs.CONN_IFACE_REQUESTS, + rccs = conn.Properties.Get(cs.CONN, 'RequestableChannelClasses') fixed = { diff --git a/tests/twisted/constants.py b/tests/twisted/constants.py index e21bc134a..1a2678f40 100644 --- a/tests/twisted/constants.py +++ b/tests/twisted/constants.py @@ -22,7 +22,7 @@ Some handy constants for other tests to share and enjoy. from dbus import PROPERTIES_IFACE, INTROSPECTABLE_IFACE -PREFIX = "org.freedesktop.Telepathy" +PREFIX = "im.telepathy.v1" PATH_PREFIX = '/' + PREFIX.replace('.', '/') tp_name_prefix = PREFIX @@ -33,51 +33,36 @@ CM = PREFIX + ".ConnectionManager" HT_NONE = 0 HT_CONTACT = 1 HT_ROOM = 2 -HT_LIST = 3 -HT_GROUP = 4 CHANNEL = PREFIX + ".Channel" -CHANNEL_IFACE_CALL_STATE = CHANNEL + ".Interface.CallState" -CHANNEL_IFACE_CHAT_STATE = CHANNEL + '.Interface.ChatState' -CHANNEL_IFACE_DESTROYABLE = CHANNEL + ".Interface.Destroyable" -CHANNEL_IFACE_DTMF = CHANNEL + ".Interface.DTMF" -CHANNEL_IFACE_GROUP = CHANNEL + ".Interface.Group" -CHANNEL_IFACE_HOLD = CHANNEL + ".Interface.Hold" -CHANNEL_IFACE_MEDIA_SIGNALLING = CHANNEL + ".Interface.MediaSignalling" -CHANNEL_IFACE_MESSAGES = CHANNEL + ".Interface.Messages" -CHANNEL_IFACE_PASSWORD = CHANNEL + ".Interface.Password" -CHANNEL_IFACE_TUBE = CHANNEL + ".Interface.Tube" -CHANNEL_IFACE_SASL_AUTH = CHANNEL + ".Interface.SASLAuthentication" -CHANNEL_IFACE_CONFERENCE = CHANNEL + '.Interface.Conference' -CHANNEL_IFACE_ROOM = CHANNEL + '.Interface.Room2' +CHANNEL_IFACE_CHAT_STATE = CHANNEL + '.Interface.ChatState1' +CHANNEL_IFACE_DESTROYABLE = CHANNEL + ".Interface.Destroyable1" +CHANNEL_IFACE_GROUP = CHANNEL + ".Interface.Group1" +CHANNEL_IFACE_HOLD = CHANNEL + ".Interface.Hold1" +CHANNEL_IFACE_PASSWORD = CHANNEL + ".Interface.Password1" +CHANNEL_IFACE_TUBE = CHANNEL + ".Interface.Tube1" +CHANNEL_IFACE_SASL_AUTH = CHANNEL + ".Interface.SASLAuthentication1" +CHANNEL_IFACE_CONFERENCE = CHANNEL + '.Interface.Conference1' +CHANNEL_IFACE_ROOM = CHANNEL + '.Interface.Room1' CHANNEL_IFACE_ROOM_CONFIG = CHANNEL + '.Interface.RoomConfig1' -CHANNEL_IFACE_SUBJECT = CHANNEL + '.Interface.Subject2' -CHANNEL_IFACE_FILE_TRANSFER_METADATA = CHANNEL + '.Interface.FileTransfer.Metadata' -CHANNEL_IFACE_SMS = CHANNEL + '.Interface.SMS' +CHANNEL_IFACE_SUBJECT = CHANNEL + '.Interface.Subject1' +CHANNEL_IFACE_FILE_TRANSFER_METADATA = CHANNEL + '.Interface.FileTransfer.Metadata1' CHANNEL_TYPE_CALL = CHANNEL + ".Type.Call1" -CHANNEL_TYPE_CONTACT_LIST = CHANNEL + ".Type.ContactList" -CHANNEL_TYPE_CONTACT_SEARCH = CHANNEL + ".Type.ContactSearch" +CHANNEL_TYPE_CONTACT_SEARCH = CHANNEL + ".Type.ContactSearch1" CHANNEL_TYPE_TEXT = CHANNEL + ".Type.Text" -CHANNEL_TYPE_TUBES = CHANNEL + ".Type.Tubes" -CHANNEL_TYPE_STREAM_TUBE = CHANNEL + ".Type.StreamTube" -CHANNEL_TYPE_DBUS_TUBE = CHANNEL + ".Type.DBusTube" -CHANNEL_TYPE_TEXT = CHANNEL + ".Type.Text" -CHANNEL_TYPE_FILE_TRANSFER = CHANNEL + ".Type.FileTransfer" -CHANNEL_TYPE_ROOM_LIST = CHANNEL + ".Type.RoomList" +CHANNEL_TYPE_STREAM_TUBE = CHANNEL + ".Type.StreamTube1" +CHANNEL_TYPE_DBUS_TUBE = CHANNEL + ".Type.DBusTube1" +CHANNEL_TYPE_FILE_TRANSFER = CHANNEL + ".Type.FileTransfer1" +CHANNEL_TYPE_ROOM_LIST = CHANNEL + ".Type.RoomList1" CHANNEL_TYPE_SERVER_AUTHENTICATION = \ - CHANNEL + ".Type.ServerAuthentication" + CHANNEL + ".Type.ServerAuthentication1" CHANNEL_TYPE_SERVER_TLS_CONNECTION = \ - CHANNEL + ".Type.ServerTLSConnection" - -TP_AWKWARD_PROPERTIES = PREFIX + ".Properties" -PROPERTY_FLAG_READ = 1 -PROPERTY_FLAG_WRITE = 2 -PROPERTY_FLAGS_RW = PROPERTY_FLAG_READ | PROPERTY_FLAG_WRITE + CHANNEL + ".Type.ServerTLSConnection1" CHANNEL_TYPE = CHANNEL + '.ChannelType' -TARGET_HANDLE_TYPE = CHANNEL + '.TargetHandleType' +TARGET_HANDLE_TYPE = CHANNEL + '.TargetEntityType' TARGET_HANDLE = CHANNEL + '.TargetHandle' TARGET_ID = CHANNEL + '.TargetID' REQUESTED = CHANNEL + '.Requested' @@ -99,10 +84,11 @@ CALL_INITIAL_AUDIO_NAME = CHANNEL_TYPE_CALL + '.InitialAudioName' CALL_INITIAL_VIDEO = CHANNEL_TYPE_CALL + '.InitialVideo' CALL_INITIAL_VIDEO_NAME = CHANNEL_TYPE_CALL + '.InitialVideoName' CALL_MUTABLE_CONTENTS = CHANNEL_TYPE_CALL + '.MutableContents' +CALL_INITIAL_TONES = CHANNEL_TYPE_CALL + '.InitialTones' CALL_CONTENT = PREFIX + '.Call1.Content' CALL_CONTENT_IFACE_MEDIA = CALL_CONTENT + '.Interface.Media' -CALL_CONTENT_IFACE_DTMF = CALL_CONTENT + '.Interface.DTMF' +CALL_CONTENT_IFACE_DTMF = CALL_CONTENT + '.Interface.DTMF1' CALL_CONTENT_MEDIA_DESCRIPTION = CALL_CONTENT + '.MediaDescription' @@ -197,27 +183,23 @@ CONTACT_LIST_STATE_FAILURE = 2 CONTACT_LIST_STATE_SUCCESS = 3 CONN = PREFIX + ".Connection" -CONN_IFACE_AVATARS = CONN + '.Interface.Avatars' -CONN_IFACE_ALIASING = CONN + '.Interface.Aliasing' -CONN_IFACE_CAPS = CONN + '.Interface.Capabilities' -CONN_IFACE_CONTACTS = CONN + '.Interface.Contacts' -CONN_IFACE_CONTACT_CAPS = CONN + '.Interface.ContactCapabilities' -CONN_IFACE_CONTACT_INFO = CONN + ".Interface.ContactInfo" -CONN_IFACE_PRESENCE = CONN + '.Interface.Presence' -CONN_IFACE_RENAMING = CONN + '.Interface.Renaming' +CONN_IFACE_AVATARS = CONN + '.Interface.Avatars1' +CONN_IFACE_ALIASING = CONN + '.Interface.Aliasing1' +CONN_IFACE_CONTACT_CAPS = CONN + '.Interface.ContactCapabilities1' +CONN_IFACE_CONTACT_INFO = CONN + ".Interface.ContactInfo1" +CONN_IFACE_PRESENCE = CONN + '.Interface.Presence1' +CONN_IFACE_RENAMING = CONN + '.Interface.Renaming1' CONN_IFACE_SIDECARS1 = CONN + '.Interface.Sidecars1' -CONN_IFACE_SIMPLE_PRESENCE = CONN + '.Interface.SimplePresence' CONN_IFACE_REQUESTS = CONN + '.Interface.Requests' -CONN_IFACE_LOCATION = CONN + '.Interface.Location' -CONN_IFACE_GABBLE_DECLOAK = CONN + '.Interface.Gabble.Decloak' -CONN_IFACE_MAIL_NOTIFICATION = CONN + '.Interface.MailNotification' -CONN_IFACE_CONTACT_LIST = CONN + '.Interface.ContactList' -CONN_IFACE_CONTACT_GROUPS = CONN + '.Interface.ContactGroups' -CONN_IFACE_CLIENT_TYPES = CONN + '.Interface.ClientTypes' -CONN_IFACE_POWER_SAVING = CONN + '.Interface.PowerSaving' -CONN_IFACE_CONTACT_BLOCKING = CONN + '.Interface.ContactBlocking' +CONN_IFACE_LOCATION = CONN + '.Interface.Location1' +CONN_IFACE_MAIL_NOTIFICATION = CONN + '.Interface.MailNotification1' +CONN_IFACE_CONTACT_LIST = CONN + '.Interface.ContactList1' +CONN_IFACE_CONTACT_GROUPS = CONN + '.Interface.ContactGroups1' +CONN_IFACE_CLIENT_TYPES = CONN + '.Interface.ClientTypes1' +CONN_IFACE_POWER_SAVING = CONN + '.Interface.PowerSaving1' +CONN_IFACE_CONTACT_BLOCKING = CONN + '.Interface.ContactBlocking1' CONN_IFACE_ADDRESSING = CONN + '.Interface.Addressing1' -CONN_IFACE_SERVICE_POINT = CONN + '.Interface.ServicePoint' +CONN_IFACE_SERVICE_POINT = CONN + '.Interface.ServicePoint1' ATTR_ALIAS = CONN_IFACE_ALIASING + '/alias' ATTR_AVATAR_TOKEN = CONN_IFACE_AVATARS + '/token' @@ -227,7 +209,7 @@ ATTR_CONTACT_ID = CONN + '/contact-id' ATTR_CONTACT_INFO = CONN_IFACE_CONTACT_INFO + '/info' ATTR_GROUPS = CONN_IFACE_CONTACT_GROUPS + '/groups' ATTR_LOCATION = CONN_IFACE_LOCATION + '/location' -ATTR_PRESENCE = CONN_IFACE_SIMPLE_PRESENCE + '/presence' +ATTR_PRESENCE = CONN_IFACE_PRESENCE + '/presence' ATTR_PUBLISH = CONN_IFACE_CONTACT_LIST + '/publish' ATTR_SUBSCRIBE = CONN_IFACE_CONTACT_LIST + '/subscribe' @@ -307,17 +289,13 @@ SOCKET_ADDRESS_TYPE_IPV6 = 3 SOCKET_ACCESS_CONTROL_LOCALHOST = 0 SOCKET_ACCESS_CONTROL_PORT = 1 -SOCKET_ACCESS_CONTROL_NETMASK = 2 -SOCKET_ACCESS_CONTROL_CREDENTIALS = 3 +SOCKET_ACCESS_CONTROL_CREDENTIALS = 2 TUBE_STATE_LOCAL_PENDING = 0 TUBE_STATE_REMOTE_PENDING = 1 TUBE_STATE_OPEN = 2 TUBE_STATE_NOT_OFFERED = 3 -TUBE_TYPE_DBUS = 0 -TUBE_TYPE_STREAM = 1 - MEDIA_STREAM_DIRECTION_NONE = 0 MEDIA_STREAM_DIRECTION_SEND = 1 MEDIA_STREAM_DIRECTION_RECEIVE = 2 @@ -329,15 +307,6 @@ MEDIA_STREAM_PENDING_REMOTE_SEND = 2 MEDIA_STREAM_TYPE_AUDIO = 0 MEDIA_STREAM_TYPE_VIDEO = 1 -MEDIA_STREAM_STATE_DISCONNECTED = 0 -MEDIA_STREAM_STATE_CONNECTING = 1 -MEDIA_STREAM_STATE_CONNECTED = 2 - -MEDIA_STREAM_DIRECTION_NONE = 0 -MEDIA_STREAM_DIRECTION_SEND = 1 -MEDIA_STREAM_DIRECTION_RECEIVE = 2 -MEDIA_STREAM_DIRECTION_BIDIRECTIONAL = 3 - FT_STATE_NONE = 0 FT_STATE_PENDING = 1 FT_STATE_ACCEPTED = 2 @@ -384,8 +353,7 @@ GF_MESSAGE_RESCIND = 128 GF_CHANNEL_SPECIFIC_HANDLES = 256 GF_ONLY_ONE_GROUP = 512 GF_HANDLE_OWNERS_NOT_AVAILABLE = 1024 -GF_PROPERTIES = 2048 -GF_MEMBERS_CHANGED_DETAILED = 4096 +GF_MESSAGE_DEPART = 2048 GC_REASON_NONE = 0 GC_REASON_OFFLINE = 1 @@ -517,9 +485,9 @@ class SendError(object): NOT_IMPLEMENTED = 5 PROTOCOL = PREFIX + '.Protocol' -PROTOCOL_IFACE_PRESENCES = PROTOCOL + '.Interface.Presence' -PROTOCOL_IFACE_ADDRESSING = PROTOCOL + '.Interface.Addressing' -PROTOCOL_IFACE_AVATARS = PROTOCOL + '.Interface.Avatars' +PROTOCOL_IFACE_PRESENCES = PROTOCOL + '.Interface.Presence1' +PROTOCOL_IFACE_ADDRESSING = PROTOCOL + '.Interface.Addressing1' +PROTOCOL_IFACE_AVATARS = PROTOCOL + '.Interface.Avatars1' PARAM_REQUIRED = 1 PARAM_REGISTER = 2 @@ -539,9 +507,9 @@ TLS_REJECT_REASON_UNTRUSTED = 1 # Channel.Interface.Messages -MESSAGE_PART_SUPPORT_FLAGS = CHANNEL_IFACE_MESSAGES + '.MessagePartSupportFlags' -DELIVERY_REPORTING_SUPPORT = CHANNEL_IFACE_MESSAGES + '.DeliveryReportingSupport' -SUPPORTED_CONTENT_TYPES = CHANNEL_IFACE_MESSAGES + '.SupportedContentTypes' +MESSAGE_PART_SUPPORT_FLAGS = CHANNEL_TYPE_TEXT + '.MessagePartSupportFlags' +DELIVERY_REPORTING_SUPPORT = CHANNEL_TYPE_TEXT + '.DeliveryReportingSupport' +SUPPORTED_CONTENT_TYPES = CHANNEL_TYPE_TEXT + '.SupportedContentTypes' MSG_SENDING_FLAGS_REPORT_DELIVERY = 1 MSG_SENDING_FLAGS_REPORT_READ = 2 @@ -560,15 +528,7 @@ DELIVERY_STATUS_ACCEPTED = 4 DELIVERY_STATUS_READ = 5 DELIVERY_STATUS_DELETED = 6 -MEDIA_STREAM_ERROR_UNKNOWN = 0 -MEDIA_STREAM_ERROR_EOS = 1 -MEDIA_STREAM_ERROR_CODEC_NEGOTIATION_FAILED = 2 -MEDIA_STREAM_ERROR_CONNECTION_FAILED = 3 -MEDIA_STREAM_ERROR_NETWORK_ERROR = 4 -MEDIA_STREAM_ERROR_NO_CODECS = 5 -MEDIA_STREAM_ERROR_INVALID_CM_BEHAVIOR = 6 -MEDIA_STREAM_ERROR_MEDIA_ERROR = 7 - +PASSWORD_FLAG_HINT = 4 PASSWORD_FLAG_PROVIDE = 8 # Channel.Interface.Room @@ -580,7 +540,7 @@ SUBJECT = CHANNEL_IFACE_ROOM + '.Subject' SUBJECT_PRESENT = 1 SUBJECT_CAN_SET = 2 -DEBUG_IFACE = PREFIX + '.Debug' +DEBUG_IFACE = PREFIX + '.Debug1' DEBUG_PATH = PATH_PREFIX + '/debug' SERVICE_POINT_TYPE_NONE = 0 @@ -595,14 +555,14 @@ HANDLER = PREFIX + '.Client.Handler' CLIENT_IFACE_REQUESTS = CLIENT + '.Interface.Requests' ACCOUNT = PREFIX + '.Account' -ACCOUNT_IFACE_AVATAR = ACCOUNT + '.Interface.Avatar' -ACCOUNT_IFACE_ADDRESSING = ACCOUNT + '.Interface.Addressing' -ACCOUNT_IFACE_HIDDEN = ACCOUNT + '.Interface.Hidden.DRAFT1' +ACCOUNT_IFACE_AVATAR = ACCOUNT + '.Interface.Avatar1' +ACCOUNT_IFACE_ADDRESSING = ACCOUNT + '.Interface.Addressing1' +ACCOUNT_IFACE_HIDDEN = ACCOUNT + '.Interface.Hidden1' ACCOUNT_IFACE_NOKIA_CONDITIONS = 'com.nokia.Account.Interface.Conditions' ACCOUNT_PATH_PREFIX = PATH_PREFIX + '/Account/' AM = PREFIX + '.AccountManager' -AM_IFACE_HIDDEN = AM + '.Interface.Hidden.DRAFT1' +AM_IFACE_HIDDEN = AM + '.Interface.Hidden1' AM_PATH = PATH_PREFIX + '/AccountManager' CR = PREFIX + '.ChannelRequest' @@ -610,17 +570,13 @@ CDO = PREFIX + '.ChannelDispatchOperation' CD = PREFIX + '.ChannelDispatcher' CD_IFACE_MESSAGES1 = PREFIX + '.ChannelDispatcher.Interface.Messages1' -CD_IFACE_OP_LIST = PREFIX + '.ChannelDispatcher.Interface.OperationList' +CD_IFACE_OP_LIST = PREFIX + '.ChannelDispatcher.Interface.OperationList1' CD_PATH = PATH_PREFIX + '/ChannelDispatcher' -CD_REDISPATCH = CD + '.Interface.Redispatch.DRAFT' - -MC = PREFIX + '.MissionControl5' -MC_PATH = PATH_PREFIX + '/MissionControl5' -DTMF_CURRENTLY_SENDING_TONES = CHANNEL_IFACE_DTMF + '.CurrentlySendingTones' -DTMF_INITIAL_TONES = CHANNEL_IFACE_DTMF + '.InitialTones' -DTMF_DEFERRED_TONES = CHANNEL_IFACE_DTMF + '.DeferredTones' +MC = PREFIX + '.MissionControl6' +MC_PATH = PATH_PREFIX + '/MissionControl6' +TESTS = PREFIX + ".Tests" TESTDOT = PREFIX + ".Test." TESTSLASH = PATH_PREFIX + "/Test/" @@ -630,7 +586,3 @@ TEST_DBUS_ACCOUNT_SERVICE_IFACE = TEST_DBUS_ACCOUNT_SERVICE TEST_DBUS_ACCOUNT_PLUGIN_PATH = TESTSLASH + "DBusAccountPlugin" TEST_DBUS_ACCOUNT_PLUGIN_IFACE = TESTDOT + "DBusAccountPlugin" - -# Channel.Interface.SMS -SMS_FLASH = CHANNEL_IFACE_SMS + '.Flash' -SMS_CHANNEL = CHANNEL_IFACE_SMS + '.SMSChannel' diff --git a/tests/twisted/file-transfer/file_transfer_helper.py b/tests/twisted/file-transfer/file_transfer_helper.py index 4fa915b5d..3cea0eb84 100644 --- a/tests/twisted/file-transfer/file_transfer_helper.py +++ b/tests/twisted/file-transfer/file_transfer_helper.py @@ -199,21 +199,14 @@ class ReceiveFileTest(FileTransferTest): def check_new_channel(self): def is_ft_channel_event(event): - channels, = event.args - - if len(channels) > 1: - return False - - path, props = channels[0] + path, props = event.args return props[cs.CHANNEL_TYPE] == cs.CHANNEL_TYPE_FILE_TRANSFER - e = self.q.expect('dbus-signal', signal='NewChannels', + e = self.q.expect('dbus-signal', signal='NewChannel', path=self.conn.object.object_path, predicate=is_ft_channel_event) - channels = e.args[0] - assert len(channels) == 1 - path, props = channels[0] + path, props = e.args # check channel properties # Channel D-Bus properties @@ -365,7 +358,7 @@ class SendFileTest(FileTransferTest): self.close_channel, self.done] def check_ft_available(self): - properties = self.conn.GetAll(cs.CONN_IFACE_REQUESTS, + properties = self.conn.GetAll(cs.CONN, dbus_interface=cs.PROPERTIES_IFACE) # general FT class diff --git a/tests/twisted/file-transfer/ft-client-caps.py b/tests/twisted/file-transfer/ft-client-caps.py index f8c65c940..396b10a97 100644 --- a/tests/twisted/file-transfer/ft-client-caps.py +++ b/tests/twisted/file-transfer/ft-client-caps.py @@ -112,7 +112,7 @@ def receive_caps(q, conn, stream, contact, contact_handle, features, # check the Contacts interface give the same caps caps_via_contacts_iface = conn.Contacts.GetContactAttributes( - [contact_handle], [cs.CONN_IFACE_CONTACT_CAPS], False) \ + [contact_handle], [cs.CONN_IFACE_CONTACT_CAPS]) \ [contact_handle][cs.ATTR_CONTACT_CAPABILITIES] assertSameElements(caps[contact_handle], caps_via_contacts_iface) @@ -200,7 +200,7 @@ def advertise_caps(q, bus, conn, stream, filters, expected_features, unexpected_ # check the Contacts interface give the same caps caps_via_contacts_iface = conn.Contacts.GetContactAttributes( - [self_handle], [cs.CONN_IFACE_CONTACT_CAPS], False) \ + [self_handle], [cs.CONN_IFACE_CONTACT_CAPS]) \ [self_handle][cs.ATTR_CONTACT_CAPABILITIES] assertSameElements(caps[self_handle], caps_via_contacts_iface) @@ -236,7 +236,7 @@ def test_ft_caps_to_contact(q, bus, conn, stream): # check the Contacts interface give the same caps caps_via_contacts_iface = conn.Contacts.GetContactAttributes( - [self_handle], [cs.CONN_IFACE_CONTACT_CAPS], False) \ + [self_handle], [cs.CONN_IFACE_CONTACT_CAPS]) \ [self_handle][cs.ATTR_CONTACT_CAPABILITIES] assertEquals(caps[self_handle], caps_via_contacts_iface) @@ -253,7 +253,7 @@ def test_ft_caps_to_contact(q, bus, conn, stream): # check the Contacts interface give the same caps caps_via_contacts_iface = conn.Contacts.GetContactAttributes( - [self_handle], [cs.CONN_IFACE_CONTACT_CAPS], False) \ + [self_handle], [cs.CONN_IFACE_CONTACT_CAPS]) \ [self_handle][cs.ATTR_CONTACT_CAPABILITIES] assertEquals(caps[self_handle], caps_via_contacts_iface) @@ -272,7 +272,7 @@ def test_ft_caps_to_contact(q, bus, conn, stream): # check the Contacts interface give the same caps caps_via_contacts_iface = conn.Contacts.GetContactAttributes( - [self_handle], [cs.CONN_IFACE_CONTACT_CAPS], False) \ + [self_handle], [cs.CONN_IFACE_CONTACT_CAPS]) \ [self_handle][cs.ATTR_CONTACT_CAPABILITIES] assertEquals(caps[self_handle], caps_via_contacts_iface) @@ -291,7 +291,7 @@ def test_ft_caps_to_contact(q, bus, conn, stream): # check the Contacts interface give the same caps caps_via_contacts_iface = conn.Contacts.GetContactAttributes( - [self_handle], [cs.CONN_IFACE_CONTACT_CAPS], False) \ + [self_handle], [cs.CONN_IFACE_CONTACT_CAPS]) \ [self_handle][cs.ATTR_CONTACT_CAPABILITIES] assertEquals(caps[self_handle], caps_via_contacts_iface) diff --git a/tests/twisted/file-transfer/test-caps-file-transfer.py b/tests/twisted/file-transfer/test-caps-file-transfer.py index c7d6c9b30..03b134974 100644 --- a/tests/twisted/file-transfer/test-caps-file-transfer.py +++ b/tests/twisted/file-transfer/test-caps-file-transfer.py @@ -20,7 +20,7 @@ if not FILE_TRANSFER_ENABLED: def test_ft_caps_from_contact(q, bus, conn, stream, contact, contact_handle, client): conn_caps_iface = dbus.Interface(conn, cs.CONN_IFACE_CONTACT_CAPS) - conn_contacts_iface = dbus.Interface(conn, cs.CONN_IFACE_CONTACTS) + conn_contacts_iface = dbus.Interface(conn, cs.CONN) # send presence with no FT cap presence = make_presence(contact, status='hello') @@ -55,7 +55,7 @@ def test_ft_caps_from_contact(q, bus, conn, stream, contact, contact_handle, cli assert caps == basic_caps, caps # check the Contacts interface give the same caps caps_via_contacts_iface = conn_contacts_iface.GetContactAttributes( - [contact_handle], [cs.CONN_IFACE_CONTACT_CAPS], False) \ + [contact_handle], [cs.CONN_IFACE_CONTACT_CAPS]) \ [contact_handle][cs.ATTR_CONTACT_CAPABILITIES] assert caps_via_contacts_iface == caps[contact_handle], \ caps_via_contacts_iface @@ -97,7 +97,7 @@ def test_ft_caps_from_contact(q, bus, conn, stream, contact, contact_handle, cli assert caps == generic_tubes_caps, caps # check the Contacts interface give the same caps caps_via_contacts_iface = conn_contacts_iface.GetContactAttributes( - [contact_handle], [cs.CONN_IFACE_CONTACT_CAPS], False) \ + [contact_handle], [cs.CONN_IFACE_CONTACT_CAPS]) \ [contact_handle][cs.ATTR_CONTACT_CAPABILITIES] assert caps_via_contacts_iface == caps[contact_handle], \ caps_via_contacts_iface diff --git a/tests/twisted/jingle-share/file_transfer_helper.py b/tests/twisted/jingle-share/file_transfer_helper.py index 07119d443..b49cef1c2 100644 --- a/tests/twisted/jingle-share/file_transfer_helper.py +++ b/tests/twisted/jingle-share/file_transfer_helper.py @@ -250,23 +250,17 @@ class ReceiveFileTest(FileTransferTest): def check_new_channel(self): def is_ft_channel_event(event): - channels, = event.args - - if len(channels) > 1: - return False - - path, props = channels[0] + path, props = event.args return props[cs.CHANNEL_TYPE] == cs.CHANNEL_TYPE_FILE_TRANSFER - e = self.q.expect('dbus-signal', signal='NewChannels', + e = self.q.expect('dbus-signal', signal='NewChannel', path=self.conn.object.object_path, predicate=is_ft_channel_event) - channels, = e.args - path, props = channels[0] + path, props = e.args # check channel properties - # org.freedesktop.Telepathy.Channel D-Bus properties + # Channel D-Bus properties assert props[cs.CHANNEL_TYPE] == cs.CHANNEL_TYPE_FILE_TRANSFER, props assertSameSets( [ cs.CHANNEL_IFACE_FILE_TRANSFER_METADATA, @@ -278,7 +272,7 @@ class ReceiveFileTest(FileTransferTest): assert props[cs.INITIATOR_HANDLE] == self.handle, props assert props[cs.INITIATOR_ID] == self.target, props - # org.freedesktop.Telepathy.Channel.Type.FileTransfer D-Bus properties + # Channel.Type.FileTransfer D-Bus properties assert props[cs.FT_STATE] == cs.FT_STATE_PENDING, props assert props[cs.FT_CONTENT_TYPE] == '', props assert props[cs.FT_FILENAME].encode('utf-8') == self.file.name, props @@ -383,7 +377,7 @@ class SendFileTest(FileTransferTest): self.close_channel, self.done] def check_ft_available(self): - properties = self.conn.GetAll(cs.CONN_IFACE_REQUESTS, + properties = self.conn.GetAll(cs.CONN, dbus_interface=cs.PROPERTIES_IFACE) # general FT class @@ -420,7 +414,7 @@ class SendFileTest(FileTransferTest): cs.FT_INITIAL_OFFSET: 0, }) - # org.freedesktop.Telepathy.Channel D-Bus properties + # Telepathy.Channel D-Bus properties assert props[cs.CHANNEL_TYPE] == cs.CHANNEL_TYPE_FILE_TRANSFER assertSameSets( [ cs.CHANNEL_IFACE_FILE_TRANSFER_METADATA, @@ -432,7 +426,7 @@ class SendFileTest(FileTransferTest): assert props[cs.INITIATOR_HANDLE] == self.self_handle assert props[cs.INITIATOR_ID] == self.self_handle_name - # org.freedesktop.Telepathy.Channel.Type.FileTransfer D-Bus properties + # Telepathy.Channel.Type.FileTransfer D-Bus properties assert props[cs.FT_STATE] == cs.FT_STATE_PENDING assert props[cs.FT_CONTENT_TYPE] == self.file.content_type assert props[cs.FT_FILENAME].encode('utf-8') == self.file.name, props diff --git a/tests/twisted/jingle-share/jingleshareutils.py b/tests/twisted/jingle-share/jingleshareutils.py index 21030dc4d..67a6dd408 100644 --- a/tests/twisted/jingle-share/jingleshareutils.py +++ b/tests/twisted/jingle-share/jingleshareutils.py @@ -19,7 +19,7 @@ def test_ft_caps_from_contact(q, bus, conn, stream, contact, contact_handle, cli run += 1 conn_caps_iface = dbus.Interface(conn, cs.CONN_IFACE_CONTACT_CAPS) - conn_contacts_iface = dbus.Interface(conn, cs.CONN_IFACE_CONTACTS) + conn_contacts_iface = dbus.Interface(conn, cs.CONN) # send presence with no FT cap presence = make_presence(contact, status='hello') @@ -54,7 +54,7 @@ def test_ft_caps_from_contact(q, bus, conn, stream, contact, contact_handle, cli assert caps == basic_caps, caps # check the Contacts interface give the same caps caps_via_contacts_iface = conn_contacts_iface.GetContactAttributes( - [contact_handle], [cs.CONN_IFACE_CONTACT_CAPS], False) \ + [contact_handle], [cs.CONN_IFACE_CONTACT_CAPS]) \ [contact_handle][cs.ATTR_CONTACT_CAPABILITIES] assert caps_via_contacts_iface == caps[contact_handle], \ caps_via_contacts_iface @@ -96,7 +96,7 @@ def test_ft_caps_from_contact(q, bus, conn, stream, contact, contact_handle, cli assert caps == generic_ft_caps, caps # check the Contacts interface give the same caps caps_via_contacts_iface = conn_contacts_iface.GetContactAttributes( - [contact_handle], [cs.CONN_IFACE_CONTACT_CAPS], False) \ + [contact_handle], [cs.CONN_IFACE_CONTACT_CAPS]) \ [contact_handle][cs.ATTR_CONTACT_CAPABILITIES] assert caps_via_contacts_iface == caps[contact_handle], \ caps_via_contacts_iface diff --git a/tests/twisted/jingle-share/test-caps-file-transfer.py b/tests/twisted/jingle-share/test-caps-file-transfer.py index f3be084ed..f52ec2a16 100644 --- a/tests/twisted/jingle-share/test-caps-file-transfer.py +++ b/tests/twisted/jingle-share/test-caps-file-transfer.py @@ -44,7 +44,7 @@ generic_caps = [(text_fixed_properties, text_allowed_properties), (dbus_tube_fixed_properties, dbus_tube_allowed_properties)] def check_contact_caps(conn, handle, with_ft): - conn_contacts_iface = dbus.Interface(conn, cs.CONN_IFACE_CONTACTS) + conn_contacts_iface = dbus.Interface(conn, cs.CONN) if with_ft: expected_caps = dbus.Dictionary({handle: generic_ft_caps}) @@ -55,7 +55,7 @@ def check_contact_caps(conn, handle, with_ft): assert caps == expected_caps, caps # check the Contacts interface give the same caps caps_via_contacts_iface = conn_contacts_iface.GetContactAttributes( - [handle], [cs.CONN_IFACE_CONTACT_CAPS], False) \ + [handle], [cs.CONN_IFACE_CONTACT_CAPS]) \ [handle][cs.ATTR_CONTACT_CAPABILITIES] assert caps_via_contacts_iface == caps[handle], \ caps_via_contacts_iface diff --git a/tests/twisted/jingle-share/test-multift.py b/tests/twisted/jingle-share/test-multift.py index 889e6aeca..e1e4570ba 100644 --- a/tests/twisted/jingle-share/test-multift.py +++ b/tests/twisted/jingle-share/test-multift.py @@ -69,7 +69,7 @@ def test(q, bus, conn, stream): # /!\ This predicate has side-effects: it writes to 'found' def predicate(e): - path, props = e.args[0][0] + path, props = e.args if props[cs.CHANNEL_TYPE] != cs.CHANNEL_TYPE_FILE_TRANSFER: return False @@ -86,7 +86,7 @@ def test(q, bus, conn, stream): return False patterns.append(EventPattern('dbus-signal', - signal='NewChannels', + signal='NewChannel', predicate=get_predicate(name, found, i))) # Make sure every file transfer has a channel associated with it diff --git a/tests/twisted/jingle/call-codecoffer.py b/tests/twisted/jingle/call-codecoffer.py index 987ebf3b4..9dfd5cf66 100644 --- a/tests/twisted/jingle/call-codecoffer.py +++ b/tests/twisted/jingle/call-codecoffer.py @@ -110,12 +110,12 @@ def test_incoming(jp, q, bus, conn, stream): jt2.incoming_call() - ret = q.expect_many(EventPattern('dbus-signal', signal='NewChannels', + ret = q.expect_many(EventPattern('dbus-signal', signal='NewChannel', predicate=lambda e: - cs.CHANNEL_TYPE_CALL in e.args[0][0][1].values()), + cs.CHANNEL_TYPE_CALL in e.args[1].values()), EventPattern('dbus-signal', signal='NewMediaDescriptionOffer')) - chan = bus.get_object(conn.bus_name, ret[0].args[0][0][0]) + chan = bus.get_object(conn.bus_name, ret[0].args[0]) properties = chan.GetAll(cs.CHANNEL_TYPE_CALL, dbus_interface=dbus.PROPERTIES_IFACE) @@ -172,14 +172,14 @@ def test_outgoing(jp, q, bus, conn, stream): cs.CALL_INITIAL_VIDEO: False }, dbus_interface=cs.CONN_IFACE_REQUESTS) - ret = q.expect_many(EventPattern('dbus-signal', signal='NewChannels', + ret = q.expect_many(EventPattern('dbus-signal', signal='NewChannel', predicate=lambda e: - cs.CHANNEL_TYPE_CALL in e.args[0][0][1].values()), + cs.CHANNEL_TYPE_CALL in e.args[1].values()), # a codec offer appears already! EventPattern('dbus-signal', signal='NewMediaDescriptionOffer')) # all the basic stuff is already tested in call-basics.py - chan = bus.get_object(conn.bus_name, ret[0].args[0][0][0]) + chan = bus.get_object(conn.bus_name, ret[0].args[0]) # there is no remote codec information, so this should be empty assertEquals(ret[1].args[1][cs.CALL_CONTENT_MEDIA_DESCRIPTION + ".Codecs"], []) diff --git a/tests/twisted/jingle/call-muc.py b/tests/twisted/jingle/call-muc.py index f82c07eee..2d38ceb88 100644 --- a/tests/twisted/jingle/call-muc.py +++ b/tests/twisted/jingle/call-muc.py @@ -50,9 +50,9 @@ def run_incoming_test(q, bus, conn, stream, bob_leaves_room = False): stream.send(presence) e = q.expect ('dbus-signal', - signal='NewChannels', + signal='NewChannel', predicate=lambda e: \ - e.args[0][0][1][cs.CHANNEL_TYPE] == cs.CHANNEL_TYPE_CALL ) + e.args[1][cs.CHANNEL_TYPE] == cs.CHANNEL_TYPE_CALL ) (path, props) = e.args[0][0] diff --git a/tests/twisted/jingle/call_helper.py b/tests/twisted/jingle/call_helper.py index 76f595322..f1f9f1e99 100644 --- a/tests/twisted/jingle/call_helper.py +++ b/tests/twisted/jingle/call_helper.py @@ -286,14 +286,9 @@ class CallTest(object): cs.CALL_INITIAL_VIDEO: self.initial_video, }) - signal = self.q.expect('dbus-signal', signal='NewChannels', - predicate=lambda e: - cs.CHANNEL_TYPE_CONTACT_LIST not in e.args[0][0][1].values()) + signal = self.q.expect('dbus-signal', signal='NewChannel') - assertLength(1, signal.args) - assertLength(1, signal.args[0]) # one channel - assertLength(2, signal.args[0][0]) # two struct members - emitted_props = signal.args[0][0][1] + emitted_props = signal.args[1] assertEquals( cs.CHANNEL_TYPE_CALL, emitted_props[cs.CHANNEL_TYPE]) @@ -314,7 +309,7 @@ class CallTest(object): assertEquals(self.initial_audio, emitted_props[cs.CALL_INITIAL_AUDIO]) assertEquals(self.initial_video, emitted_props[cs.CALL_INITIAL_VIDEO]) - chan_path = signal.args[0][0][0] + chan_path = signal.args[0] self.chan = wrap_channel( self.bus.get_object(self.conn.bus_name, chan_path), 'Call') @@ -324,7 +319,7 @@ class CallTest(object): # Check if all the properties are there assertEquals(sorted([ "Contents", "CallMembers", "CallState", "CallFlags", "CallStateReason", "CallStateDetails", - "HardwareStreaming", "InitialAudio", "InitialAudioName", + "HardwareStreaming", "InitialAudio", "InitialAudioName", "InitialTones", "InitialVideo", "InitialVideoName", "MutableContents", "InitialTransport", "MemberIdentifiers" ]), sorted(properties.keys())) diff --git a/tests/twisted/jingle/decloak-peer.py b/tests/twisted/jingle/decloak-peer.py deleted file mode 100644 index 237472b66..000000000 --- a/tests/twisted/jingle/decloak-peer.py +++ /dev/null @@ -1,66 +0,0 @@ -""" -Test use-case when client attempts to call an unsubscribed contact. Gabble -should ask them to "de-cloak". -""" - -from gabbletest import exec_test -from servicetest import (make_channel_proxy, call_async, sync_dbus, - assertEquals, assertLength) -from jingletest2 import JingleProtocol031, JingleTest2 - -import dbus - -import constants as cs -import ns - -from config import VOIP_ENABLED - -if not VOIP_ENABLED: - print "NOTE: built with --disable-voip" - raise SystemExit(77) - -def test(q, bus, conn, stream): - jp = JingleProtocol031() - jt = JingleTest2(jp, conn, q, stream, 'test@localhost', 'foo@bar.com/Foo') - jt2 = JingleTest2(jp, conn, q, stream, 'test@localhost', - 'foo2@bar.com/Foo') - # Make gabble think this is a different client - jt2.remote_caps['node'] = 'http://example.com/fake-client1' - - run_test(q, bus, conn, stream, jt, True) - run_test(q, bus, conn, stream, jt2, False) - -def run_test(q, bus, conn, stream, jt, decloak_allowed): - """ - Requests streams on a media channel to jt.remote_jid without having their - presence at all. - """ - - call_async(q, conn.Requests, 'CreateChannel', - { cs.CHANNEL_TYPE: cs.CHANNEL_TYPE_CALL, - cs.TARGET_HANDLE_TYPE: cs.HT_CONTACT, - cs.TARGET_ID: jt.peer, - cs.CALL_INITIAL_AUDIO: True, - cs.CALL_INITIAL_VIDEO: False, - }) - - e = q.expect('stream-presence', - to=jt.peer_bare_jid, presence_type=None) - nodes = [ node for node in e.stanza.elements(uri=ns.TEMPPRES, name='temppres') ] - assertLength(1, nodes) - assertEquals('media', nodes[0].getAttribute('reason')) - - if decloak_allowed: - jt.send_presence_and_caps() - - # RequestStreams should now happily complete - q.expect('dbus-return', method='CreateChannel') - else: - q.expect('dbus-error', method='CreateChannel', - name=cs.OFFLINE) - -if __name__ == '__main__': - print "FIXME: needs to be ported to Call1" - raise SystemExit(77) - - exec_test(test, timeout=10) diff --git a/tests/twisted/jingle/session-id-collision.py b/tests/twisted/jingle/session-id-collision.py index b9815407b..8fe28d452 100644 --- a/tests/twisted/jingle/session-id-collision.py +++ b/tests/twisted/jingle/session-id-collision.py @@ -27,14 +27,14 @@ def test(jp, q, bus, conn, stream): jt2.sid = '1' jt1.incoming_call() - q.expect('dbus-signal', signal='NewChannels', - predicate=lambda e: cs.CHANNEL_TYPE_CALL in e.args[0][0][1][cs.CHANNEL_TYPE]) + q.expect('dbus-signal', signal='NewChannel', + predicate=lambda e: cs.CHANNEL_TYPE_CALL in e.args[1][cs.CHANNEL_TYPE]) # If Gabble confuses the two sessions, it'll NAK the IQ rather than # realising this is a new call. jt2.incoming_call() - q.expect('dbus-signal', signal='NewChannels', - predicate=lambda e: cs.CHANNEL_TYPE_CALL in e.args[0][0][1][cs.CHANNEL_TYPE]) + q.expect('dbus-signal', signal='NewChannel', + predicate=lambda e: cs.CHANNEL_TYPE_CALL in e.args[1][cs.CHANNEL_TYPE]) # On the other hand, if the same person calls twice with the same sid, # Gabble _should_ NAK the second s-i. diff --git a/tests/twisted/jingle/stun-server.py b/tests/twisted/jingle/stun-server.py index ab7c538ce..011a46140 100644 --- a/tests/twisted/jingle/stun-server.py +++ b/tests/twisted/jingle/stun-server.py @@ -108,17 +108,15 @@ def test_call(jp, q, bus, conn, stream, assertLength(0, e.args) assertEquals(e.interface, cs.CALL_STREAM_IFACE_MEDIA) - e = q.expect('dbus-signal', signal='NewChannels', - predicate=lambda e: cs.CHANNEL_TYPE_CONTACT_LIST not in e.args) - assert e.args[0][0][0] + e = q.expect('dbus-signal', signal='NewChannel') - call_chan = make_channel_proxy(conn, e.args[0][0][0], 'Channel') + call_chan = make_channel_proxy(conn, e.args[0], 'Channel') # Exercise channel properties channel_props = call_chan.GetAll( cs.CHANNEL, dbus_interface=dbus.PROPERTIES_IFACE) assertEquals(remote_handle, channel_props['TargetHandle']) - assertEquals(1, channel_props['TargetHandleType']) + assertEquals(1, channel_props['TargetEntityType']) assertEquals('foo@bar.com', channel_props['TargetID']) assertEquals(False, channel_props['Requested']) assertEquals('foo@bar.com', channel_props['InitiatorID']) diff --git a/tests/twisted/muc/kicked.py b/tests/twisted/muc/kicked.py index 307b96f25..45694e36f 100644 --- a/tests/twisted/muc/kicked.py +++ b/tests/twisted/muc/kicked.py @@ -35,7 +35,7 @@ def test(q, bus, conn, stream): ) )) - mcd_event = q.expect('dbus-signal', signal='MembersChangedDetailed') + mcd_event = q.expect('dbus-signal', signal='MembersChanged') added, removed, local_pending, remote_pending, details = mcd_event.args assertEquals([], added) assertEquals([muc_self_handle], removed) diff --git a/tests/twisted/muc/name-conflict.py b/tests/twisted/muc/name-conflict.py index 2aee8d2f3..3d7c226e4 100644 --- a/tests/twisted/muc/name-conflict.py +++ b/tests/twisted/muc/name-conflict.py @@ -182,14 +182,14 @@ def test_gtalk_weirdness(q, bus, conn, stream, room_jid): # try to join the MUC, because until we do so, Gabble doesn't know that # room_jid is a MUC, and so considers these three JIDs to be different # resources of the same contact. There is no race between this method - # returning and MembersChangedDetailed firing, because libdbus reorders + # returning and MembersChanged firing, because libdbus reorders # messages when you make blocking calls. handle, handle_, handle__, foobar_handle = conn.get_contact_handles_sync( jids + ['%s/foobar_gmail.com' % room_jid]) - q.expect('dbus-signal', signal='MembersChangedDetailed', + q.expect('dbus-signal', signal='MembersChanged', predicate=lambda e: e.args[0:4] == [[foobar_handle], [], [], []]) - q.expect('dbus-signal', signal='MembersChangedDetailed', + q.expect('dbus-signal', signal='MembersChanged', predicate=lambda e: e.args[0:4] == [[handle], [], [], []]) group_props = text_chan.Properties.GetAll(cs.CHANNEL_IFACE_GROUP) diff --git a/tests/twisted/muc/only-text-when-needed.py b/tests/twisted/muc/only-text-when-needed.py index 744e47ef0..2e840d9b7 100644 --- a/tests/twisted/muc/only-text-when-needed.py +++ b/tests/twisted/muc/only-text-when-needed.py @@ -24,7 +24,7 @@ def stream_tube(q, bus, conn, stream, method, jid, presence=True): if presence: send_muc_presence(q, stream, jid) e, _ = q.expect_many(EventPattern('dbus-return', method=method), - EventPattern('dbus-signal', signal='NewChannels')) + EventPattern('dbus-signal', signal='NewChannel')) # sigh if method == 'EnsureChannel': @@ -48,7 +48,7 @@ def text_channel(q, bus, conn, stream, method, jid, presence=True): if presence: send_muc_presence(q, stream, jid) e, _ = q.expect_many(EventPattern('dbus-return', method=method), - EventPattern('dbus-signal', signal='NewChannels')) + EventPattern('dbus-signal', signal='NewChannel')) # sigh if method == 'EnsureChannel': @@ -110,16 +110,14 @@ def tube_no_text(q, bus, conn, stream): ret, new_sig = q.expect_many( EventPattern('dbus-return', method='CreateChannel'), - EventPattern('dbus-signal', signal='NewChannels')) + EventPattern('dbus-signal', signal='NewChannel')) - q.forbid_events([EventPattern('dbus-signal', signal='NewChannels')]) + q.forbid_events([EventPattern('dbus-signal', signal='NewChannel')]) tube_path, tube_props = ret.value assertEquals(cs.CHANNEL_TYPE_STREAM_TUBE, tube_props[cs.CHANNEL_TYPE]) - channels = new_sig.args[0] - assertEquals(1, len(channels)) - path, props = channels[0] + path, props = new_sig.args assertEquals(tube_path, path) assertEquals(tube_props, props) @@ -144,11 +142,9 @@ def tube_then_text(q, bus, conn, stream): assertEquals(True, yours) assertEquals(cs.CHANNEL_TYPE_TEXT, text_props[cs.CHANNEL_TYPE]) - new_sig = q.expect('dbus-signal', signal='NewChannels') + new_sig = q.expect('dbus-signal', signal='NewChannel') - channels = new_sig.args[0] - assertEquals(1, len(channels)) - path, props = channels[0] + path, props = new_sig.args assertEquals(text_path, path) assertEquals(text_props, props) @@ -248,13 +244,10 @@ def recreate_text(q, bus, conn, stream): path, props = ret.value assertEquals(cs.CHANNEL_TYPE_TEXT, props[cs.CHANNEL_TYPE]) - new_sig = q.expect('dbus-signal', signal='NewChannels') + new_sig = q.expect('dbus-signal', signal='NewChannel') - channels = new_sig.args[0] - assertEquals(1, len(channels)) - - assertEquals(path, channels[0][0]) - assertEquals(props, channels[0][1]) + assertEquals(path, new_sig.args[0]) + assertEquals(props, new_sig.args[1]) # the channel should be identical given it's the same MucChannel assertEquals(text_path, path) @@ -304,10 +297,8 @@ def test_message(q, bus, conn, stream): ) # the text channel appears! - e = q.expect('dbus-signal', signal='NewChannels') - channels = e.args[0] - assertEquals(1, len(channels)) - path, props = channels[0] + e = q.expect('dbus-signal', signal='NewChannel') + path, props = e.args assertEquals(cs.CHANNEL_TYPE_TEXT, props[cs.CHANNEL_TYPE]) # make sure we didn't request it assertEquals(False, props[cs.REQUESTED]) @@ -356,10 +347,8 @@ def test_requested_message(q, bus, conn, stream): ) ) - e = q.expect('dbus-signal', signal='NewChannels') - channels = e.args[0] - assertEquals(1, len(channels)) - path, props = channels[0] + e = q.expect('dbus-signal', signal='NewChannel') + path, props = e.args assertEquals(cs.CHANNEL_TYPE_TEXT, props[cs.CHANNEL_TYPE]) # now make sure we didn't request it assertEquals(False, props[cs.REQUESTED]) diff --git a/tests/twisted/muc/password.py b/tests/twisted/muc/password.py index ee1ec3300..62cecf2c3 100644 --- a/tests/twisted/muc/password.py +++ b/tests/twisted/muc/password.py @@ -34,7 +34,7 @@ def test(q, bus, conn, stream): cc, _, _ = q.expect_many( EventPattern('dbus-return', method='CreateChannel'), - EventPattern('dbus-signal', signal='NewChannels'), + EventPattern('dbus-signal', signal='NewChannel'), EventPattern('dbus-signal', signal='PasswordFlagsChanged', args=[cs.PASSWORD_FLAG_PROVIDE, 0])) diff --git a/tests/twisted/muc/roomlist.py b/tests/twisted/muc/roomlist.py index d16fc8987..00f5ddb06 100644 --- a/tests/twisted/muc/roomlist.py +++ b/tests/twisted/muc/roomlist.py @@ -34,6 +34,8 @@ def test(q, bus, conn, stream): properties = conn.Properties.GetAll(cs.CONN_IFACE_REQUESTS) assert properties.get('Channels') == [], properties['Channels'] + + properties = conn.Properties.GetAll(cs.CONN) assert ({ cs.CHANNEL_TYPE: cs.CHANNEL_TYPE_ROOM_LIST, cs.TARGET_HANDLE_TYPE: cs.HT_NONE, }, @@ -52,7 +54,7 @@ def test(q, bus, conn, stream): ret, sig = q.expect_many( EventPattern('dbus-return', method='CreateChannel'), - EventPattern('dbus-signal', signal='NewChannels'), + EventPattern('dbus-signal', signal='NewChannel'), ) path2 = ret.value[0] chan = bus.get_object(conn.bus_name, path2) @@ -67,8 +69,8 @@ def test(q, bus, conn, stream): assertEquals('test@localhost', props[cs.INITIATOR_ID]) assertEquals('conference.example.net', props[cs.CHANNEL_TYPE_ROOM_LIST+ '.Server']) - assert sig.args[0][0][0] == path2 - assert sig.args[0][0][1] == props + assert sig.args[0] == path2 + assert sig.args[1] == props assert chan.Get(cs.CHANNEL_TYPE_ROOM_LIST, 'Server', dbus_interface=dbus.PROPERTIES_IFACE) == \ diff --git a/tests/twisted/muc/send-error.py b/tests/twisted/muc/send-error.py index 4f59fbd18..80cafea6f 100644 --- a/tests/twisted/muc/send-error.py +++ b/tests/twisted/muc/send-error.py @@ -66,7 +66,7 @@ def send_message_and_expect_error(q, stream, } ] - sent_token = text_chan.Messages.SendMessage(greeting, dbus.UInt32(0)) + sent_token = text_chan.Text.SendMessage(greeting, dbus.UInt32(0)) stream_message, _ = q.expect_many( EventPattern('stream-message'), diff --git a/tests/twisted/muc/test-ensure.py b/tests/twisted/muc/test-ensure.py index 858385256..bfdd3a301 100644 --- a/tests/twisted/muc/test-ensure.py +++ b/tests/twisted/muc/test-ensure.py @@ -30,7 +30,7 @@ def test_create_ensure(q, conn, bus, stream, room_jid): }) mc, _ = q.expect_many( - EventPattern('dbus-signal', signal='MembersChangedDetailed'), + EventPattern('dbus-signal', signal='MembersChanged'), EventPattern('stream-presence', to=('%s/test' % room_jid))) added, removed, local_pending, remote_pending, details = mc.args @@ -45,7 +45,7 @@ def test_create_ensure(q, conn, bus, stream, room_jid): # Send presence for own membership of room. stream.send(make_muc_presence('none', 'participant', room_jid, 'test')) - mc = q.expect('dbus-signal', signal='MembersChangedDetailed') + mc = q.expect('dbus-signal', signal='MembersChanged') added, removed, local_pending, remote_pending, details = mc.args assert len(added) == 2, mc.args @@ -94,7 +94,7 @@ def test_ensure_ensure(q, conn, bus, stream, room_jid): }) mc, _ = q.expect_many( - EventPattern('dbus-signal', signal='MembersChangedDetailed'), + EventPattern('dbus-signal', signal='MembersChanged'), EventPattern('stream-presence', to=('%s/test' % room_jid))) added, removed, local_pending, remote_pending, details = mc.args @@ -109,7 +109,7 @@ def test_ensure_ensure(q, conn, bus, stream, room_jid): # Send presence for own membership of room. stream.send(make_muc_presence('none', 'participant', room_jid, 'test')) - mc = q.expect('dbus-signal', signal='MembersChangedDetailed') + mc = q.expect('dbus-signal', signal='MembersChanged') added, removed, local_pending, remote_pending, details = mc.args assert len(added) == 2, mc.args diff --git a/tests/twisted/muc/test-muc-alias.py b/tests/twisted/muc/test-muc-alias.py index a07af1c06..a9675bb7b 100644 --- a/tests/twisted/muc/test-muc-alias.py +++ b/tests/twisted/muc/test-muc-alias.py @@ -17,7 +17,7 @@ def test(q, bus, conn, stream): expect_and_handle_set_vcard(q, stream) event = q.expect('dbus-signal', signal='AliasesChanged', - args=[[(self_handle, u'lala')]]) + args=[{self_handle: u'lala'}]) room_jid = 'chat@conf.localhost' @@ -29,7 +29,7 @@ def test(q, bus, conn, stream): gfc, _, _ = q.expect_many( EventPattern('dbus-signal', signal='GroupFlagsChanged'), - EventPattern('dbus-signal', signal='MembersChangedDetailed', + EventPattern('dbus-signal', signal='MembersChanged', predicate=lambda e: e.args[0] == [] and # added e.args[1] == [] and # removed @@ -47,7 +47,7 @@ def test(q, bus, conn, stream): # Send presence for own membership of room. stream.send(make_muc_presence('none', 'participant', room_jid, 'lala')) - event = q.expect('dbus-signal', signal='MembersChangedDetailed', + event = q.expect('dbus-signal', signal='MembersChanged', predicate=lambda e: len(e.args[0]) == 2 and # added e.args[1] == [] and # removed diff --git a/tests/twisted/muc/test-muc-invitation.py b/tests/twisted/muc/test-muc-invitation.py index 6cc8efc44..15b4abadc 100644 --- a/tests/twisted/muc/test-muc-invitation.py +++ b/tests/twisted/muc/test-muc-invitation.py @@ -21,8 +21,8 @@ def test(q, bus, conn, stream): stream.send(message) - event = q.expect('dbus-signal', signal='NewChannels') - path, props = event.args[0][0] + event = q.expect('dbus-signal', signal='NewChannel') + path, props = event.args assertEquals(cs.CHANNEL_TYPE_TEXT, props[cs.CHANNEL_TYPE]) assertEquals(cs.HT_ROOM, props[cs.TARGET_HANDLE_TYPE]) assertEquals(1, props[cs.TARGET_HANDLE]) @@ -54,15 +54,15 @@ def test(q, bus, conn, stream): # set ourselves to away and back again, to check that we don't send any # presence to the MUC before the invite has been accepted - conn.SimplePresence.SetPresence('away', 'failure') - conn.SimplePresence.SetPresence('available', 'success') + conn.Presence.SetPresence('away', 'failure') + conn.Presence.SetPresence('available', 'success') # accept the invitation call_async(q, text_chan.Group, 'AddMembers', [room_self_handle], 'Oh, OK then') event, event2, _ = q.expect_many( EventPattern('stream-presence', to='chat@conf.localhost/test'), - EventPattern('dbus-signal', signal='MembersChangedDetailed'), + EventPattern('dbus-signal', signal='MembersChanged'), EventPattern('dbus-return', method='AddMembers') ) @@ -90,7 +90,7 @@ def test(q, bus, conn, stream): # Send presence for own membership of room. stream.send(make_muc_presence('owner', 'moderator', 'chat@conf.localhost', 'test')) - event = q.expect('dbus-signal', signal='MembersChangedDetailed') + event = q.expect('dbus-signal', signal='MembersChanged') room_bob_handle = conn.get_contact_handle_sync('chat@conf.localhost/bob') diff --git a/tests/twisted/muc/test-muc-ownership.py b/tests/twisted/muc/test-muc-ownership.py index 9ac2c84cd..24ab72974 100644 --- a/tests/twisted/muc/test-muc-ownership.py +++ b/tests/twisted/muc/test-muc-ownership.py @@ -27,7 +27,7 @@ def test(q, bus, conn, stream): # Initial group flags EventPattern('dbus-signal', signal='GroupFlagsChanged', predicate=lambda e: e.args[0] != 0), - EventPattern('dbus-signal', signal='MembersChangedDetailed', + EventPattern('dbus-signal', signal='MembersChanged', predicate=lambda e: e.args[3] == [2]), # Removing CAN_ADD EventPattern('dbus-signal', signal='GroupFlagsChanged', @@ -60,7 +60,7 @@ def test(q, bus, conn, stream): event = q.expect('dbus-signal', signal='HandleOwnersChanged') owners = event.args[0] - event = q.expect('dbus-signal', signal='MembersChangedDetailed') + event = q.expect('dbus-signal', signal='MembersChanged') added = event.args[0] [test, bob, brian, che, che_owner, chris, chris_owner] = \ diff --git a/tests/twisted/muc/test-muc.py b/tests/twisted/muc/test-muc.py index 8daedb251..9dac163eb 100644 --- a/tests/twisted/muc/test-muc.py +++ b/tests/twisted/muc/test-muc.py @@ -24,14 +24,13 @@ def test(q, bus, conn, stream): # Exercise basic Channel Properties from spec 0.17.7 channel_props = chan.Properties.GetAll(cs.CHANNEL) - assertEquals(cs.HT_ROOM, channel_props.get('TargetHandleType')) + assertEquals(cs.HT_ROOM, channel_props.get('TargetEntityType')) assertEquals(cs.CHANNEL_TYPE_TEXT, channel_props.get('ChannelType')) interfaces = channel_props.get('Interfaces') assertContains(cs.CHANNEL_IFACE_GROUP, interfaces) assertContains(cs.CHANNEL_IFACE_PASSWORD, interfaces) assertContains(cs.CHANNEL_IFACE_CHAT_STATE, interfaces) - assertContains(cs.CHANNEL_IFACE_MESSAGES, interfaces) assert channel_props['TargetID'] == 'chat@conf.localhost', channel_props assert channel_props['Requested'] == True @@ -96,7 +95,7 @@ def test(q, bus, conn, stream): # We ask for delivery reports (which MUCs provide) and read reports (which # MUCs do not provide). - sent_token = chan.Messages.SendMessage(greeting, + sent_token = chan.Text.SendMessage(greeting, cs.MSG_SENDING_FLAGS_REPORT_DELIVERY | cs.MSG_SENDING_FLAGS_REPORT_READ) @@ -207,7 +206,7 @@ def test(q, bus, conn, stream): # test that presence changes are sent via the MUC - conn.SimplePresence.SetPresence('away', 'hurrah') + conn.Presence.SetPresence('away', 'hurrah') event = q.expect('stream-presence', to='chat@conf.localhost/test') elem = event.stanza @@ -231,7 +230,7 @@ def test(q, bus, conn, stream): # test that leaving the channel results in an unavailable message chan.Group.RemoveMembers([chan.Properties.Get(cs.CHANNEL_IFACE_GROUP, - "SelfHandle")], 'booo') + "SelfHandle")], 'booo', cs.GC_REASON_NONE) event = q.expect('stream-presence', to='chat@conf.localhost/test') elem = event.stanza diff --git a/tests/twisted/mucutil.py b/tests/twisted/mucutil.py index 8bb830b9e..36b6571ba 100644 --- a/tests/twisted/mucutil.py +++ b/tests/twisted/mucutil.py @@ -80,13 +80,13 @@ def join_muc(q, bus, conn, stream, muc, request=None, def join_muc_and_check(q, bus, conn, stream, muc, request=None): """ - Like join_muc(), but also checks the NewChannels and NewChannel signals and + Like join_muc(), but also checks the NewChannel signals and the Members property, and returns both members' handles. """ chan, path, props = \ join_muc(q, bus, conn, stream, muc, request=request) - q.expect('dbus-signal', signal='NewChannels', args=[[(path, props)]]) + q.expect('dbus-signal', signal='NewChannel', args=[path, props]) test_handle, bob_handle = conn.get_contact_handles_sync( ['%s/test' % muc, '%s/bob' % muc]) diff --git a/tests/twisted/ns.py b/tests/twisted/ns.py index 30f9a8114..f5f60ab77 100644 --- a/tests/twisted/ns.py +++ b/tests/twisted/ns.py @@ -45,16 +45,6 @@ NS_XMPP_SASL = 'urn:ietf:params:xml:ns:xmpp-sasl' NS_XMPP_BIND = 'urn:ietf:params:xml:ns:xmpp-bind' NS_XMPP_TLS = 'urn:ietf:params:xml:ns:xmpp-tls' NS_XMPP_SESSION = 'urn:ietf:params:xml:ns:xmpp-session' -OLPC_ACTIVITIES = "http://laptop.org/xmpp/activities" -OLPC_ACTIVITIES_NOTIFY = "%s+notify" % OLPC_ACTIVITIES -OLPC_ACTIVITY = "http://laptop.org/xmpp/activity" -OLPC_ACTIVITY_PROPS = "http://laptop.org/xmpp/activity-properties" -OLPC_ACTIVITY_PROPS_NOTIFY = "%s+notify" % OLPC_ACTIVITY_PROPS -OLPC_BUDDY = "http://laptop.org/xmpp/buddy" -OLPC_BUDDY_PROPS = "http://laptop.org/xmpp/buddy-properties" -OLPC_BUDDY_PROPS_NOTIFY = "%s+notify" % OLPC_BUDDY_PROPS -OLPC_CURRENT_ACTIVITY = "http://laptop.org/xmpp/current-activity" -OLPC_CURRENT_ACTIVITY_NOTIFY = "%s+notify" % OLPC_CURRENT_ACTIVITY PUBSUB = "http://jabber.org/protocol/pubsub" PUBSUB_EVENT = "%s#event" % PUBSUB RECEIPTS = "urn:xmpp:receipts" diff --git a/tests/twisted/olpc/change-notifications.py b/tests/twisted/olpc/change-notifications.py deleted file mode 100644 index 3b637dffa..000000000 --- a/tests/twisted/olpc/change-notifications.py +++ /dev/null @@ -1,32 +0,0 @@ -""" -test OLPC Buddy properties change notifications -""" -# FIXME: merge this file to other tests ? - -from servicetest import EventPattern -from gabbletest import exec_test, acknowledge_iq -import constants as cs -from util import send_buddy_changed_properties_msg -import ns - -def test(q, bus, conn, stream): - iq_event, disco_event = q.expect_many( - EventPattern('stream-iq', to=None, query_ns='vcard-temp', - query_name='vCard'), - EventPattern('stream-iq', to='localhost', query_ns=ns.DISCO_ITEMS)) - - acknowledge_iq(stream, iq_event.stanza) - - handles = {} - - handles['alice'] = conn.get_contact_handle_sync('alice@localhost') - - # Alice, one our friends changed her properties - send_buddy_changed_properties_msg(stream, 'alice@localhost', - {'color': ('str', '#005FE4,#00A0FF')}) - - event = q.expect('dbus-signal', signal='PropertiesChanged', - args=[handles['alice'], {'color' : '#005FE4,#00A0FF'}]) - -if __name__ == '__main__': - exec_test(test) diff --git a/tests/twisted/olpc/current-activity.py b/tests/twisted/olpc/current-activity.py deleted file mode 100644 index 382110217..000000000 --- a/tests/twisted/olpc/current-activity.py +++ /dev/null @@ -1,65 +0,0 @@ -""" -test OLPC Buddy properties current activity -""" - -import dbus - -from servicetest import call_async, EventPattern -from gabbletest import exec_test, acknowledge_iq -import constants as cs -from util import (send_buddy_changed_current_act_msg, - answer_to_current_act_pubsub_request, answer_error_to_pubsub_request) -import ns - -def test(q, bus, conn, stream): - iq_event, disco_event = q.expect_many( - EventPattern('stream-iq', to=None, query_ns='vcard-temp', - query_name='vCard'), - EventPattern('stream-iq', to='localhost', query_ns=ns.DISCO_ITEMS)) - - acknowledge_iq(stream, iq_event.stanza) - - buddy_info_iface = dbus.Interface(conn, 'org.laptop.Telepathy.BuddyInfo') - - handles = {} - - # Alice is one of our friend so we receive her PEP notifications - handles['alice'] = conn.get_contact_handle_sync('alice@localhost') - - # Try to get Alice's currrent-activity - call_async(q, buddy_info_iface, "GetCurrentActivity", handles['alice']) - - # Alice's current-activity is not in the cache so Gabble sends a PEP query - event = q.expect('stream-iq', iq_type='get', query_name='pubsub') - answer_to_current_act_pubsub_request(stream, event.stanza, 'activity1', - 'room1@conference.localhost') - - event = q.expect('dbus-return', method='GetCurrentActivity') - id, handles['room1'] = event.value - assert id == 'activity1' - assert conn.InspectHandles(2, [handles['room1']]) == \ - ['room1@conference.localhost'] - - # Retry to get Alice's current-activity - # Alice's current-activity is now in the cache so Gabble doesn't - # send PEP query - assert buddy_info_iface.GetCurrentActivity(handles['alice']) == \ - ('activity1', handles['room1']) - - # Alice changed her current-activity - send_buddy_changed_current_act_msg(stream, 'alice@localhost', 'activity2', - 'room2@conference.localhost') - - event = q.expect('dbus-signal', signal='CurrentActivityChanged') - contact, id, handles['room2'] = event.args - assert contact == handles['alice'] - assert id == 'activity2' - assert conn.InspectHandles(2, [handles['room2']]) == \ - ['room2@conference.localhost'] - - # Get Alice's current-activity as the cache have to be updated - assert buddy_info_iface.GetCurrentActivity(handles['alice']) == \ - ('activity2', handles['room2']) - -if __name__ == '__main__': - exec_test(test) diff --git a/tests/twisted/olpc/olpc-muc-invitation.py b/tests/twisted/olpc/olpc-muc-invitation.py deleted file mode 100644 index 8307e2972..000000000 --- a/tests/twisted/olpc/olpc-muc-invitation.py +++ /dev/null @@ -1,234 +0,0 @@ -""" -Test OLPC extensions to MUC invitations. -""" - -import dbus - -from twisted.words.xish import domish, xpath - -from gabbletest import exec_test, make_muc_presence -from servicetest import call_async, EventPattern, wrap_channel -import constants as cs -import ns - -def test(q, bus, conn, stream): - handles = {} - handles['bob'] = conn.get_contact_handle_sync('bob@localhost') - - buddy_iface = dbus.Interface(conn, 'org.laptop.Telepathy.BuddyInfo') - act_prop_iface = dbus.Interface(conn, 'org.laptop.Telepathy.ActivityProperties') - call_async(q, buddy_iface, 'GetActivities', handles['bob']) - - event = q.expect('stream-iq', iq_type='get', to='bob@localhost') - # Bob has no activities - event.stanza['type'] = 'result' - event.stanza['to'] = 'test@localhost' - event.stanza['from'] = 'bob@localhost' - stream.send(event.stanza) - - event = q.expect('dbus-return', method='GetActivities') - # initially, Bob has no activities - assert event.value == ([],) - - # Bob sends an activity properties message - message = domish.Element(('jabber:client', 'message')) - message['from'] = 'bob@localhost' - message['to'] = 'test@localhost' - properties = message.addElement((ns.OLPC_ACTIVITY_PROPS, 'properties')) - properties['room'] = 'chat@conf.localhost' - properties['activity'] = 'foo_id' - property = properties.addElement((None, 'property')) - property['type'] = 'str' - property['name'] = 'color' - property.addContent('#ffff00,#00ffff') - property = properties.addElement((None, 'property')) - property['type'] = 'bool' - property['name'] = 'private' - property.addContent('1') - - stream.send(message) - - event = q.expect('dbus-signal', signal='ActivityPropertiesChanged') - handles['chat'], props = event.args - assert props == {'color': '#ffff00,#00ffff', 'private' : True} - - event = q.expect('dbus-signal', signal='ActivitiesChanged') - assert event.args[0] == handles['bob'] - acts = event.args[1] - assert len(acts) == 1 - assert acts[0] == ('foo_id', handles['chat']) - - props = act_prop_iface.GetProperties(handles['chat']) - assert props == {'color': '#ffff00,#00ffff', 'private' : True} - - # Bobs invites us to the activity - message = domish.Element((None, 'message')) - message['from'] = 'chat@conf.localhost' - message['to'] = 'test@localhost' - x = message.addElement((ns.MUC_USER, 'x')) - invite = x.addElement((None, 'invite')) - invite['from'] = 'bob@localhost' - reason = invite.addElement((None, 'reason')) - reason.addContent('No good reason') - - stream.send(message) - - event = q.expect('dbus-signal', signal='NewChannel') - assert event.args[1] == cs.CHANNEL_TYPE_TEXT - - assert event.args[2] == 2 # handle type - assert event.args[3] == handles['chat'] # handle - - text_chan = wrap_channel(bus.get_object(conn.bus_name, event.args[0]), - 'Text') - group_iface = text_chan.Group - - members = group_iface.GetAllMembers()[0] - local_pending = group_iface.GetAllMembers()[1] - remote_pending = group_iface.GetAllMembers()[2] - - assert len(members) == 1 - assert conn.inspect_contact_sync(members[0]) == 'bob@localhost' - assert len(local_pending) == 1 - # FIXME: the username-part-is-nickname assumption - assert conn.inspect_contact_sync(local_pending[0]) == \ - 'chat@conf.localhost/test' - assert len(remote_pending) == 0 - - handles['chat_self'] = text_chan.Properties.Get(cs.CHANNEL_IFACE_GROUP, - "SelfHandle") - assert handles['chat_self'] == local_pending[0] - - # by now, we should have picked up the extra activity properties - call_async(q, buddy_iface, 'GetActivities', handles['bob']) - - event = q.expect('stream-iq', iq_type='get', to='bob@localhost') - # Bob still has no (public) activities - event.stanza['type'] = 'result' - event.stanza['to'] = 'test@localhost' - event.stanza['from'] = 'bob@localhost' - stream.send(event.stanza) - - event = q.expect('dbus-return', method='GetActivities') - - assert event.value == ([('foo_id', handles['chat'])],) - - # OK, now accept the invitation - call_async(q, group_iface, 'AddMembers', [handles['chat_self']], 'Oh, OK then') - - _, event, _ = q.expect_many( - EventPattern('stream-presence', to='chat@conf.localhost/test'), - EventPattern('dbus-signal', signal='MembersChanged'), - EventPattern('dbus-return', method='AddMembers') - ) - - assert event.args == ['', [], [handles['bob']], [], - [handles['chat_self']], 0, cs.GC_REASON_INVITED] - - # Send presence for own membership of room. - stream.send(make_muc_presence('owner', 'moderator', 'chat@conf.localhost', 'test')) - - event = q.expect('dbus-signal', signal='MembersChanged') - assert event.args == ['', [handles['chat_self']], [], [], [], 0, 0] - - call_async(q, buddy_iface, 'SetActivities', [('foo_id', handles['chat'])]) - - event = q.expect('stream-iq', iq_type='set') - event.stanza['type'] = 'result' - event.stanza['to'] = 'test@localhost' - event.stanza['from'] = 'test@localhost' - stream.send(event.stanza) - - q.expect('dbus-return', method='SetActivities') - call_async(q, act_prop_iface, 'SetProperties', - handles['chat'], {'color': '#ffff00,#00ffff', 'private': True}) - - event = q.expect('dbus-signal', signal='ActivityPropertiesChanged') - chat_handle, props = event.args - assert chat_handle == handles['chat'] - assert props == {'color': '#ffff00,#00ffff', 'private' : True} - - q.expect('dbus-return', method='SetProperties') - # Test sending an invitation - handles['alice'] = conn.get_contact_handle_sync('alice@localhost') - call_async(q, group_iface, 'AddMembers', [handles['alice']], - 'I want to test invitations') - - event = q.expect('stream-message', to='alice@localhost') - message = event.stanza - - properties = xpath.queryForNodes('/message/properties', message) - assert (properties is not None and len(properties) == 1), repr(properties) - assert properties[0].uri == ns.OLPC_ACTIVITY_PROPS - assert properties[0]['room'] == 'chat@conf.localhost' - assert properties[0]['activity'] == 'foo_id' - - property = xpath.queryForNodes('/properties/property', properties[0]) - assert (property is not None and len(property) == 2), repr(property) - seen = set() - for p in property: - seen.add(p['name']) - if p['name'] == 'color': - assert p['type'] == 'str' - assert str(p) == '#ffff00,#00ffff' - elif p['name'] == 'private': - assert p['type'] == 'bool' - assert str(p) == '1' - else: - assert False, 'Unexpected property %s' % p['name'] - assert 'color' in seen, seen - assert 'private' in seen, seen - - event = q.expect('stream-message', to='chat@conf.localhost') - message = event.stanza - - x = xpath.queryForNodes('/message/x', message) - assert (x is not None and len(x) == 1), repr(x) - assert x[0].uri == ns.MUC_USER - - invites = xpath.queryForNodes('/x/invite', x[0]) - assert (invites is not None and len(invites) == 1), repr(invites) - assert invites[0]['to'] == 'alice@localhost' - - reasons = xpath.queryForNodes('/invite/reason', invites[0]) - assert (reasons is not None and len(reasons) == 1), repr(reasons) - assert str(reasons[0]) == 'I want to test invitations' - - call_async(q, act_prop_iface, 'SetProperties', - handles['chat'], {'color': '#f00baa,#f00baa', 'private': True}) - - event, apc_event, _ = q.expect_many( - EventPattern('stream-message', to='alice@localhost'), - EventPattern('dbus-signal', signal='ActivityPropertiesChanged'), - EventPattern('dbus-return', method='SetProperties'), - ) - message = event.stanza - - properties = xpath.queryForNodes('/message/properties', message) - assert (properties is not None and len(properties) == 1), repr(properties) - assert properties[0].uri == ns.OLPC_ACTIVITY_PROPS - assert properties[0]['room'] == 'chat@conf.localhost' - assert properties[0]['activity'] == 'foo_id' - - property = xpath.queryForNodes('/properties/property', properties[0]) - assert (property is not None and len(property) == 2), repr(property) - seen = set() - for p in property: - seen.add(p['name']) - if p['name'] == 'color': - assert p['type'] == 'str' - assert str(p) == '#f00baa,#f00baa' - elif p['name'] == 'private': - assert p['type'] == 'bool' - assert str(p) == '1' - else: - assert False, 'Unexpected property %s' % p['name'] - assert 'color' in seen, seen - assert 'private' in seen, seen - - chat_handle, props = apc_event.args - assert chat_handle == handles['chat'] - assert props == {'color': '#f00baa,#f00baa', 'private' : True} - -if __name__ == '__main__': - exec_test(test) diff --git a/tests/twisted/olpc/olpc-muc-prop-change.py b/tests/twisted/olpc/olpc-muc-prop-change.py deleted file mode 100644 index d18788ccd..000000000 --- a/tests/twisted/olpc/olpc-muc-prop-change.py +++ /dev/null @@ -1,403 +0,0 @@ -""" -Test OLPC MUC properties. -""" - -import dbus - -from twisted.words.xish import domish, xpath - -from gabbletest import exec_test, acknowledge_iq, make_muc_presence -from servicetest import call_async, EventPattern, wrap_channel -import constants as cs -import ns - -from mucutil import echo_muc_presence - -def test(q, bus, conn, stream): - iq_event = q.expect('stream-iq', to=None, query_ns='vcard-temp', - query_name='vCard') - - acknowledge_iq(stream, iq_event.stanza) - - buddy_iface = dbus.Interface(conn, 'org.laptop.Telepathy.BuddyInfo') - act_prop_iface = dbus.Interface(conn, 'org.laptop.Telepathy.ActivityProperties') - bob_handle = conn.get_contact_handle_sync('bob@localhost') - - # Bob invites us to a chatroom, pre-seeding properties - message = domish.Element(('jabber:client', 'message')) - message['from'] = 'bob@localhost' - message['to'] = 'test@localhost' - properties = message.addElement( - (ns.OLPC_ACTIVITY_PROPS, 'properties')) - properties['room'] = 'chat@conf.localhost' - properties['activity'] = 'foo_id' - property = properties.addElement((None, 'property')) - property['type'] = 'str' - property['name'] = 'title' - property.addContent('From the invitation') - property = properties.addElement((None, 'property')) - property['type'] = 'bool' - property['name'] = 'private' - property.addContent('1') - - stream.send(message) - - message = domish.Element((None, 'message')) - message['from'] = 'chat@conf.localhost' - message['to'] = 'test@localhost' - x = message.addElement((ns.MUC_USER, 'x')) - invite = x.addElement((None, 'invite')) - invite['from'] = 'bob@localhost' - reason = invite.addElement((None, 'reason')) - reason.addContent('No good reason') - - stream.send(message) - - event = q.expect('dbus-signal', signal='NewChannel') - - assert event.args[1] == cs.CHANNEL_TYPE_TEXT - - assert event.args[2] == 2 # handle type - assert event.args[3] == 1 # handle - room_handle = 1 - - text_chan = wrap_channel(bus.get_object(conn.bus_name, event.args[0]), - 'Text') - group_iface = text_chan.Group - - members = group_iface.GetAllMembers()[0] - local_pending = group_iface.GetAllMembers()[1] - remote_pending = group_iface.GetAllMembers()[2] - - assert len(members) == 1 - assert conn.inspect_contact_sync(members[0]) == 'bob@localhost' - bob_handle = members[0] - assert len(local_pending) == 1 - # FIXME: the username-part-is-nickname assumption - assert conn.inspect_contact_sync(local_pending[0]) == \ - 'chat@conf.localhost/test' - assert len(remote_pending) == 0 - - room_self_handle = text_chan.Properties.Get(cs.CHANNEL_IFACE_GROUP, - "SelfHandle") - assert room_self_handle == local_pending[0] - - # by now, we should have picked up the extra activity properties - buddy_iface = dbus.Interface(conn, 'org.laptop.Telepathy.BuddyInfo') - call_async(q, buddy_iface, 'GetActivities', bob_handle) - - event = q.expect('stream-iq', iq_type='get', to='bob@localhost') - # Bob still has no (public) activities - event.stanza['type'] = 'result' - event.stanza['to'] = 'test@localhost' - event.stanza['from'] = 'bob@localhost' - stream.send(event.stanza) - - event = q.expect('dbus-return', method='GetActivities') - - assert event.value == ([('foo_id', room_handle)],) - - props = act_prop_iface.GetProperties(room_handle) - assert len(props) == 2 - assert props['title'] == 'From the invitation' - assert props['private'] == True - - # Now Bob changes the properties - message = domish.Element(('jabber:client', 'message')) - message['from'] = 'bob@localhost' - message['to'] = 'test@localhost' - properties = message.addElement( - (ns.OLPC_ACTIVITY_PROPS, 'properties')) - properties['room'] = 'chat@conf.localhost' - properties['activity'] = 'foo_id' - property = properties.addElement((None, 'property')) - property['type'] = 'str' - property['name'] = 'title' - property.addContent('Mushroom, mushroom') - property = properties.addElement((None, 'property')) - property['type'] = 'bool' - property['name'] = 'private' - property.addContent('0') - - stream.send(message) - - event = q.expect('dbus-signal', signal='ActivityPropertiesChanged') - - assert event.args == [room_handle, {'title': 'Mushroom, mushroom', - 'private': False }] - assert act_prop_iface.GetProperties(room_handle) == \ - event.args[1] - - # OK, now accept the invitation - call_async(q, group_iface, 'AddMembers', [room_self_handle], 'Oh, OK then') - - q.expect_many( - EventPattern('stream-presence', to='chat@conf.localhost/test'), - EventPattern('dbus-signal', signal='MembersChanged', - args=['', [], [bob_handle], [], [room_self_handle], - 0, cs.GC_REASON_INVITED]), - EventPattern('dbus-return', method='AddMembers'), - ) - - # Send presence for own membership of room. - stream.send(make_muc_presence('owner', 'moderator', 'chat@conf.localhost', 'test')) - - event = q.expect('dbus-signal', signal='MembersChanged') - assert event.args == ['', [room_self_handle], [], [], [], 0, 0] - - call_async(q, buddy_iface, 'SetActivities', [('foo_id', room_handle)]) - - event = q.expect('stream-iq', iq_type='set') - # Now that it's not private, it'll go in my PEP - event.stanza['type'] = 'result' - event.stanza['to'] = 'test@localhost' - event.stanza['from'] = 'test@localhost' - stream.send(event.stanza) - - q.expect('dbus-return', method='SetActivities') - - # Bob changes the properties and tells the room he's done so - message = domish.Element(('jabber:client', 'message')) - message['from'] = 'chat@conf.localhost/bob' - message['to'] = 'chat@conf.localhost' - properties = message.addElement( - (ns.OLPC_ACTIVITY_PROPS, 'properties')) - properties['activity'] = 'foo_id' - property = properties.addElement((None, 'property')) - property['type'] = 'str' - property['name'] = 'title' - property.addContent('Badger badger badger') - property = properties.addElement((None, 'property')) - property['type'] = 'bool' - property['name'] = 'private' - property.addContent('0') - - stream.send(message) - - event = q.expect('stream-iq', iq_type='set') - message = event.stanza - - activities = xpath.queryForNodes('/iq/pubsub/publish/item/activities', - message) - assert (activities is not None and len(activities) == 1), repr(activities) - assert activities[0].uri == ns.OLPC_ACTIVITY_PROPS - - properties = xpath.queryForNodes('/activities/properties', activities[0]) - assert (properties is not None and len(properties) == 1), repr(properties) - assert properties[0].uri == ns.OLPC_ACTIVITY_PROPS - assert properties[0]['room'] == 'chat@conf.localhost' - assert properties[0]['activity'] == 'foo_id' - - property = xpath.queryForNodes('/properties/property', properties[0]) - assert (property is not None and len(property) == 2), repr(property) - seen = set() - for p in property: - seen.add(p['name']) - if p['name'] == 'title': - assert p['type'] == 'str' - assert str(p) == 'Badger badger badger' - elif p['name'] == 'private': - assert p['type'] == 'bool' - assert str(p) == '0' - else: - assert False, 'Unexpected property %s' % p['name'] - assert 'title' in seen, seen - assert 'private' in seen, seen - - event.stanza['type'] = 'result' - event.stanza['to'] = 'test@localhost' - event.stanza['from'] = 'test@localhost' - stream.send(event.stanza) - - act_prop_iface = dbus.Interface(conn, 'org.laptop.Telepathy.ActivityProperties') - - # test sets the title and sets private back to True - call_async(q, act_prop_iface, 'SetProperties', - room_handle, {'title': 'I can set the properties too', 'private': True}) - - event = q.expect('stream-message', to='chat@conf.localhost') - message = event.stanza - - properties = xpath.queryForNodes('/message/properties', message) - assert (properties is not None and len(properties) == 1), repr(properties) - assert properties[0].uri == ns.OLPC_ACTIVITY_PROPS - assert properties[0]['room'] == 'chat@conf.localhost' - assert properties[0]['activity'] == 'foo_id' - - property = xpath.queryForNodes('/properties/property', properties[0]) - assert (property is not None and len(property) == 2), repr(property) - seen = set() - for p in property: - seen.add(p['name']) - if p['name'] == 'title': - assert p['type'] == 'str' - assert str(p) == 'I can set the properties too' - elif p['name'] == 'private': - assert p['type'] == 'bool' - assert str(p) == '1' - else: - assert False, 'Unexpected property %s' % p['name'] - assert 'title' in seen, seen - assert 'private' in seen, seen - - - event = q.expect('stream-iq', iq_type='set') - event.stanza['type'] = 'result' - event.stanza['to'] = 'test@localhost' - event.stanza['from'] = 'test@localhost' - stream.send(event.stanza) - - message = event.stanza - - activities = xpath.queryForNodes('/iq/pubsub/publish/item/activities', - message) - assert (activities is not None and len(activities) == 1), repr(activities) - assert activities[0].uri == ns.OLPC_ACTIVITY_PROPS - - properties = xpath.queryForNodes('/activities/properties', activities[0]) - assert properties is None, repr(properties) - - event = q.expect('stream-iq', iq_type='set') - event.stanza['type'] = 'result' - event.stanza['to'] = 'test@localhost' - event.stanza['from'] = 'test@localhost' - stream.send(event.stanza) - - message = event.stanza - - activities = xpath.queryForNodes('/iq/pubsub/publish/item/activities', - message) - assert (activities is not None and len(activities) == 1), repr(activities) - assert activities[0].uri == ns.OLPC_ACTIVITIES - - activity = xpath.queryForNodes('/activities/activity', activities[0]) - assert activity is None, repr(activity) - - q.expect('dbus-return', method='SetProperties') - - # test sets the title and sets private back to True - call_async(q, act_prop_iface, 'SetProperties', - room_handle, {'title': 'I can set the properties too', - 'private': False}) - - event = q.expect('stream-message', to='chat@conf.localhost') - message = event.stanza - - properties = xpath.queryForNodes('/message/properties', message) - assert (properties is not None and len(properties) == 1), repr(properties) - assert properties[0].uri == ns.OLPC_ACTIVITY_PROPS - assert properties[0]['room'] == 'chat@conf.localhost' - assert properties[0]['activity'] == 'foo_id' - - property = xpath.queryForNodes('/properties/property', properties[0]) - assert (property is not None and len(property) == 2), repr(property) - seen = set() - for p in property: - seen.add(p['name']) - if p['name'] == 'title': - assert p['type'] == 'str' - assert str(p) == 'I can set the properties too' - elif p['name'] == 'private': - assert p['type'] == 'bool' - assert str(p) == '0' - else: - assert False, 'Unexpected property %s' % p['name'] - assert 'title' in seen, seen - assert 'private' in seen, seen - - event = q.expect('stream-iq', iq_type='set') - event.stanza['type'] = 'result' - event.stanza['to'] = 'test@localhost' - event.stanza['from'] = 'test@localhost' - stream.send(event.stanza) - - message = event.stanza - - activities = xpath.queryForNodes('/iq/pubsub/publish/item/activities', - message) - assert (activities is not None and len(activities) == 1), repr(activities) - assert activities[0].uri == ns.OLPC_ACTIVITY_PROPS - - properties = xpath.queryForNodes('/activities/properties', activities[0]) - assert (properties is not None and len(properties) == 1), repr(properties) - assert properties[0].uri == ns.OLPC_ACTIVITY_PROPS - assert properties[0]['room'] == 'chat@conf.localhost' - assert properties[0]['activity'] == 'foo_id' - - property = xpath.queryForNodes('/properties/property', properties[0]) - assert (property is not None and len(property) == 2), repr(property) - seen = set() - for p in property: - seen.add(p['name']) - if p['name'] == 'title': - assert p['type'] == 'str' - assert str(p) == 'I can set the properties too' - elif p['name'] == 'private': - assert p['type'] == 'bool' - assert str(p) == '0' - else: - assert False, 'Unexpected property %s' % p['name'] - assert 'title' in seen, seen - assert 'private' in seen, seen - - event = q.expect('stream-iq', iq_type='set') - event.stanza['type'] = 'result' - event.stanza['to'] = 'test@localhost' - event.stanza['from'] = 'test@localhost' - stream.send(event.stanza) - - message = event.stanza - - activities = xpath.queryForNodes('/iq/pubsub/publish/item/activities', - message) - assert (activities is not None and len(activities) == 1), repr(activities) - assert activities[0].uri == ns.OLPC_ACTIVITIES - - activity = xpath.queryForNodes('/activities/activity', activities[0]) - assert (activity is not None and len(activity) == 1), repr(activity) - assert activity[0]['room'] == 'chat@conf.localhost' - assert activity[0]['type'] == 'foo_id' # sic - - q.expect('dbus-return', method='SetProperties') - - text_chan.Close() - - # we must echo the MUC presence so the room will actually close - event = q.expect('stream-presence', to='chat@conf.localhost/test', - presence_type='unavailable') - echo_muc_presence(q, stream, event.stanza, 'none', 'participant') - - event = q.expect('stream-iq', iq_type='set') - event.stanza['type'] = 'result' - event.stanza['to'] = 'test@localhost' - event.stanza['from'] = 'test@localhost' - stream.send(event.stanza) - - message = event.stanza - - activities = xpath.queryForNodes('/iq/pubsub/publish/item/activities', - message) - assert (activities is not None and len(activities) == 1), repr(activities) - assert activities[0].uri == ns.OLPC_ACTIVITIES - - activity = xpath.queryForNodes('/activities/activity', activities[0]) - assert activity is None, repr(activity) - - event = q.expect('stream-iq', iq_type='set') - event.stanza['type'] = 'result' - event.stanza['to'] = 'test@localhost' - event.stanza['from'] = 'test@localhost' - stream.send(event.stanza) - - message = event.stanza - - activities = xpath.queryForNodes('/iq/pubsub/publish/item/activities', - message) - assert (activities is not None and len(activities) == 1), repr(activities) - assert activities[0].uri == ns.OLPC_ACTIVITY_PROPS - - properties = xpath.queryForNodes('/activities/properties', activities[0]) - assert properties is None, repr(properties) - -if __name__ == '__main__': - exec_test(test) diff --git a/tests/twisted/olpc/test-olpc-bundle.py b/tests/twisted/olpc/test-olpc-bundle.py deleted file mode 100644 index 647777757..000000000 --- a/tests/twisted/olpc/test-olpc-bundle.py +++ /dev/null @@ -1,74 +0,0 @@ -"""test OLPC bundle. We shouldn't announce OLPC features until we use the OLPC -interface""" -import dbus - -from servicetest import call_async, EventPattern -from gabbletest import exec_test, acknowledge_iq - -from twisted.words.xish import domish, xpath -import ns -import constants as cs - -olpc_features = set([ns.OLPC_BUDDY_PROPS_NOTIFY, ns.OLPC_ACTIVITIES_NOTIFY, - ns.OLPC_CURRENT_ACTIVITY_NOTIFY, ns.OLPC_ACTIVITY_PROPS_NOTIFY]) - -def test(q, bus, conn, stream): - iq_event = q.expect('stream-iq', to=None, query_ns='vcard-temp', - query_name='vCard') - - acknowledge_iq(stream, iq_event.stanza) - - # send diso request - m = domish.Element((None, 'iq')) - m['from'] = 'alice@jabber.laptop.org' - m['id'] = '1' - m['type'] = 'get' - query = m.addElement('query') - query['xmlns'] = ns.DISCO_INFO - stream.send(m) - - # wait for disco response - event = q.expect('stream-iq', iq_type='result', - query_ns=ns.DISCO_INFO, - to='alice@jabber.laptop.org') - - features = set([str(f['var']) for f in xpath.queryForNodes('/iq/query/feature', - event.stanza)]) - - # OLPC NS aren't announced - assert len(olpc_features.intersection(features)) == 0 - - # Use OLPC interface - buddy_info_iface = dbus.Interface(conn, 'org.laptop.Telepathy.BuddyInfo') - call_async(q, buddy_info_iface, 'SetProperties', - {'color': '#ff0000,#0000ff'}) - - # wait for <presence> stanza - event = q.expect('stream-presence') - c_nodes = xpath.queryForNodes('/presence/c', event.stanza) - assert c_nodes is not None - assert len(c_nodes) == 1 - - # send diso request - m = domish.Element((None, 'iq')) - m['from'] = 'alice@jabber.laptop.org' - m['id'] = '2' - m['type'] = 'get' - query = m.addElement('query') - query['xmlns'] = ns.DISCO_INFO - stream.send(m) - - # wait for disco response - event = q.expect('stream-iq', iq_type='result', - query_ns=ns.DISCO_INFO, - to='alice@jabber.laptop.org') - assert event.stanza['id'] == '2' - - # OLPC NS are now announced - features = set([str(f['var']) for f in xpath.queryForNodes('/iq/query/feature', - event.stanza)]) - - assert olpc_features.issubset(features) - -if __name__ == '__main__': - exec_test(test) diff --git a/tests/twisted/olpc/test-olpc-set-props-preload.py b/tests/twisted/olpc/test-olpc-set-props-preload.py deleted file mode 100644 index 91b8cd3f7..000000000 --- a/tests/twisted/olpc/test-olpc-set-props-preload.py +++ /dev/null @@ -1,54 +0,0 @@ - -""" -Test connecting to a server. -""" - -import dbus -from twisted.words.xish import xpath - -from gabbletest import exec_test -import ns - -def test(q, bus, conn, stream): - buddy_info_iface = dbus.Interface(conn, 'org.laptop.Telepathy.BuddyInfo') - buddy_info_iface.SetProperties({'color': '#ff0000,#0000ff'}) - - conn.Connect() - - # buddy activities - event = q.expect('stream-iq', iq_type='set', query_name='pubsub') - assert xpath.queryForNodes( - "/iq[@type='set']/pubsub[@xmlns='%s']" - "/publish[@node='%s']" % (ns.PUBSUB, ns.OLPC_ACTIVITIES), event.stanza) - - # activity properties - event = q.expect('stream-iq', iq_type='set', query_name='pubsub') - assert xpath.queryForNodes( - "/iq[@type='set']/pubsub[@xmlns='%s']" - "/publish[@node='%s']" % (ns.PUBSUB, ns.OLPC_ACTIVITY_PROPS), - event.stanza) - - # buddy properties - event = q.expect('stream-iq', iq_type='set', query_name='pubsub') - iq = event.stanza - nodes = xpath.queryForNodes( - "/iq[@type='set']/pubsub[@xmlns='%s']" - "/publish[@node='%s']" % (ns.PUBSUB, ns.OLPC_BUDDY_PROPS), iq) - assert nodes - - nodes = xpath.queryForNodes( - "/publish/item" - "/properties[@xmlns='%s']" - "/property" % (ns.OLPC_BUDDY_PROPS), - nodes[0]) - assert len(nodes) == 1 - assert nodes[0]['type'] == 'str' - assert nodes[0]['name'] == 'color' - text = str(nodes[0]) - assert text == '#ff0000,#0000ff', text - - iq['type'] = 'result' - stream.send(iq) - -if __name__ == '__main__': - exec_test(test, do_connect=False) diff --git a/tests/twisted/olpc/util.py b/tests/twisted/olpc/util.py deleted file mode 100644 index 2822a7f20..000000000 --- a/tests/twisted/olpc/util.py +++ /dev/null @@ -1,88 +0,0 @@ -import dbus - -from servicetest import call_async, EventPattern -from gabbletest import make_result_iq, elem, elem_iq -from twisted.words.xish import domish, xpath -from twisted.words.protocols.jabber.client import IQ -import constants as cs -import ns - -def properties_to_xml(properties): - result = [] - - for key, (type, value) in properties.iteritems(): - property = domish.Element((None, 'property')) - property['type'] = type - property['name'] = key - property.addContent(value) - result.append(property) - - return result - -def _make_pubsub_event_msg(from_, node): - # manually create the item node as we need a ref on it - item = domish.Element((None, 'item')) - - message = elem('message', from_=from_, to='test@localhost')( - elem(ns.PUBSUB_EVENT, 'event')( - elem('items', node=node)(item))) - - return message, item - -def send_buddy_changed_properties_msg(stream, from_, props): - message, item = _make_pubsub_event_msg(from_, - ns.OLPC_BUDDY_PROPS) - - properties = item.addElement((ns.OLPC_BUDDY_PROPS, 'properties')) - - for child in properties_to_xml(props): - properties.addChild(child) - - stream.send(message) - -def send_buddy_changed_current_act_msg(stream, from_, id, room): - message, item = _make_pubsub_event_msg(from_, - ns.OLPC_CURRENT_ACTIVITY) - - activity = item.addElement((ns.OLPC_CURRENT_ACTIVITY, 'activity')) - activity['room'] = room - activity['type'] = id - - stream.send(message) - -def answer_to_current_act_pubsub_request(stream, request, id, room): - # check request structure - assert request['type'] == 'get' - items = xpath.queryForNodes( - '/iq/pubsub[@xmlns="%s"]/items' % ns.PUBSUB, request)[0] - assert items['node'] == ns.OLPC_CURRENT_ACTIVITY - - reply = make_result_iq(stream, request) - reply['from'] = request['to'] - pubsub = reply.firstChildElement() - items = pubsub.addElement((None, 'items')) - items['node'] = ns.OLPC_CURRENT_ACTIVITY - item = items.addElement((None, 'item')) - item['id'] = 'itemID' - activity = item.addElement((ns.OLPC_CURRENT_ACTIVITY, 'activity')) - activity['room'] = room - activity['type'] = id - reply.send() - -def answer_error_to_pubsub_request(stream, request): - # look for node's name in the request - items = xpath.queryForNodes('/iq/pubsub/items', request)[0] - node = items['node'] - - reply = IQ(stream, "error") - reply['id'] = request['id'] - reply['from'] = request['to'] - pubsub = reply.addElement((ns.PUBSUB, 'pubsub')) - items = pubsub.addElement((None, 'items')) - items['node'] = node - error = reply.addElement((None, 'error')) - error['type'] = 'auth' - error.addElement((ns.STANZA, 'not-authorized')) - error.addElement(("%s#errors" % ns.PUBSUB, 'presence-subscription-required')) - stream.send(reply) - diff --git a/tests/twisted/plugin-channel-managers.py b/tests/twisted/plugin-channel-managers.py index 03668d733..7ae4a1d58 100644 --- a/tests/twisted/plugin-channel-managers.py +++ b/tests/twisted/plugin-channel-managers.py @@ -14,7 +14,7 @@ if not PLUGINS_ENABLED: raise SystemExit(77) # which makes the test show up as skipped def test(q, bus, conn, stream): - rccs = conn.Properties.Get(cs.CONN_IFACE_REQUESTS, + rccs = conn.Properties.Get(cs.CONN, 'RequestableChannelClasses') # These values are from plugins/test.c diff --git a/tests/twisted/power-save.py b/tests/twisted/power-save.py index 28861d5d5..b127849e5 100644 --- a/tests/twisted/power-save.py +++ b/tests/twisted/power-save.py @@ -117,7 +117,7 @@ def test_local_queueing(q, bus, conn, stream): event = q.expect('dbus-signal', signal='AliasesChanged') # .. and finally the message that flushed the stanza queue - q.expect('dbus-signal', signal='NewChannels') + q.expect('dbus-signal', signal='NewChannel') sync_stream(q, stream) diff --git a/tests/twisted/presence/decloak.py b/tests/twisted/presence/decloak.py deleted file mode 100644 index 541762d20..000000000 --- a/tests/twisted/presence/decloak.py +++ /dev/null @@ -1,71 +0,0 @@ -from twisted.words.xish import domish - -from gabbletest import exec_test, make_presence -from servicetest import EventPattern, assertEquals -import ns -import constants as cs - -def test(q, bus, conn, stream, should_decloak=False): - event = q.expect('stream-iq', query_ns=ns.ROSTER) - - event.stanza['type'] = 'result' - stream.send(event.stanza) - - # First test is to use the CM param's value - worker(q, bus, conn, stream, should_decloak) - - # We can change it at runtime, so flip it to the other value and retry - should_decloak = not should_decloak - conn.Set(cs.CONN_IFACE_GABBLE_DECLOAK, 'DecloakAutomatically', - should_decloak, dbus_interface=cs.PROPERTIES_IFACE) - worker(q, bus, conn, stream, should_decloak) - - # Trivial test for SendDirectedPresence() - bob_handle = conn.get_contact_handle_sync('bob@foo.com') - conn.SendDirectedPresence(bob_handle, False, - dbus_interface=cs.CONN_IFACE_GABBLE_DECLOAK) - q.expect('stream-presence', to='bob@foo.com') - -def worker(q, bus, conn, stream, should_decloak): - decloak_automatically = conn.Get(cs.CONN_IFACE_GABBLE_DECLOAK, - 'DecloakAutomatically', dbus_interface=cs.PROPERTIES_IFACE) - assertEquals(should_decloak, decloak_automatically) - - amy_handle = conn.get_contact_handle_sync('amy@foo.com') - - # Amy directs presence to us - - presence = make_presence('amy@foo.com/panopticon') - decloak = presence.addElement((ns.TEMPPRES, 'temppres')) - decloak['reason'] = 'media' - stream.send(presence) - - events = [ - EventPattern('dbus-signal', signal='PresencesChanged', - args=[{amy_handle: (cs.PRESENCE_AVAILABLE, 'available', '')}]), - EventPattern('dbus-signal', signal='DecloakRequested', - args=[amy_handle, 'media', should_decloak]), - ] - forbidden = [] - - if should_decloak: - events.append(EventPattern('stream-presence', - to='amy@foo.com/panopticon')) - else: - forbidden = [EventPattern('stream-presence')] - - q.forbid_events(forbidden) - q.expect_many(*events) - - presence = make_presence('amy@foo.com/panopticon', type='unavailable') - stream.send(presence) - q.expect('dbus-signal', signal='PresencesChanged', - args=[{amy_handle: (cs.PRESENCE_OFFLINE, 'offline', '')}]) - - q.unforbid_events(forbidden) - -if __name__ == '__main__': - exec_test(test, - params={cs.CONN_IFACE_GABBLE_DECLOAK + '.DecloakAutomatically': False}) - exec_test(lambda q, b, c, s: test(q, b, c, s, should_decloak=True), - params={cs.CONN_IFACE_GABBLE_DECLOAK + '.DecloakAutomatically': True}) diff --git a/tests/twisted/presence/initial-presence.py b/tests/twisted/presence/initial-presence.py index 2164e5938..cef644653 100644 --- a/tests/twisted/presence/initial-presence.py +++ b/tests/twisted/presence/initial-presence.py @@ -13,9 +13,9 @@ from invisible_helper import ValidInvisibleListStream, Xep0186Stream, \ Xep0186AndValidInvisibleListStream def test(q, bus, conn, stream): - props = conn.Properties.GetAll(cs.CONN_IFACE_SIMPLE_PRESENCE) + props = conn.Properties.GetAll(cs.CONN_IFACE_PRESENCE) assertNotEquals({}, props['Statuses']) - conn.SimplePresence.SetPresence("away", "watching bees") + conn.Presence.SetPresence("away", "watching bees") conn.Connect() _, presence = q.expect_many( diff --git a/tests/twisted/presence/invisible_xep_0126.py b/tests/twisted/presence/invisible_xep_0126.py index 7dbfb36b7..b57b3c860 100644 --- a/tests/twisted/presence/invisible_xep_0126.py +++ b/tests/twisted/presence/invisible_xep_0126.py @@ -21,7 +21,7 @@ from invisible_helper import ManualPrivacyListStream from functools import partial def test_create_invisible_list(q, bus, conn, stream): - conn.SimplePresence.SetPresence("away", "") + conn.Presence.SetPresence("away", "") conn.Connect() @@ -47,10 +47,10 @@ def test_create_invisible_list(q, bus, conn, stream): args=[cs.CONN_STATUS_CONNECTED, cs.CSR_REQUESTED]) assertContains("hidden", - conn.Properties.Get(cs.CONN_IFACE_SIMPLE_PRESENCE, "Statuses")) + conn.Properties.Get(cs.CONN_IFACE_PRESENCE, "Statuses")) def test_create_invisible_list_failed(q, bus, conn, stream): - conn.SimplePresence.SetPresence("away", "") + conn.Presence.SetPresence("away", "") conn.Connect() @@ -76,17 +76,17 @@ def test_create_invisible_list_failed(q, bus, conn, stream): args=[cs.CONN_STATUS_CONNECTED, cs.CSR_REQUESTED]) assertDoesNotContain("hidden", - conn.Properties.Get(cs.CONN_IFACE_SIMPLE_PRESENCE, "Statuses")) + conn.Properties.Get(cs.CONN_IFACE_PRESENCE, "Statuses")) def test_invisible_on_connect_fail_no_list(q, bus, conn, stream): - props = conn.Properties.GetAll(cs.CONN_IFACE_SIMPLE_PRESENCE) + props = conn.Properties.GetAll(cs.CONN_IFACE_PRESENCE) assertNotEquals({}, props['Statuses']) presence_event_pattern = EventPattern('stream-presence') q.forbid_events([presence_event_pattern]) - conn.SimplePresence.SetPresence("hidden", "") + conn.Presence.SetPresence("hidden", "") conn.Connect() @@ -103,25 +103,25 @@ def test_invisible_on_connect_fail_no_list(q, bus, conn, stream): # Darn! At least we should have our presence set to DND. q.expect_many( EventPattern('dbus-signal', signal='PresencesChanged', - interface=cs.CONN_IFACE_SIMPLE_PRESENCE, + interface=cs.CONN_IFACE_PRESENCE, args=[{1: (6, 'dnd', '')}]), EventPattern('dbus-signal', signal='StatusChanged', args=[cs.CONN_STATUS_CONNECTED, cs.CSR_REQUESTED])) # 'hidden' should not be an available status. assertDoesNotContain("hidden", - conn.Properties.Get(cs.CONN_IFACE_SIMPLE_PRESENCE, "Statuses")) + conn.Properties.Get(cs.CONN_IFACE_PRESENCE, "Statuses")) def test_invisible_on_connect_fail_invalid_list(q, bus, conn, stream, really_invalid=False): - props = conn.Properties.GetAll(cs.CONN_IFACE_SIMPLE_PRESENCE) + props = conn.Properties.GetAll(cs.CONN_IFACE_PRESENCE) assertNotEquals({}, props['Statuses']) presence_event_pattern = EventPattern('stream-presence') q.forbid_events([presence_event_pattern]) - conn.SimplePresence.SetPresence("hidden", "") + conn.Presence.SetPresence("hidden", "") conn.Connect() @@ -155,24 +155,24 @@ def test_invisible_on_connect_fail_invalid_list(q, bus, conn, stream, q.expect_many( EventPattern('dbus-signal', signal='PresencesChanged', - interface=cs.CONN_IFACE_SIMPLE_PRESENCE, + interface=cs.CONN_IFACE_PRESENCE, args=[{1: (5, 'hidden', '')}]), EventPattern('dbus-signal', signal='StatusChanged', args=[cs.CONN_STATUS_CONNECTED, cs.CSR_REQUESTED])) # 'hidden' should not be an available status. assertContains("hidden", - conn.Properties.Get(cs.CONN_IFACE_SIMPLE_PRESENCE, "Statuses")) + conn.Properties.Get(cs.CONN_IFACE_PRESENCE, "Statuses")) def test_invisible_on_connect_fail(q, bus, conn, stream): - props = conn.Properties.GetAll(cs.CONN_IFACE_SIMPLE_PRESENCE) + props = conn.Properties.GetAll(cs.CONN_IFACE_PRESENCE) assertNotEquals({}, props['Statuses']) presence_event_pattern = EventPattern('stream-presence') q.forbid_events([presence_event_pattern]) - conn.SimplePresence.SetPresence("hidden", "") + conn.Presence.SetPresence("hidden", "") conn.Connect() @@ -194,20 +194,20 @@ def test_invisible_on_connect_fail(q, bus, conn, stream): # Darn! At least we should have our presence set to DND. q.expect_many( EventPattern('dbus-signal', signal='PresencesChanged', - interface=cs.CONN_IFACE_SIMPLE_PRESENCE, + interface=cs.CONN_IFACE_PRESENCE, args=[{1: (6, 'dnd', '')}]), EventPattern('dbus-signal', signal='StatusChanged', args=[cs.CONN_STATUS_CONNECTED, cs.CSR_REQUESTED])) def test_invisible_on_connect(q, bus, conn, stream): - props = conn.Properties.GetAll(cs.CONN_IFACE_SIMPLE_PRESENCE) + props = conn.Properties.GetAll(cs.CONN_IFACE_PRESENCE) assertNotEquals({}, props['Statuses']) presence_event_pattern = EventPattern('stream-presence') q.forbid_events([presence_event_pattern]) - conn.SimplePresence.SetPresence("hidden", "") + conn.Presence.SetPresence("hidden", "") conn.Connect() @@ -244,9 +244,9 @@ def test_invisible(q, bus, conn, stream): args=[cs.CONN_STATUS_CONNECTED, cs.CSR_REQUESTED]) assertContains("hidden", - conn.Properties.Get(cs.CONN_IFACE_SIMPLE_PRESENCE, "Statuses")) + conn.Properties.Get(cs.CONN_IFACE_PRESENCE, "Statuses")) - conn.SimplePresence.SetPresence("hidden", "") + conn.Presence.SetPresence("hidden", "") # §3.5 Become Globally Invisible # <http://xmpp.org/extensions/xep-0126.html#invis-global> @@ -268,10 +268,10 @@ def test_invisible(q, bus, conn, stream): q.expect_many( EventPattern('stream-presence', to=None, presence_type=None), EventPattern('dbus-signal', signal='PresencesChanged', - interface=cs.CONN_IFACE_SIMPLE_PRESENCE, + interface=cs.CONN_IFACE_PRESENCE, args=[{1: (5, 'hidden', '')}])) - conn.SimplePresence.SetPresence("away", "gone") + conn.Presence.SetPresence("away", "gone") # §3.3 Become Globally Visible @@ -293,7 +293,7 @@ def test_invisible(q, bus, conn, stream): q.expect_many( EventPattern('stream-presence', to=None, presence_type=None), EventPattern('dbus-signal', signal='PresencesChanged', - interface=cs.CONN_IFACE_SIMPLE_PRESENCE, + interface=cs.CONN_IFACE_PRESENCE, args=[{1: (3, 'away', 'gone')}])) def test_privacy_list_push_conflict(q, bus, conn, stream): diff --git a/tests/twisted/presence/invisible_xep_0186.py b/tests/twisted/presence/invisible_xep_0186.py index a70de53e7..5b6797104 100644 --- a/tests/twisted/presence/invisible_xep_0186.py +++ b/tests/twisted/presence/invisible_xep_0186.py @@ -12,14 +12,14 @@ import constants as cs from invisible_helper import Xep0186AndValidInvisibleListStream, Xep0186Stream def test_invisible_on_connect(q, bus, conn, stream): - props = conn.Properties.GetAll(cs.CONN_IFACE_SIMPLE_PRESENCE) + props = conn.Properties.GetAll(cs.CONN_IFACE_PRESENCE) assertNotEquals({}, props['Statuses']) presence_event_pattern = EventPattern('stream-presence') q.forbid_events([presence_event_pattern]) - conn.SimplePresence.SetPresence("hidden", "") + conn.Presence.SetPresence("hidden", "") conn.Connect() @@ -32,7 +32,7 @@ def test_invisible_on_connect(q, bus, conn, stream): args=[cs.CONN_STATUS_CONNECTED, cs.CSR_REQUESTED]) def test_invisible_on_connect_fails(q, bus, conn, stream): - conn.SimplePresence.SetPresence("hidden", "") + conn.Presence.SetPresence("hidden", "") conn.Connect() event = q.expect('stream-iq', query_name='invisible') @@ -41,16 +41,16 @@ def test_invisible_on_connect_fails(q, bus, conn, stream): # Darn! At least we should have our presence set to DND. q.expect_many( EventPattern('dbus-signal', signal='PresencesChanged', - interface=cs.CONN_IFACE_SIMPLE_PRESENCE, + interface=cs.CONN_IFACE_PRESENCE, args=[{1: (6, 'dnd', '')}]), EventPattern('dbus-signal', signal='StatusChanged', args=[cs.CONN_STATUS_CONNECTED, cs.CSR_REQUESTED])) def test_invisible(q, bus, conn, stream): assertContains("hidden", - conn.Properties.Get(cs.CONN_IFACE_SIMPLE_PRESENCE, "Statuses")) + conn.Properties.Get(cs.CONN_IFACE_PRESENCE, "Statuses")) - conn.SimplePresence.SetPresence("hidden", "") + conn.Presence.SetPresence("hidden", "") # First we send an <invisible/> command. event = q.expect('stream-iq', query_name='invisible') @@ -58,10 +58,10 @@ def test_invisible(q, bus, conn, stream): # When that's returned successfully, we can signal the change on D-Bus. q.expect('dbus-signal', signal='PresencesChanged', - interface=cs.CONN_IFACE_SIMPLE_PRESENCE, + interface=cs.CONN_IFACE_PRESENCE, args=[{1: (5, 'hidden', '')}]) - conn.SimplePresence.SetPresence("away", "gone") + conn.Presence.SetPresence("away", "gone") # First Gabble sends a <visible/> command. event = q.expect('stream-iq', query_name='visible') @@ -73,14 +73,14 @@ def test_invisible(q, bus, conn, stream): q.expect_many( EventPattern('stream-presence', to=None), EventPattern('dbus-signal', signal='PresencesChanged', - interface=cs.CONN_IFACE_SIMPLE_PRESENCE, + interface=cs.CONN_IFACE_PRESENCE, args=[{1: (3, 'away', 'gone')}])) def test_invisible_fails(q, bus, conn, stream): assertContains("hidden", - conn.Properties.Get(cs.CONN_IFACE_SIMPLE_PRESENCE, "Statuses")) + conn.Properties.Get(cs.CONN_IFACE_PRESENCE, "Statuses")) - conn.SimplePresence.SetPresence("hidden", "") + conn.Presence.SetPresence("hidden", "") # First we send an <invisible/> command. event = q.expect('stream-iq', query_name='invisible') @@ -88,7 +88,7 @@ def test_invisible_fails(q, bus, conn, stream): # When that fails, we should expect our status to change to dnd. q.expect('dbus-signal', signal='PresencesChanged', - interface=cs.CONN_IFACE_SIMPLE_PRESENCE, + interface=cs.CONN_IFACE_PRESENCE, args=[{1: (6, 'dnd', '')}]) diff --git a/tests/twisted/presence/plugins.py b/tests/twisted/presence/plugins.py index 67901142a..59b125b16 100644 --- a/tests/twisted/presence/plugins.py +++ b/tests/twisted/presence/plugins.py @@ -18,7 +18,7 @@ from invisible_helper import Xep0186AndManualPrivacyListStream, \ ManualPrivacyListStream def test(q, bus, conn, stream): - statuses = conn.Properties.Get(cs.CONN_IFACE_SIMPLE_PRESENCE, + statuses = conn.Properties.Get(cs.CONN_IFACE_PRESENCE, 'Statuses') # testbusy and testaway are provided by test plugin @@ -28,7 +28,7 @@ def test(q, bus, conn, stream): assertEquals(statuses['testbusy'][0], cs.PRESENCE_BUSY) assertEquals(statuses['testaway'][0], cs.PRESENCE_AWAY) - conn.SimplePresence.SetPresence('testbusy', '') + conn.Presence.SetPresence('testbusy', '') conn.Connect() @@ -69,11 +69,11 @@ def test(q, bus, conn, stream): args=[cs.CONN_STATUS_CONNECTED, cs.CSR_REQUESTED]) # ... testaway is not supposed to be settable on us - call_async(q, conn.SimplePresence, 'SetPresence', 'testaway', '') + call_async(q, conn.Presence, 'SetPresence', 'testaway', '') q.expect('dbus-error', method='SetPresence', name=cs.INVALID_ARGUMENT) def test_with_xep0186(q, bus, conn, stream): - statuses = conn.Properties.Get(cs.CONN_IFACE_SIMPLE_PRESENCE, + statuses = conn.Properties.Get(cs.CONN_IFACE_PRESENCE, 'Statuses') # testbusy and testaway are provided by test plugin @@ -83,7 +83,7 @@ def test_with_xep0186(q, bus, conn, stream): assertEquals(statuses['testbusy'][0], cs.PRESENCE_BUSY) assertEquals(statuses['testaway'][0], cs.PRESENCE_AWAY) - conn.SimplePresence.SetPresence('testbusy', '') + conn.Presence.SetPresence('testbusy', '') conn.Connect() @@ -105,7 +105,7 @@ def test_with_xep0186(q, bus, conn, stream): args=[cs.CONN_STATUS_CONNECTED, cs.CSR_REQUESTED]) # ... testaway is not supposed to be settable on us - call_async(q, conn.SimplePresence, 'SetPresence', 'testaway', '') + call_async(q, conn.Presence, 'SetPresence', 'testaway', '') q.expect('dbus-error', method='SetPresence', name=cs.INVALID_ARGUMENT) diff --git a/tests/twisted/presence/presence.py b/tests/twisted/presence/presence.py index 8d35e284a..30f8b5b59 100644 --- a/tests/twisted/presence/presence.py +++ b/tests/twisted/presence/presence.py @@ -1,5 +1,5 @@ """ -A simple smoke-test for C.I.SimplePresence +A simple smoke-test for C.I.Presence """ from twisted.words.xish import domish @@ -34,11 +34,11 @@ def test(q, bus, conn, stream): (cs.PRESENCE_AVAILABLE, 'chat', 'I may have been drinking')}]) amy_handle, asv = conn.Contacts.GetContactByID('amy@foo.com', - [cs.CONN_IFACE_SIMPLE_PRESENCE]) + [cs.CONN_IFACE_PRESENCE]) assertEquals(e.args[0][amy_handle], asv.get(cs.ATTR_PRESENCE)) bob_handle, asv = conn.Contacts.GetContactByID('bob@foo.com', - [cs.CONN_IFACE_SIMPLE_PRESENCE]) + [cs.CONN_IFACE_PRESENCE]) assertEquals((cs.PRESENCE_UNKNOWN, 'unknown', ''), asv.get(cs.ATTR_PRESENCE)) diff --git a/tests/twisted/presence/set-idempotence.py b/tests/twisted/presence/set-idempotence.py index 02f519ef3..4148ebc68 100644 --- a/tests/twisted/presence/set-idempotence.py +++ b/tests/twisted/presence/set-idempotence.py @@ -16,14 +16,14 @@ def run_test(q, bus, conn, stream): # Set presence to away. This should cause PresencesChanged to be emitted, # and a new <presence> stanza to be sent to the server. - conn.SimplePresence.SetPresence('away', 'gone') + conn.Presence.SetPresence('away', 'gone') simple_signal, presence = q.expect_many ( EventPattern('dbus-signal', signal='PresencesChanged'), EventPattern('stream-presence')) assert simple_signal.args == [{1L: (3L, u'away', u'gone')}] - assert conn.Contacts.GetContactAttributes([1], [cs.CONN_IFACE_SIMPLE_PRESENCE], False) == { 1L: - { cs.CONN_IFACE_SIMPLE_PRESENCE + "/presence": (3L, u'away', u'gone'), + assert conn.Contacts.GetContactAttributes([1], [cs.CONN_IFACE_PRESENCE]) == { 1L: + { cs.CONN_IFACE_PRESENCE + "/presence": (3L, u'away', u'gone'), cs.ATTR_CONTACT_ID: 'test@localhost'}} @@ -35,15 +35,15 @@ def run_test(q, bus, conn, stream): # Set presence a second time. Since this call is redundant, there should # be no PresencesChanged or <presence> sent to the server. - conn.SimplePresence.SetPresence('away', 'gone') - assert conn.Contacts.GetContactAttributes([1], [cs.CONN_IFACE_SIMPLE_PRESENCE], False) == { 1L: - { cs.CONN_IFACE_SIMPLE_PRESENCE + "/presence": (3L, u'away', u'gone'), + conn.Presence.SetPresence('away', 'gone') + assert conn.Contacts.GetContactAttributes([1], [cs.CONN_IFACE_PRESENCE]) == { 1L: + { cs.CONN_IFACE_PRESENCE + "/presence": (3L, u'away', u'gone'), cs.ATTR_CONTACT_ID: 'test@localhost'}} # Set presence a third time. This call is not redundant, and should # generate a signal/message. - conn.SimplePresence.SetPresence('available', 'yo') + conn.Presence.SetPresence('available', 'yo') simple_signal, presence = q.expect_many ( EventPattern('dbus-signal', signal='PresencesChanged'), @@ -53,21 +53,21 @@ def run_test(q, bus, conn, stream): children = list(presence.stanza.elements()) assert children[0].name == 'status' assert str(children[0]) == 'yo' - assert conn.Contacts.GetContactAttributes([1], [cs.CONN_IFACE_SIMPLE_PRESENCE], False) == { 1L: - { cs.CONN_IFACE_SIMPLE_PRESENCE + "/presence": (2L, u'available', u'yo'), + assert conn.Contacts.GetContactAttributes([1], [cs.CONN_IFACE_PRESENCE]) == { 1L: + { cs.CONN_IFACE_PRESENCE + "/presence": (2L, u'available', u'yo'), cs.ATTR_CONTACT_ID: 'test@localhost'}} # call SetPresence with an empty message, as this used to cause a # crash in tp-glib - conn.SimplePresence.SetPresence('available', '') + conn.Presence.SetPresence('available', '') simple_signal, presence = q.expect_many ( EventPattern('dbus-signal', signal='PresencesChanged'), EventPattern('stream-presence')) assert simple_signal.args == [{1L: (2L, u'available', u'')}] - assert conn.Contacts.GetContactAttributes([1], [cs.CONN_IFACE_SIMPLE_PRESENCE], False) == { 1L: - { cs.CONN_IFACE_SIMPLE_PRESENCE + "/presence": (2L, u'available', u''), + assert conn.Contacts.GetContactAttributes([1], [cs.CONN_IFACE_PRESENCE]) == { 1L: + { cs.CONN_IFACE_PRESENCE + "/presence": (2L, u'available', u''), cs.ATTR_CONTACT_ID: 'test@localhost'}} diff --git a/tests/twisted/presence/shared-status.py b/tests/twisted/presence/shared-status.py index b2e02b8cc..a5783fe84 100644 --- a/tests/twisted/presence/shared-status.py +++ b/tests/twisted/presence/shared-status.py @@ -53,7 +53,7 @@ def _test_remote_status(q, bus, conn, stream, msg, show, list_attrs): def _test_remote_status_away(q, bus, conn, stream, msg, show, list_attrs): events = [EventPattern('dbus-signal', signal='PresencesChanged', - interface=cs.CONN_IFACE_SIMPLE_PRESENCE, + interface=cs.CONN_IFACE_PRESENCE, args=[{1: (presence_types[show], show, msg)}])] q.forbid_events(events) @@ -72,7 +72,7 @@ def _test_remote_status_not_away(q, stream, msg, show, list_attrs): q.expect('stream-iq', iq_type='result') q.expect('dbus-signal', signal='PresencesChanged', - interface=cs.CONN_IFACE_SIMPLE_PRESENCE, + interface=cs.CONN_IFACE_PRESENCE, args=[{1: (presence_types[show], show, msg)}]) def _test_local_status(q, conn, stream, msg, show, expected_show=None): @@ -110,7 +110,7 @@ def _test_local_status(q, conn, stream, msg, show, expected_show=None): if wrong_presence_pattern: q.forbid_events([wrong_presence_pattern]) - conn.SimplePresence.SetPresence(show, msg) + conn.Presence.SetPresence(show, msg) max_status_message_length = int(stream.max_status_message_length) @@ -133,7 +133,7 @@ def _test_local_status(q, conn, stream, msg, show, expected_show=None): q.expect('stream-presence') q.expect('dbus-signal', signal='PresencesChanged', - interface=cs.CONN_IFACE_SIMPLE_PRESENCE, + interface=cs.CONN_IFACE_PRESENCE, args=[{1: (presence_types[expected_show], expected_show, msg[:max_status_message_length])}]) @@ -211,7 +211,7 @@ def test(q, bus, conn, stream): q.expect('stream-iq', iq_type='result') q.expect('dbus-signal', signal='PresencesChanged', - interface=cs.CONN_IFACE_SIMPLE_PRESENCE, + interface=cs.CONN_IFACE_PRESENCE, args=[{1: (cs.PRESENCE_BUSY, 'dnd', "Peekabo")}]) def _test_on_connect(q, bus, conn, stream, shared_status, show, msg, @@ -227,7 +227,7 @@ def _test_on_connect(q, bus, conn, stream, shared_status, show, msg, iq_type='get')] q.forbid_events(forbidden_event_patterns) - conn.SimplePresence.SetPresence(show, msg) + conn.Presence.SetPresence(show, msg) conn.Connect() _, event = q.expect_many(EventPattern('stream-iq', query_ns=ns.GOOGLE_SHARED_STATUS, @@ -246,7 +246,7 @@ def _test_on_connect(q, bus, conn, stream, shared_status, show, msg, q.expect_many( EventPattern('dbus-signal', signal='PresencesChanged', - interface=cs.CONN_IFACE_SIMPLE_PRESENCE, + interface=cs.CONN_IFACE_PRESENCE, args=[{1: (presence_types[expected_show], expected_show, msg)}]), EventPattern('dbus-signal', signal='StatusChanged', @@ -287,7 +287,7 @@ def test_connect_hidden_not_available(q, bus, conn, stream): presence_event_pattern = EventPattern('stream-presence') q.forbid_events([presence_event_pattern]) - conn.SimplePresence.SetPresence(show, msg) + conn.Presence.SetPresence(show, msg) conn.Connect() _, event = q.expect_many(EventPattern('stream-iq', query_ns=ns.GOOGLE_SHARED_STATUS, @@ -304,7 +304,7 @@ def test_connect_hidden_not_available(q, bus, conn, stream): q.expect_many( EventPattern('dbus-signal', signal='PresencesChanged', - interface=cs.CONN_IFACE_SIMPLE_PRESENCE, + interface=cs.CONN_IFACE_PRESENCE, args=[{1: (cs.PRESENCE_BUSY, "dnd", msg)}]), EventPattern('dbus-signal', signal='StatusChanged', args=[cs.CONN_STATUS_CONNECTED, cs.CSR_REQUESTED])) @@ -362,7 +362,7 @@ def test_shared_status_chat(q, bus, conn, stream): EventPattern('stream-presence')) try: - conn.SimplePresence.SetPresence('chat', 'This is not going to work') + conn.Presence.SetPresence('chat', 'This is not going to work') except dbus.DBusException, e: assert e.get_dbus_name() == cs.NOT_AVAILABLE else: diff --git a/tests/twisted/presence_helper.py b/tests/twisted/presence_helper.py index 768963376..7aed6aeb3 100644 --- a/tests/twisted/presence_helper.py +++ b/tests/twisted/presence_helper.py @@ -1,7 +1,7 @@ import constants as cs def get_contacts_presences_sync(conn, contacts): - h2asv = conn.Contacts.GetContactAttributes(contacts, [cs.CONN_IFACE_SIMPLE_PRESENCE], False) + h2asv = conn.Contacts.GetContactAttributes(contacts, [cs.CONN_IFACE_PRESENCE]) presences = {} for h in contacts: presences[h] = h2asv[h][cs.ATTR_PRESENCE] diff --git a/tests/twisted/roster/authorize.py b/tests/twisted/roster/authorize.py index 906950ebd..36137c3f1 100644 --- a/tests/twisted/roster/authorize.py +++ b/tests/twisted/roster/authorize.py @@ -14,7 +14,7 @@ from twisted.words.xish import domish def test(q, bus, conn, stream, remove=False): - call_async(q, conn.ContactList, 'GetContactListAttributes', [], False) + call_async(q, conn.ContactList, 'GetContactListAttributes', []) q.expect('dbus-error', method='GetContactListAttributes', name=cs.NOT_YET) @@ -30,9 +30,9 @@ def test(q, bus, conn, stream, remove=False): ['holly@example.com', 'dave@example.com', 'arnold@example.com', 'kristine@example.com', 'cat@example.com']) - # slight implementation detail: TpBaseContactList emits ContactsChangedWithID + # slight implementation detail: TpBaseContactList emits ContactsChanged # before it announces its channels - s = q.expect('dbus-signal', signal='ContactsChangedWithID', + s = q.expect('dbus-signal', signal='ContactsChanged', interface=cs.CONN_IFACE_CONTACT_LIST, path=conn.object_path) assertEquals([{ holly: (cs.SUBSCRIPTION_STATE_YES, cs.SUBSCRIPTION_STATE_YES, ''), @@ -43,7 +43,7 @@ def test(q, bus, conn, stream, remove=False): q.expect('dbus-signal', signal='ContactListStateChanged', args=[cs.CONTACT_LIST_STATE_SUCCESS]) - call_async(q, conn.ContactList, 'GetContactListAttributes', [], False) + call_async(q, conn.ContactList, 'GetContactListAttributes', []) r = q.expect('dbus-return', method='GetContactListAttributes') assertEquals(({ holly: { @@ -69,7 +69,7 @@ def test(q, bus, conn, stream, remove=False): stream.send(presence) q.expect_many( - EventPattern('dbus-signal', signal='ContactsChangedWithID', + EventPattern('dbus-signal', signal='ContactsChanged', args=[{dave: (cs.SUBSCRIPTION_STATE_NO, cs.SUBSCRIPTION_STATE_ASK, '')}, { dave: 'dave@example.com' }, {}]), @@ -81,7 +81,7 @@ def test(q, bus, conn, stream, remove=False): send_roster_push(stream, 'dave@example.com', 'from') q.expect_many( EventPattern('stream-iq', iq_type='result', iq_id='push'), - EventPattern('dbus-signal', signal='ContactsChangedWithID', + EventPattern('dbus-signal', signal='ContactsChanged', args=[{dave: (cs.SUBSCRIPTION_STATE_NO, cs.SUBSCRIPTION_STATE_YES, '')}, { dave: 'dave@example.com' }, {}]), ) @@ -90,7 +90,7 @@ def test(q, bus, conn, stream, remove=False): presence['from'] = 'kristine@example.com' stream.send(presence) - q.expect('dbus-signal', signal='ContactsChangedWithID', + q.expect('dbus-signal', signal='ContactsChanged', args=[{kristine: (cs.SUBSCRIPTION_STATE_NO, cs.SUBSCRIPTION_STATE_ASK, '')}, { kristine: 'kristine@example.com' }, {}]) @@ -98,7 +98,7 @@ def test(q, bus, conn, stream, remove=False): presence['from'] = 'arnold@example.com' stream.send(presence) - q.expect('dbus-signal', signal='ContactsChangedWithID', + q.expect('dbus-signal', signal='ContactsChanged', args=[{arnold: (cs.SUBSCRIPTION_STATE_NO, cs.SUBSCRIPTION_STATE_ASK, '')}, { arnold: 'arnold@example.com' }, {}]) @@ -116,7 +116,7 @@ def test(q, bus, conn, stream, remove=False): # does not change. send_roster_push(stream, 'kristine@example.com', 'from') q.expect_many( - EventPattern('dbus-signal', signal='ContactsChangedWithID', + EventPattern('dbus-signal', signal='ContactsChanged', args=[{kristine: (cs.SUBSCRIPTION_STATE_NO, cs.SUBSCRIPTION_STATE_YES, '')}, { kristine: 'kristine@example.com' }, {}]), @@ -129,7 +129,7 @@ def test(q, bus, conn, stream, remove=False): stream.send(presence) q.expect_many( - EventPattern('dbus-signal', signal='ContactsChangedWithID', + EventPattern('dbus-signal', signal='ContactsChanged', args=[{arnold: (cs.SUBSCRIPTION_STATE_NO, cs.SUBSCRIPTION_STATE_REMOVED_REMOTELY, '')}, { arnold: 'arnold@example.com' }, {}]), EventPattern('stream-presence', presence_type='unsubscribed', @@ -153,7 +153,7 @@ def test(q, bus, conn, stream, remove=False): # in his removal. q.expect_many( EventPattern('dbus-return', method=returning_method), - EventPattern('dbus-signal', signal='ContactsChangedWithID', + EventPattern('dbus-signal', signal='ContactsChanged', args=[{}, {}, {arnold: 'arnold@example.com' }]), ) @@ -163,7 +163,7 @@ def test(q, bus, conn, stream, remove=False): presence['from'] = 'cat@example.com' stream.send(presence) - q.expect('dbus-signal', signal='ContactsChangedWithID', + q.expect('dbus-signal', signal='ContactsChanged', args=[{cat: (cs.SUBSCRIPTION_STATE_NO, cs.SUBSCRIPTION_STATE_ASK, '')}, { cat: 'cat@example.com' }, {}]) @@ -179,7 +179,7 @@ def test(q, bus, conn, stream, remove=False): # publish request, so Unpublish really results in removal. q.expect_many( EventPattern('dbus-return', method=returning_method), - EventPattern('dbus-signal', signal='ContactsChangedWithID', + EventPattern('dbus-signal', signal='ContactsChanged', args=[{}, {}, { cat: 'cat@example.com' }]), ) @@ -228,7 +228,7 @@ def test(q, bus, conn, stream, remove=False): send_roster_push(stream, 'holly@example.com', 'remove') q.expect_many( EventPattern('stream-iq', iq_type='result', iq_id='push'), - EventPattern('dbus-signal', signal='ContactsChangedWithID', + EventPattern('dbus-signal', signal='ContactsChanged', args=[{}, {}, { holly: 'holly@example.com' }]), ) else: @@ -241,7 +241,7 @@ def test(q, bus, conn, stream, remove=False): send_roster_push(stream, 'holly@example.com', 'to') q.expect_many( EventPattern('stream-iq', iq_type='result', iq_id='push'), - EventPattern('dbus-signal', signal='ContactsChangedWithID', + EventPattern('dbus-signal', signal='ContactsChanged', args=[{holly: (cs.SUBSCRIPTION_STATE_YES, cs.SUBSCRIPTION_STATE_NO, ''), }, { holly: 'holly@example.com' }, {}]), diff --git a/tests/twisted/roster/groups-12791.py b/tests/twisted/roster/groups-12791.py index 0bfaf9401..7962d8d24 100644 --- a/tests/twisted/roster/groups-12791.py +++ b/tests/twisted/roster/groups-12791.py @@ -54,13 +54,13 @@ def test(q, bus, conn, stream): ] q.expect_many( - EventPattern('dbus-signal', signal='ContactsChangedWithID', + EventPattern('dbus-signal', signal='ContactsChanged', predicate=lambda e: contacts_changed_predicate(e, conn, contacts)), EventPattern('dbus-signal', signal='GroupsCreated', predicate=lambda e: groups_created_predicate(e, ['women', 'men', 'affected-by-fdo-12791'])), ) - contacts = conn.ContactList.GetContactListAttributes([cs.CONN_IFACE_CONTACT_GROUPS], False) + contacts = conn.ContactList.GetContactListAttributes([cs.CONN_IFACE_CONTACT_GROUPS]) assertLength(3, contacts) check_contact_roster(conn, 'amy@foo.com', ['women']) diff --git a/tests/twisted/roster/groups.py b/tests/twisted/roster/groups.py index 3225151a6..1fd60a66c 100644 --- a/tests/twisted/roster/groups.py +++ b/tests/twisted/roster/groups.py @@ -116,7 +116,7 @@ def test(q, bus, conn, stream): # check that Amy's state is what we expected attrs = conn.Contacts.GetContactAttributes([amy], - [cs.CONN_IFACE_CONTACT_GROUPS], False)[amy] + [cs.CONN_IFACE_CONTACT_GROUPS])[amy] # make the group list order-independent attrs[cs.CONN_IFACE_CONTACT_GROUPS + '/groups'] = \ set(attrs[cs.CONN_IFACE_CONTACT_GROUPS + '/groups']) @@ -172,7 +172,7 @@ def test(q, bus, conn, stream): assertEquals({ cs.CONN_IFACE_CONTACT_GROUPS + '/groups': ['ladies'], cs.CONN + '/contact-id': 'amy@foo.com' }, conn.Contacts.GetContactAttributes([amy], - [cs.CONN_IFACE_CONTACT_GROUPS], False)[amy]) + [cs.CONN_IFACE_CONTACT_GROUPS])[amy]) # Rename group 'ladies' to 'girls' call_async(q, conn.ContactGroups, 'RenameGroup', 'ladies', 'girls') @@ -202,7 +202,7 @@ def test(q, bus, conn, stream): assertContains('girls', groups) assertDoesNotContain('ladies', groups) - contacts = conn.ContactList.GetContactListAttributes([cs.CONN_IFACE_CONTACT_GROUPS], False) + contacts = conn.ContactList.GetContactListAttributes([cs.CONN_IFACE_CONTACT_GROUPS]) assertEquals(['girls'], contacts[amy][cs.CONN_IFACE_CONTACT_GROUPS + '/groups']) if __name__ == '__main__': diff --git a/tests/twisted/roster/initial-aliases.py b/tests/twisted/roster/initial-aliases.py index 0ad823462..714c29bf4 100644 --- a/tests/twisted/roster/initial-aliases.py +++ b/tests/twisted/roster/initial-aliases.py @@ -2,9 +2,7 @@ Test retrieving the aliases after connection. """ -from servicetest import ( - assertContains, assertLength - ) +from servicetest import assertEquals from gabbletest import ( exec_test, make_result_iq ) @@ -47,9 +45,7 @@ def test(q, bus, conn, stream): bob_handle, alice_handle = conn.get_contact_handles_sync( [bob_jid, alice_jid]) - assertLength(2, added) - assertContains((bob_handle, bob_alias), added) - assertContains((alice_handle, alice_alias), added) + assertEquals({bob_handle: bob_alias, alice_handle: alice_alias}, added) if __name__ == '__main__': exec_test(test, do_connect=False) diff --git a/tests/twisted/roster/push-from-contact.py b/tests/twisted/roster/push-from-contact.py index cf696d95a..1fb369ee9 100644 --- a/tests/twisted/roster/push-from-contact.py +++ b/tests/twisted/roster/push-from-contact.py @@ -25,7 +25,7 @@ def test(q, bus, conn, stream): q.forbid_events( [ - EventPattern('dbus-signal', signal='ContactsChangedWithID'), + EventPattern('dbus-signal', signal='ContactsChanged'), ]) q.expect('stream-iq', iq_type='error') diff --git a/tests/twisted/roster/push-without-id.py b/tests/twisted/roster/push-without-id.py index acbf83232..d99ff2ba9 100644 --- a/tests/twisted/roster/push-without-id.py +++ b/tests/twisted/roster/push-without-id.py @@ -26,7 +26,7 @@ def test(q, bus, conn, stream): h = conn.get_contact_handle_sync(jid) q.expect_many( - EventPattern('dbus-signal', signal='ContactsChangedWithID', + EventPattern('dbus-signal', signal='ContactsChanged', args=[{ h: (cs.SUBSCRIPTION_STATE_YES, cs.SUBSCRIPTION_STATE_YES, ''), }, {h: jid}, {}], ), @@ -44,7 +44,7 @@ def test(q, bus, conn, stream): stream.send(iq) q.forbid_events( - [ EventPattern('dbus-signal', signal='ContactsChangedWithID'), + [ EventPattern('dbus-signal', signal='ContactsChanged'), ]) # Make sure Gabble's got the evil push... sync_stream(q, stream) diff --git a/tests/twisted/roster/removed-from-rp-subscribe.py b/tests/twisted/roster/removed-from-rp-subscribe.py index 86e3113eb..d9b23694b 100644 --- a/tests/twisted/roster/removed-from-rp-subscribe.py +++ b/tests/twisted/roster/removed-from-rp-subscribe.py @@ -44,7 +44,7 @@ def test(q, bus, conn, stream, remove, local): # In response, Gabble should add Marco to stored: q.expect_many( - EventPattern('dbus-signal', signal='ContactsChangedWithID', + EventPattern('dbus-signal', signal='ContactsChanged', args=[{ h: (cs.SUBSCRIPTION_STATE_NO, cs.SUBSCRIPTION_STATE_NO, ''), }, { h :jid }, {}], @@ -64,7 +64,7 @@ def test(q, bus, conn, stream, remove, local): # In response, Gabble should add Marco to subscribe:remote-pending: q.expect_many( - EventPattern('dbus-signal', signal='ContactsChangedWithID', + EventPattern('dbus-signal', signal='ContactsChanged', args=[{ h: (cs.SUBSCRIPTION_STATE_ASK, cs.SUBSCRIPTION_STATE_NO, ''), }, { h:jid }, {}], @@ -103,7 +103,7 @@ def test(q, bus, conn, stream, remove, local): # In response, Gabble should announce that Marco has been removed from # subscribe:remote-pending and stored:members: q.expect_many( - EventPattern('dbus-signal', signal='ContactsChangedWithID', + EventPattern('dbus-signal', signal='ContactsChanged', args=[{}, {}, { h: jid }], ), ) @@ -143,7 +143,7 @@ def test(q, bus, conn, stream, remove, local): # type='unsubscribed'/> ack before doing so: empirical tests reveal # that it's never delivered. q.expect_many( - EventPattern('dbus-signal', signal='ContactsChangedWithID', + EventPattern('dbus-signal', signal='ContactsChanged', args=[{ h: (cs.SUBSCRIPTION_STATE_NO, cs.SUBSCRIPTION_STATE_NO, ''), diff --git a/tests/twisted/roster/test-google-roster.py b/tests/twisted/roster/test-google-roster.py index cff985dc1..08a569e95 100644 --- a/tests/twisted/roster/test-google-roster.py +++ b/tests/twisted/roster/test-google-roster.py @@ -104,7 +104,7 @@ def test_inital_roster(q, bus, conn, stream): 'music-is-math@boards.ca'] q.expect_many( - EventPattern('dbus-signal', signal='ContactsChangedWithID', + EventPattern('dbus-signal', signal='ContactsChanged', predicate=lambda e: contacts_changed_predicate(e, conn, contacts)), EventPattern('dbus-signal', signal='BlockedContactsChanged', predicate=lambda e: blocked_contacts_changed_predicate(e, blocked_contacts, [])), @@ -157,7 +157,7 @@ def test_flickering(q, bus, conn, stream): # Gabble should report this update to the UI. q.expect_many( - EventPattern('dbus-signal', signal='ContactsChangedWithID', + EventPattern('dbus-signal', signal='ContactsChanged', args=[{handle: (cs.SUBSCRIPTION_STATE_ASK, cs.SUBSCRIPTION_STATE_NO, ''), }, {handle: contact}, {}]), @@ -166,7 +166,7 @@ def test_flickering(q, bus, conn, stream): # Gabble shouldn't report any changes to subscribe or stored's members in # response to the next two roster updates. change_events = [ - EventPattern('dbus-signal', signal='ContactsChangedWithID'), + EventPattern('dbus-signal', signal='ContactsChanged'), ] q.forbid_events(change_events) @@ -205,7 +205,7 @@ def test_flickering(q, bus, conn, stream): stream.send(presence) # Gabble should report this update to the UI. - q.expect('dbus-signal', signal='ContactsChangedWithID', + q.expect('dbus-signal', signal='ContactsChanged', args=[{handle: (cs.SUBSCRIPTION_STATE_YES, cs.SUBSCRIPTION_STATE_NO, ''), }, {handle: contact}, {}]) @@ -247,7 +247,7 @@ def test_local_pending(q, bus, conn, stream): presence['type'] = 'subscribe' stream.send(presence) - q.expect('dbus-signal', signal='ContactsChangedWithID', + q.expect('dbus-signal', signal='ContactsChanged', args=[{handle: (cs.SUBSCRIPTION_STATE_NO, cs.SUBSCRIPTION_STATE_ASK, '')}, {handle: contact}, {}]) @@ -264,7 +264,7 @@ def test_local_pending(q, bus, conn, stream): # Now we send the spurious roster update with subscribe="none" and verify # that nothing happens to her publish state in reaction to that - change_event = EventPattern('dbus-signal', signal='ContactsChangedWithID', + change_event = EventPattern('dbus-signal', signal='ContactsChanged', predicate=alice_state_changed) q.forbid_events([change_event]) @@ -283,7 +283,7 @@ def test_local_pending(q, bus, conn, stream): presence['type'] = 'unsubscribe' stream.send(presence) - q.expect('dbus-signal', signal='ContactsChangedWithID', + q.expect('dbus-signal', signal='ContactsChanged', args=[{handle: (cs.SUBSCRIPTION_STATE_NO, cs.SUBSCRIPTION_STATE_REMOVED_REMOTELY, '')}, {handle: contact}, {}]) @@ -342,7 +342,7 @@ def test_deny_simple(q, bus, conn, stream): # As a result they should drop off all three non-deny lists, but not fall # off deny: - q.expect('dbus-signal', signal='ContactsChangedWithID', args=[{}, {}, {handle: contact}]) + q.expect('dbus-signal', signal='ContactsChanged', args=[{}, {}, {handle: contact}]) assertContains(handle, conn.ContactBlocking.RequestBlockedContacts().keys()) @@ -407,7 +407,7 @@ def test_deny_overlap_one(q, bus, conn, stream): "none", False, attrs={'gr:t': 'B'})) # As a result, Gabble makes Bob fall off subscribe and stored. - q.expect('dbus-signal', signal='ContactsChangedWithID', + q.expect('dbus-signal', signal='ContactsChanged', args=[{}, {}, {handle: contact}]) # And he should definitely still be on deny. That rascal. diff --git a/tests/twisted/roster/test-roster-item-deletion.py b/tests/twisted/roster/test-roster-item-deletion.py index 9e008f30d..685f7bb70 100644 --- a/tests/twisted/roster/test-roster-item-deletion.py +++ b/tests/twisted/roster/test-roster-item-deletion.py @@ -28,7 +28,7 @@ def test(q, bus, conn, stream, queued=False): # slight implementation detail: TpBaseContactList emits ContactsChanged # before it announces its channels - q.expect('dbus-signal', signal='ContactsChangedWithID', + q.expect('dbus-signal', signal='ContactsChanged', interface=cs.CONN_IFACE_CONTACT_LIST, path=conn.object_path, args=[{quux_handle: (cs.SUBSCRIPTION_STATE_NO, cs.SUBSCRIPTION_STATE_NO, '')}, {quux_handle: 'quux@foo.com'}, {}]) @@ -62,7 +62,7 @@ def test(q, bus, conn, stream, queued=False): q.expect_many( EventPattern('dbus-signal', interface=cs.CONN_IFACE_CONTACT_LIST, - path=conn.object_path, signal='ContactsChangedWithID', + path=conn.object_path, signal='ContactsChanged', args=[{}, {}, {quux_handle: 'quux@foo.com'}]), EventPattern('stream-iq', iq_id='push', iq_type='result'), ) diff --git a/tests/twisted/roster/test-roster-subscribe.py b/tests/twisted/roster/test-roster-subscribe.py index 43eb2ddff..fbf958074 100644 --- a/tests/twisted/roster/test-roster-subscribe.py +++ b/tests/twisted/roster/test-roster-subscribe.py @@ -82,12 +82,8 @@ def test(q, bus, conn, stream, remove=False, remote='accept'): stream.send(presence) q.expect_many( - EventPattern('dbus-signal', signal='MembersChangedDetailed', - predicate=lambda e: e.args[0] == [] and e.args[1] == [bob] and - e.args[2] == [] and e.args[3] == [] and - e.args[4]['change-reason'] == cs.GC_REASON_PERMISSION_DENIED), #EventPattern('stream-presence'), - EventPattern('dbus-signal', signal='ContactsChangedWithID', + EventPattern('dbus-signal', signal='ContactsChanged', args=[{bob: (cs.SUBSCRIPTION_STATE_REMOVED_REMOTELY, cs.SUBSCRIPTION_STATE_NO, ''), @@ -104,11 +100,8 @@ def test(q, bus, conn, stream, remove=False, remote='accept'): stream.send(presence) q.expect_many( - EventPattern('dbus-signal', signal='MembersChangedDetailed', - predicate=lambda e: e.args[0] == [bob] and e.args[1] == [] and - e.args[2] == [] and e.args[3] == []), EventPattern('stream-presence'), - EventPattern('dbus-signal', signal='ContactsChangedWithID', + EventPattern('dbus-signal', signal='ContactsChanged', args=[{bob: (cs.SUBSCRIPTION_STATE_YES, cs.SUBSCRIPTION_STATE_NO, ''), }, {bob: 'bob@foo.com'}, {}]), @@ -145,12 +138,8 @@ def test(q, bus, conn, stream, remove=False, remote='accept'): stream.send(presence) q.expect_many( - EventPattern('dbus-signal', signal='MembersChangedDetailed', - predicate=lambda e: e.args[0] == [] and e.args[1] == [bob] and - e.args[2] == [] and e.args[3] == [] and - e.args[4]['change-reason'] == cs.GC_REASON_PERMISSION_DENIED), EventPattern('stream-presence'), - EventPattern('dbus-signal', signal='ContactsChangedWithID', + EventPattern('dbus-signal', signal='ContactsChanged', args=[{bob: (cs.SUBSCRIPTION_STATE_REMOVED_REMOTELY, cs.SUBSCRIPTION_STATE_NO, ''), @@ -184,7 +173,7 @@ def test(q, bus, conn, stream, remove=False, remote='accept'): send_roster_push(stream, 'bob@foo.com', 'remove') q.expect_many( EventPattern('stream-iq', iq_type='result', iq_id='push'), - EventPattern('dbus-signal', signal='ContactsChangedWithID', + EventPattern('dbus-signal', signal='ContactsChanged', args=[{}, {}, {bob: 'bob@foo.com'}]), ) else: @@ -197,7 +186,7 @@ def test(q, bus, conn, stream, remove=False, remote='accept'): send_roster_push(stream, 'bob@foo.com', 'none') q.expect_many( EventPattern('stream-iq', iq_type='result', iq_id='push'), - EventPattern('dbus-signal', signal='ContactsChangedWithID', + EventPattern('dbus-signal', signal='ContactsChanged', args=[{bob: (cs.SUBSCRIPTION_STATE_NO, cs.SUBSCRIPTION_STATE_NO, ''), }, {bob: 'bob@foo.com'}, {}]), diff --git a/tests/twisted/roster/test-roster.py b/tests/twisted/roster/test-roster.py index 407eb2bfa..443a368ad 100644 --- a/tests/twisted/roster/test-roster.py +++ b/tests/twisted/roster/test-roster.py @@ -10,7 +10,7 @@ import ns def test(q, bus, conn, stream): - call_async(q, conn.ContactList, 'GetContactListAttributes', [], False) + call_async(q, conn.ContactList, 'GetContactListAttributes', []) q.expect('dbus-error', method='GetContactListAttributes', name=cs.NOT_YET) @@ -45,7 +45,7 @@ def test(q, bus, conn, stream): # slight implementation detail: TpBaseContactList emits ContactsChanged # before it announces its channels - q.expect('dbus-signal', signal='ContactsChangedWithID', + q.expect('dbus-signal', signal='ContactsChanged', interface=cs.CONN_IFACE_CONTACT_LIST, path=conn.object_path, predicate=lambda e: contacts_changed_predicate(e, conn, contacts)) @@ -57,7 +57,7 @@ def test(q, bus, conn, stream): q.expect('dbus-signal', signal='ContactListStateChanged', args=[cs.CONTACT_LIST_STATE_SUCCESS]) - call_async(q, conn.ContactList, 'GetContactListAttributes', [], False) + call_async(q, conn.ContactList, 'GetContactListAttributes', []) r = q.expect('dbus-return', method='GetContactListAttributes') assertEquals(({ amy: { diff --git a/tests/twisted/roster/test-save-alias-to-roster.py b/tests/twisted/roster/test-save-alias-to-roster.py index 0f67da0ae..fddd14e34 100644 --- a/tests/twisted/roster/test-save-alias-to-roster.py +++ b/tests/twisted/roster/test-save-alias-to-roster.py @@ -39,7 +39,7 @@ def expect_AliasesChanged_and_roster_write(q, stream, handle, jid, nick): check_roster_write(stream, roster_write, jid, nick) q.expect('dbus-signal', signal='AliasesChanged', - args=[[(handle, nick if nick else jid)]]) + args=[{handle: nick if nick else jid}]) def test(q, bus, conn, stream): event, event2 = q.expect_many( @@ -82,16 +82,15 @@ def test(q, bus, conn, stream): jid = 'parts@labor.lit' handle = conn.get_contact_handle_sync(jid) q.forbid_events([EventPattern('dbus-signal', signal='AliasesChanged', - args=[[(handle, '')]])]) + args=[{handle: ''}])]) send_roster_push(stream, jid, 'both', name='') # I don't really have very strong opinions on whether Gabble should be # signalling that this contact's alias has *changed* per se, so am not # explicitly expecting that. - q.expect('dbus-signal', signal='MembersChangedDetailed') # But if we ask for it, Gabble should probably send a PEP query. - h2asv = conn.Contacts.GetContactAttributes([handle], [cs.CONN_IFACE_ALIASING], False) + h2asv = conn.Contacts.GetContactAttributes([handle], [cs.CONN_IFACE_ALIASING]) assertEquals(jid, h2asv[handle][cs.ATTR_ALIAS]) event = q.expect('stream-iq', iq_type='get', query_ns=ns.PUBSUB, to=jid) nick = 'Constant Future' @@ -110,7 +109,7 @@ def test(q, bus, conn, stream): EventPattern('stream-iq', query_ns=ns.VCARD_TEMP, to=jid), ]) send_roster_push(stream, jid, 'both', name=jid) - q.expect('dbus-signal', signal='AliasesChanged', args=[[(handle, jid)]]) + q.expect('dbus-signal', signal='AliasesChanged', args=[{handle: jid}]) sync_stream(q, stream) # But if we get a PEP nickname update for this contact, Gabble should use @@ -145,7 +144,7 @@ def test(q, bus, conn, stream): nick = 'Potato' send_roster_push(stream, jid, 'both', name=nick) - q.expect('dbus-signal', signal='AliasesChanged', args=[[(handle, nick)]]) + q.expect('dbus-signal', signal='AliasesChanged', args=[{handle: nick}]) # If the user clears their alias, we should expect Gabble to say over D-Bus # that their nickname is their jid, and send a roster push removing the diff --git a/tests/twisted/rostertest.py b/tests/twisted/rostertest.py index c3fb03c3b..75f549c19 100644 --- a/tests/twisted/rostertest.py +++ b/tests/twisted/rostertest.py @@ -32,7 +32,7 @@ def send_roster_push(stream, jid, subscription, ask_subscribe=False, name=None): def check_contact_roster(conn, contact, groups=None, subscribe=None, publish=None): h = conn.get_contact_handle_sync(contact) attrs = conn.Contacts.GetContactAttributes([h], - [cs.CONN_IFACE_CONTACT_LIST, cs.CONN_IFACE_CONTACT_GROUPS], True)[h] + [cs.CONN_IFACE_CONTACT_LIST, cs.CONN_IFACE_CONTACT_GROUPS])[h] if groups is not None: assertSameSets(groups, attrs[cs.ATTR_GROUPS]) @@ -41,7 +41,7 @@ def check_contact_roster(conn, contact, groups=None, subscribe=None, publish=Non if publish is not None: assertEquals(publish, attrs[cs.ATTR_PUBLISH]) -# function to pass as 'ContactsChangedWithID' dbus-signal even predicate +# function to pass as 'ContactsChanged' dbus-signal even predicate # checking if the (contact-id, subscribe-state, publish-state, message) tuples # from @contacts are the arguments of the signal. def contacts_changed_predicate(e, conn, contacts): diff --git a/tests/twisted/sasl/saslutil.py b/tests/twisted/sasl/saslutil.py index fcbd8f9e5..35a1d6f0e 100644 --- a/tests/twisted/sasl/saslutil.py +++ b/tests/twisted/sasl/saslutil.py @@ -89,14 +89,13 @@ def connect_and_get_sasl_channel(q, bus, conn): return expect_sasl_channel(q, bus, conn) def expect_sasl_channel(q, bus, conn): - new_signal = q.expect('dbus-signal', signal='NewChannels', - predicate=lambda e: e.args[0][0][1].get(cs.CHANNEL_TYPE) == + new_signal = q.expect('dbus-signal', signal='NewChannel', + predicate=lambda e: e.args[1].get(cs.CHANNEL_TYPE) == cs.CHANNEL_TYPE_SERVER_AUTHENTICATION) - path, props = new_signal.args[0][0] + path, props = new_signal.args chan = SaslChannelWrapper(bus.get_object(conn.bus_name, path)) - assertLength(1, new_signal.args[0]) assertEquals(cs.CHANNEL_IFACE_SASL_AUTH, props.get(cs.AUTH_METHOD)) return chan, props diff --git a/tests/twisted/search/search_helper.py b/tests/twisted/search/search_helper.py index d492d3980..3f9b201ef 100644 --- a/tests/twisted/search/search_helper.py +++ b/tests/twisted/search/search_helper.py @@ -32,7 +32,7 @@ def _send_server_reply(q, stream, result): stream.send(result) ret = q.expect('dbus-return', method='CreateChannel') - nc_sig = q.expect('dbus-signal', signal='NewChannels') + nc_sig = q.expect('dbus-signal', signal='NewChannel') return (ret, nc_sig) diff --git a/tests/twisted/servicetest.py b/tests/twisted/servicetest.py index 5ff61a468..86212f325 100644 --- a/tests/twisted/servicetest.py +++ b/tests/twisted/servicetest.py @@ -582,8 +582,7 @@ def sync_dbus(bus, q, proxy): # dbus-glib and thence the application, which means that Ping()ing the # application doesn't ensure that it's processed all D-Bus messages prior # to our ping. - call_async(q, dbus.Interface(proxy, 'org.freedesktop.Telepathy.Tests'), - 'DummySyncDBus') + call_async(q, dbus.Interface(proxy, cs.TESTS), 'DummySyncDBus') q.expect('dbus-error', method='DummySyncDBus') class ProxyWrapper: @@ -611,7 +610,7 @@ class ConnWrapper(ProxyWrapper): return self.inspect_contacts_sync([handle])[0] def inspect_contacts_sync(self, handles): - h2asv = self.Contacts.GetContactAttributes(handles, [], True) + h2asv = self.Contacts.GetContactAttributes(handles, []) ret = [] for h in handles: ret.append(h2asv[h][cs.ATTR_CONTACT_ID]) @@ -625,14 +624,16 @@ class ConnWrapper(ProxyWrapper): def wrap_connection(conn): return ConnWrapper(conn, tp_name_prefix + '.Connection', - dict([ - (name, tp_name_prefix + '.Connection.Interface.' + name) - for name in ['Aliasing', 'Avatars', 'Capabilities', 'Contacts', - 'SimplePresence', 'Requests']] + + dict( [('Peer', 'org.freedesktop.DBus.Peer'), + ('Contacts', cs.CONN), # backwards compat with Telepathy 0 + ('Aliasing', cs.CONN_IFACE_ALIASING), + ('Avatars', cs.CONN_IFACE_AVATARS), ('ContactCapabilities', cs.CONN_IFACE_CONTACT_CAPS), ('ContactInfo', cs.CONN_IFACE_CONTACT_INFO), ('Location', cs.CONN_IFACE_LOCATION), + ('Presence', cs.CONN_IFACE_PRESENCE), + ('Requests', cs.CONN_IFACE_REQUESTS), ('MailNotification', cs.CONN_IFACE_MAIL_NOTIFICATION), ('ContactList', cs.CONN_IFACE_CONTACT_LIST), ('ContactGroups', cs.CONN_IFACE_CONTACT_GROUPS), @@ -651,7 +652,7 @@ class ChannelWrapper(ProxyWrapper): { 'content-type': 'text/plain', 'content': txt }] - self.Messages.SendMessage(message, 0) + self.Text.SendMessage(message, 0) def wrap_channel(chan, type_, extra=None): interfaces = { @@ -659,7 +660,6 @@ def wrap_channel(chan, type_, extra=None): 'Channel': cs.CHANNEL, 'Group': cs.CHANNEL_IFACE_GROUP, 'Hold': cs.CHANNEL_IFACE_HOLD, - 'Messages': cs.CHANNEL_IFACE_MESSAGES, 'RoomConfig1': cs.CHANNEL_IFACE_ROOM_CONFIG, 'ChatState': cs.CHANNEL_IFACE_CHAT_STATE, 'Destroyable': cs.CHANNEL_IFACE_DESTROYABLE, diff --git a/tests/twisted/test-debug.py b/tests/twisted/test-debug.py index 6c079a32c..7ea1bb082 100644 --- a/tests/twisted/test-debug.py +++ b/tests/twisted/test-debug.py @@ -50,7 +50,7 @@ def test(q, bus, conn, stream): cs.TARGET_HANDLE_TYPE: cs.HT_CONTACT, cs.TARGET_HANDLE: conn.Properties.Get(cs.CONN, "SelfHandle") }) - q.expect('dbus-signal', signal='NewChannels') + q.expect('dbus-signal', signal='NewChannel') assertEquals (snapshot, messages) diff --git a/tests/twisted/test-fallback-socks5-proxy.py b/tests/twisted/test-fallback-socks5-proxy.py index 275352d43..e40ae1b17 100644 --- a/tests/twisted/test-fallback-socks5-proxy.py +++ b/tests/twisted/test-fallback-socks5-proxy.py @@ -127,20 +127,20 @@ def accept_stream_tube(q, bus, conn, stream): elem(ns.TUBES, 'tube', type='stream', service='http', id='10')) stream.send(message) - # we are interested in the 'NewChannels' announcing the tube channel + # we are interested in the 'NewChannel' announcing the tube channel def new_chan_predicate(e): - path, props = e.args[0][0] + path, props = e.args return props[cs.CHANNEL_TYPE] == cs.CHANNEL_TYPE_STREAM_TUBE # Proxy queries are send when receiving an incoming stream tube new_chan, e1, e2 = q.expect_many( - EventPattern('dbus-signal', signal='NewChannels', predicate=new_chan_predicate), + EventPattern('dbus-signal', signal='NewChannel', predicate=new_chan_predicate), proxy_query_events[0], proxy_query_events[1]) send_socks5_reply(stream, e1.stanza) send_socks5_reply(stream, e2.stanza) - path, props = new_chan.args[0][0] + path, props = new_chan.args assert props[cs.CHANNEL_TYPE] == cs.CHANNEL_TYPE_STREAM_TUBE tube_chan = bus.get_object(conn.bus_name, path) diff --git a/tests/twisted/test-location.py b/tests/twisted/test-location.py index 2a29700ab..0f1f29cbc 100644 --- a/tests/twisted/test-location.py +++ b/tests/twisted/test-location.py @@ -18,7 +18,7 @@ import ns Rich_Presence_Access_Control_Type_Publish_List = 1 def get_location(conn, contact): - h2asv = conn.Contacts.GetContactAttributes([contact], [cs.CONN_IFACE_LOCATION], False) + h2asv = conn.Contacts.GetContactAttributes([contact], [cs.CONN_IFACE_LOCATION]) return h2asv[contact].get(cs.ATTR_LOCATION) def test(q, bus, conn, stream): @@ -28,13 +28,8 @@ def test(q, bus, conn, stream): conn.Connect() - # discard activities request and status change - q.expect_many( - EventPattern('stream-iq', iq_type='set', - query_ns=ns.PUBSUB), - EventPattern('dbus-signal', signal='StatusChanged', - args=[cs.CONN_STATUS_CONNECTED, cs.CSR_REQUESTED]), - ) + q.expect('dbus-signal', signal='StatusChanged', + args=[cs.CONN_STATUS_CONNECTED, cs.CSR_REQUESTED]) # we now know we have PEP assertEquals(cs.LOCATION_FEATURE_CAN_SET, conn.Get(cs.CONN_IFACE_LOCATION, @@ -218,7 +213,7 @@ def test(q, bus, conn, stream): # check that Contacts interface supports location attributes = conn.Contacts.GetContactAttributes( - [bob_handle, charles_handle], [cs.CONN_IFACE_LOCATION], False) + [bob_handle, charles_handle], [cs.CONN_IFACE_LOCATION]) assertLength(2, attributes) assertContains(bob_handle, attributes) assertContains(charles_handle, attributes) diff --git a/tests/twisted/text/destroy.py b/tests/twisted/text/destroy.py index 0504d1d32..64cca39d1 100644 --- a/tests/twisted/text/destroy.py +++ b/tests/twisted/text/destroy.py @@ -24,18 +24,15 @@ def test(q, bus, conn, stream): ret, new_sig = q.expect_many( EventPattern('dbus-return', method='CreateChannel'), - EventPattern('dbus-signal', signal='NewChannels'), + EventPattern('dbus-signal', signal='NewChannel'), ) text_chan = wrap_channel(bus.get_object(conn.bus_name, ret.value[0]), 'Text') chan_iface = dbus.Interface(text_chan, cs.CHANNEL) destroyable_iface = dbus.Interface(text_chan, cs.CHANNEL_IFACE_DESTROYABLE) - assert len(new_sig.args) == 1 - assert len(new_sig.args[0]) == 1 # one channel - assert len(new_sig.args[0][0]) == 2 # two struct members - assert new_sig.args[0][0][0] == ret.value[0] - emitted_props = new_sig.args[0][0][1] + assert new_sig.args[0] == ret.value[0] + emitted_props = new_sig.args[1] assert emitted_props[cs.CHANNEL_TYPE] == cs.CHANNEL_TYPE_TEXT assert emitted_props[cs.TARGET_HANDLE_TYPE] == cs.HT_CONTACT assert emitted_props[cs.TARGET_HANDLE] == foo_handle @@ -77,7 +74,7 @@ def test(q, bus, conn, stream): assertEquals(foo_handle, msg[0]['message-sender']) assertEquals('hello', msg[1]['content']) - messages = text_chan.Properties.Get(cs.CHANNEL_IFACE_MESSAGES, 'PendingMessages') + messages = text_chan.Properties.Get(cs.CHANNEL_TYPE_TEXT, 'PendingMessages') assertEquals([msg], messages) # destroy the channel without acking the message; it does not come back diff --git a/tests/twisted/text/ensure.py b/tests/twisted/text/ensure.py index fcef90a69..7149940b8 100644 --- a/tests/twisted/text/ensure.py +++ b/tests/twisted/text/ensure.py @@ -5,7 +5,7 @@ Test text channel initiated by me, using Requests.EnsureChannel import dbus from gabbletest import exec_test -from servicetest import call_async, EventPattern +from servicetest import call_async, EventPattern, assertContains import constants as cs def test(q, bus, conn, stream): @@ -17,6 +17,9 @@ def test(q, bus, conn, stream): properties = conn.GetAll( cs.CONN_IFACE_REQUESTS, dbus_interface=cs.PROPERTIES_IFACE) assert properties.get('Channels') == [], properties['Channels'] + + properties = conn.GetAll( + cs.CONN, dbus_interface=cs.PROPERTIES_IFACE) assert ({cs.CHANNEL_TYPE: cs.CHANNEL_TYPE_TEXT, cs.TARGET_HANDLE_TYPE: cs.HT_CONTACT, }, @@ -38,7 +41,7 @@ def test_ensure_ensure(q, conn, self_handle, jid, handle): ret, new_sig = q.expect_many( EventPattern('dbus-return', method='EnsureChannel'), - EventPattern('dbus-signal', signal='NewChannels'), + EventPattern('dbus-signal', signal='NewChannel'), ) assert len(ret.value) == 3 @@ -50,18 +53,13 @@ def test_ensure_ensure(q, conn, self_handle, jid, handle): check_props(emitted_props, self_handle, handle, jid) - assert len(new_sig.args) == 1 - assert len(new_sig.args[0]) == 1 # one channel - assert len(new_sig.args[0][0]) == 2 # two struct members - assert new_sig.args[0][0][0] == path - assert new_sig.args[0][0][1] == emitted_props + assert new_sig.args[0] == path + assert new_sig.args[1] == emitted_props properties = conn.GetAll( cs.CONN_IFACE_REQUESTS, dbus_interface=dbus.PROPERTIES_IFACE) - assert new_sig.args[0][0] in properties['Channels'], \ - (new_sig.args[0][0], properties['Channels']) - + assertContains((new_sig.args[0], new_sig.args[1]), properties['Channels']) # Now try Ensuring a channel which already exists call_async(q, conn.Requests, 'EnsureChannel', request_props(handle)) @@ -87,7 +85,7 @@ def test_request_ensure(q, conn, self_handle, jid, handle): ret, new_sig = q.expect_many( EventPattern('dbus-return', method='CreateChannel'), - EventPattern('dbus-signal', signal='NewChannels'), + EventPattern('dbus-signal', signal='NewChannel'), ) assert len(ret.value) == 2 @@ -95,18 +93,13 @@ def test_request_ensure(q, conn, self_handle, jid, handle): check_props(emitted_props, self_handle, handle, jid) - assert len(new_sig.args) == 1 - assert len(new_sig.args[0]) == 1 # one channel - assert len(new_sig.args[0][0]) == 2 # two struct members - assert new_sig.args[0][0][0] == path - assert new_sig.args[0][0][1] == emitted_props + assert new_sig.args[0] == path + assert new_sig.args[1] == emitted_props properties = conn.GetAll( cs.CONN_IFACE_REQUESTS, dbus_interface=dbus.PROPERTIES_IFACE) - assert new_sig.args[0][0] in properties['Channels'], \ - (new_sig.args[0][0], properties['Channels']) - + assertContains((new_sig.args[0], new_sig.args[1]), properties['Channels']) # Now try Ensuring that same channel. call_async(q, conn.Requests, 'EnsureChannel', request_props(handle)) diff --git a/tests/twisted/text/initiate-requestotron.py b/tests/twisted/text/initiate-requestotron.py index c969eaac1..729486b47 100644 --- a/tests/twisted/text/initiate-requestotron.py +++ b/tests/twisted/text/initiate-requestotron.py @@ -18,6 +18,9 @@ def test(q, bus, conn, stream): properties = conn.GetAll( cs.CONN_IFACE_REQUESTS, dbus_interface=dbus.PROPERTIES_IFACE) assert properties.get('Channels') == [], properties['Channels'] + + properties = conn.GetAll( + cs.CONN, dbus_interface=dbus.PROPERTIES_IFACE) assert ({cs.CHANNEL_TYPE: cs.CHANNEL_TYPE_TEXT, cs.TARGET_HANDLE_TYPE: cs.HT_CONTACT, }, @@ -33,7 +36,7 @@ def test(q, bus, conn, stream): ret, new_sig = q.expect_many( EventPattern('dbus-return', method='CreateChannel'), - EventPattern('dbus-signal', signal='NewChannels'), + EventPattern('dbus-signal', signal='NewChannel'), ) assert len(ret.value) == 2 @@ -50,17 +53,13 @@ def test(q, bus, conn, stream): assertEquals(cs.DELIVERY_REPORTING_SUPPORT_FLAGS_RECEIVE_FAILURES, emitted_props[cs.DELIVERY_REPORTING_SUPPORT]) - assert len(new_sig.args) == 1 - assert len(new_sig.args[0]) == 1 # one channel - assert len(new_sig.args[0][0]) == 2 # two struct members - assert new_sig.args[0][0][0] == ret.value[0] - assert new_sig.args[0][0][1] == ret.value[1] + assert new_sig.args[0] == ret.value[0] + assert new_sig.args[1] == ret.value[1] properties = conn.GetAll( cs.CONN_IFACE_REQUESTS, dbus_interface=dbus.PROPERTIES_IFACE) - assert new_sig.args[0][0] in properties['Channels'], \ - (new_sig.args[0][0], properties['Channels']) + assertContains((new_sig.args[0], new_sig.args[1]), properties['Channels']) if __name__ == '__main__': exec_test(test) diff --git a/tests/twisted/text/initiate.py b/tests/twisted/text/initiate.py index 778dd6a58..be6933067 100644 --- a/tests/twisted/text/initiate.py +++ b/tests/twisted/text/initiate.py @@ -23,12 +23,12 @@ def test(q, bus, conn, stream): ret, sig = q.expect_many( EventPattern('dbus-return', method='CreateChannel'), - EventPattern('dbus-signal', signal='NewChannels'), + EventPattern('dbus-signal', signal='NewChannel'), ) text_chan = wrap_channel(bus.get_object(conn.bus_name, ret.value[0]), 'Text') - path, props = sig.args[0][0] + path, props = sig.args assertEquals(ret.value[0], path) assertEquals(cs.CHANNEL_TYPE_TEXT, props[cs.CHANNEL_TYPE]) # check that handle type == contact handle @@ -40,8 +40,8 @@ def test(q, bus, conn, stream): cs.CHANNEL, dbus_interface=dbus.PROPERTIES_IFACE) assert channel_props.get('TargetHandle') == foo_handle,\ (channel_props.get('TargetHandle'), foo_handle) - assert channel_props.get('TargetHandleType') == 1,\ - channel_props.get('TargetHandleType') + assert channel_props.get('TargetEntityType') == 1,\ + channel_props.get('TargetEntityType') assert channel_props.get('ChannelType') == \ cs.CHANNEL_TYPE_TEXT,\ channel_props.get('ChannelType') diff --git a/tests/twisted/text/receipts.py b/tests/twisted/text/receipts.py index 2c11af2e3..4687a2085 100644 --- a/tests/twisted/text/receipts.py +++ b/tests/twisted/text/receipts.py @@ -48,7 +48,7 @@ def not_sending_request_to_contact(q, bus, conn, stream, chan): { 'content-type': 'text/plain', 'content': 'Mancomb Seepgood?', }] - chan.Messages.SendMessage(message, 0) + chan.Text.SendMessage(message, 0) e = q.expect('stream-message', to=GUYBRUSH) assertLength(0, list(e.stanza.elements(uri=ns.RECEIPTS, name='request'))) @@ -64,7 +64,7 @@ def sending_request_to_presenceless_contact(q, bus, conn, stream, chan): { 'content-type': 'text/plain', 'content': 'Thriftweed?', }] - chan.Messages.SendMessage(message, cs.MSG_SENDING_FLAGS_REPORT_DELIVERY) + chan.Text.SendMessage(message, cs.MSG_SENDING_FLAGS_REPORT_DELIVERY) e = q.expect('stream-message', to=GUYBRUSH) assertLength(1, list(e.stanza.elements(uri=ns.RECEIPTS, name='request'))) @@ -97,7 +97,7 @@ def sending_request_to_cappy_contact(q, bus, conn, stream, chan): { 'content-type': 'text/plain', 'content': 'Ulysses?', }] - chan.Messages.SendMessage(message, cs.MSG_SENDING_FLAGS_REPORT_DELIVERY) + chan.Text.SendMessage(message, cs.MSG_SENDING_FLAGS_REPORT_DELIVERY) e = q.expect('stream-message', to=GUYBRUSH) assertLength(1, list(e.stanza.elements(uri=ns.RECEIPTS, name='request'))) @@ -150,7 +150,7 @@ def replying_to_requests(q, bus, conn, stream): q.unforbid_all() # If we're invisible, LeChuck shouldn't get receipts. - conn.SimplePresence.SetPresence("hidden", "") + conn.Presence.SetPresence("hidden", "") event = q.expect('stream-iq', query_name='invisible') acknowledge_iq(stream, event.stanza) diff --git a/tests/twisted/text/respawn.py b/tests/twisted/text/respawn.py index bb1b75495..8ca081699 100644 --- a/tests/twisted/text/respawn.py +++ b/tests/twisted/text/respawn.py @@ -23,17 +23,14 @@ def test(q, bus, conn, stream): ret, new_sig = q.expect_many( EventPattern('dbus-return', method='CreateChannel'), - EventPattern('dbus-signal', signal='NewChannels'), + EventPattern('dbus-signal', signal='NewChannel'), ) text_chan = wrap_channel(bus.get_object(conn.bus_name, ret.value[0]), 'Text') chan_iface = dbus.Interface(text_chan, cs.CHANNEL) - assert len(new_sig.args) == 1 - assert len(new_sig.args[0]) == 1 # one channel - assert len(new_sig.args[0][0]) == 2 # two struct members - assert new_sig.args[0][0][0] == ret.value[0] - emitted_props = new_sig.args[0][0][1] + assert new_sig.args[0] == ret.value[0] + emitted_props = new_sig.args[1] assert emitted_props[cs.CHANNEL_TYPE] == cs.CHANNEL_TYPE_TEXT assert emitted_props[cs.TARGET_HANDLE_TYPE] == cs.HT_CONTACT assert emitted_props[cs.TARGET_HANDLE] == foo_handle @@ -76,7 +73,7 @@ def test(q, bus, conn, stream): assertEquals(foo_handle, msg[0]['message-sender']) assertEquals('hello', msg[1]['content']) - messages = text_chan.Properties.Get(cs.CHANNEL_IFACE_MESSAGES, 'PendingMessages') + messages = text_chan.Properties.Get(cs.CHANNEL_TYPE_TEXT, 'PendingMessages') assertEquals([msg], messages) # close the channel without acking the message; it comes back @@ -92,8 +89,8 @@ def test(q, bus, conn, stream): assert new.args[0] == text_chan.object_path,\ (new.args[0], text_chan.object_path) - event = q.expect('dbus-signal', signal='NewChannels') - path, props = event.args[0][0] + event = q.expect('dbus-signal', signal='NewChannel') + path, props = event.args assertEquals(text_chan.object_path, path) assertEquals(cs.CHANNEL_TYPE_TEXT, props[cs.CHANNEL_TYPE]) assertEquals(cs.HT_CONTACT, props[cs.TARGET_HANDLE_TYPE]) @@ -115,7 +112,7 @@ def test(q, bus, conn, stream): # the message is still there - messages = text_chan.Properties.Get(cs.CHANNEL_IFACE_MESSAGES, 'PendingMessages') + messages = text_chan.Properties.Get(cs.CHANNEL_TYPE_TEXT, 'PendingMessages') msg[0]['rescued'] = True assertEquals([msg], messages) @@ -123,7 +120,7 @@ def test(q, bus, conn, stream): text_chan.Text.AcknowledgePendingMessages([msg[0]['pending-message-id']]) - messages = text_chan.Properties.Get(cs.CHANNEL_IFACE_MESSAGES, 'PendingMessages') + messages = text_chan.Properties.Get(cs.CHANNEL_TYPE_TEXT, 'PendingMessages') assertEquals([], messages) # close the channel again diff --git a/tests/twisted/text/test-text-delayed.py b/tests/twisted/text/test-text-delayed.py index 605b2c148..480d40271 100644 --- a/tests/twisted/text/test-text-delayed.py +++ b/tests/twisted/text/test-text-delayed.py @@ -23,8 +23,8 @@ def test(q, bus, conn, stream): stream.send(m) - event = q.expect('dbus-signal', signal='NewChannels') - path, props = event.args[0][0] + event = q.expect('dbus-signal', signal='NewChannel') + path, props = event.args assertEquals(cs.CHANNEL_TYPE_TEXT, props[cs.CHANNEL_TYPE]) assertEquals(cs.HT_CONTACT, props[cs.TARGET_HANDLE_TYPE]) jid = conn.inspect_contact_sync(props[cs.TARGET_HANDLE]) diff --git a/tests/twisted/text/test-text-no-body.py b/tests/twisted/text/test-text-no-body.py index 34e54b7bb..ec70b77b4 100644 --- a/tests/twisted/text/test-text-no-body.py +++ b/tests/twisted/text/test-text-no-body.py @@ -28,8 +28,8 @@ def test(q, bus, conn, stream): stream.send(m) # first message should be from Bob, not Alice - event = q.expect('dbus-signal', signal='NewChannels') - path, props = event.args[0][0] + event = q.expect('dbus-signal', signal='NewChannel') + path, props = event.args assertEquals(cs.CHANNEL_TYPE_TEXT, props[cs.CHANNEL_TYPE]) jid = conn.inspect_contact_sync(props[cs.TARGET_HANDLE]) assertEquals('bob@foo.com', jid) diff --git a/tests/twisted/text/test-text.py b/tests/twisted/text/test-text.py index a6c42029f..ba67610b8 100644 --- a/tests/twisted/text/test-text.py +++ b/tests/twisted/text/test-text.py @@ -23,8 +23,8 @@ def test(q, bus, conn, stream): m.addElement('body', content='hello') stream.send(m) - event = q.expect('dbus-signal', signal='NewChannels') - path, props = event.args[0][0] + event = q.expect('dbus-signal', signal='NewChannel') + path, props = event.args text_chan = wrap_channel(bus.get_object(conn.bus_name, path), 'Text') assertEquals(cs.CHANNEL_TYPE_TEXT, props[cs.CHANNEL_TYPE]) assertEquals(cs.HT_CONTACT, props[cs.TARGET_HANDLE_TYPE]) @@ -35,10 +35,9 @@ def test(q, bus, conn, stream): # Exercise basic Channel Properties from spec 0.17.7 channel_props = text_chan.Properties.GetAll(cs.CHANNEL) assertEquals(props[cs.TARGET_HANDLE], channel_props.get('TargetHandle')) - assertEquals(cs.HT_CONTACT, channel_props.get('TargetHandleType')) + assertEquals(cs.HT_CONTACT, channel_props.get('TargetEntityType')) assertEquals(cs.CHANNEL_TYPE_TEXT, channel_props.get('ChannelType')) assertContains(cs.CHANNEL_IFACE_CHAT_STATE, channel_props.get('Interfaces')) - assertContains(cs.CHANNEL_IFACE_MESSAGES, channel_props.get('Interfaces')) assertEquals(jid, channel_props['TargetID']) assertEquals(False, channel_props['Requested']) assertEquals(props[cs.INITIATOR_HANDLE], channel_props['InitiatorHandle']) @@ -86,7 +85,7 @@ def test(q, bus, conn, stream): } ] - sent_token = text_chan.Messages.SendMessage(greeting, dbus.UInt32(0)) + sent_token = text_chan.Text.SendMessage(greeting, dbus.UInt32(0)) stream_message, message_sent = q.expect_many( EventPattern('stream-message'), @@ -113,8 +112,7 @@ def test(q, bus, conn, stream): assert message_sent.args[2] == sent_token - # Send a message using Channel.Type.Text API - text_chan.Text.Send(0, 'goodbye') + text_chan.send_msg_sync('goodbye') stream_message, message_sent = q.expect_many( EventPattern('stream-message'), diff --git a/tests/twisted/tls/server-tls-channel.py b/tests/twisted/tls/server-tls-channel.py index 6528e696d..fb2d2d85d 100644 --- a/tests/twisted/tls/server-tls-channel.py +++ b/tests/twisted/tls/server-tls-channel.py @@ -101,12 +101,7 @@ def test_disconnect_inbetween(q, bus, conn, stream): args=[cs.CONN_STATUS_DISCONNECTED, cs.CSR_REQUESTED]) def is_server_tls_chan_event(event): - channels = event.args[0]; - - if len(channels) > 1: - return False - - path, props = channels[0] + path, props = event.args return props[cs.CHANNEL_TYPE] == cs.CHANNEL_TYPE_SERVER_TLS_CONNECTION def connect_and_get_tls_objects(q, bus, conn, expect_example_jid=True): @@ -116,11 +111,10 @@ def connect_and_get_tls_objects(q, bus, conn, expect_example_jid=True): args=[cs.CONN_STATUS_CONNECTING, cs.CSR_REQUESTED]) ev, = q.expect_many( - EventPattern('dbus-signal', signal='NewChannels', + EventPattern('dbus-signal', signal='NewChannel', predicate=is_server_tls_chan_event)) - channels = ev.args[0] - path, props = channels[0] + path, props = ev.args chan = ServerTlsChanWrapper(bus.get_object(conn.bus_name, path)) hostname = props[cs.TLS_HOSTNAME] diff --git a/tests/twisted/tools/servicedir-uninstalled/gabble.service.in b/tests/twisted/tools/servicedir-uninstalled/gabble.service.in index 6845c5939..f60344246 100644 --- a/tests/twisted/tools/servicedir-uninstalled/gabble.service.in +++ b/tests/twisted/tools/servicedir-uninstalled/gabble.service.in @@ -1,3 +1,3 @@ [D-BUS Service] -Name=org.freedesktop.Telepathy.ConnectionManager.gabble +Name=im.telepathy.v1.ConnectionManager.gabble Exec=@abs_top_builddir@/tests/twisted/tools/exec-with-log.sh diff --git a/tests/twisted/tools/servicedir/gabble.service.in b/tests/twisted/tools/servicedir/gabble.service.in index 75b98ead1..5acadfba2 100644 --- a/tests/twisted/tools/servicedir/gabble.service.in +++ b/tests/twisted/tools/servicedir/gabble.service.in @@ -1,3 +1,3 @@ [D-BUS Service] -Name=org.freedesktop.Telepathy.ConnectionManager.gabble +Name=im.telepathy.v1.ConnectionManager.gabble Exec=@gabbletestsdir@/twisted/tools/run-gabble.sh diff --git a/tests/twisted/tubes/accept-muc-dbus-tube.py b/tests/twisted/tubes/accept-muc-dbus-tube.py index 2606fa254..4cf657ef6 100644 --- a/tests/twisted/tubes/accept-muc-dbus-tube.py +++ b/tests/twisted/tubes/accept-muc-dbus-tube.py @@ -43,13 +43,12 @@ def test(q, bus, conn, stream, access_control): # tube channel is created def new_chan_predicate(e): - path, props = e.args[0][0] + path, props = e.args return props[cs.CHANNEL_TYPE] == cs.CHANNEL_TYPE_DBUS_TUBE - event = q.expect('dbus-signal', signal='NewChannels', + event = q.expect('dbus-signal', signal='NewChannel', predicate=new_chan_predicate) - channels = event.args[0] - path, props = channels[0] + path, props = event.args assertEquals(cs.CHANNEL_TYPE_DBUS_TUBE, props[cs.CHANNEL_TYPE]) assertEquals('chat@conf.localhost/bob', props[cs.INITIATOR_ID]) @@ -64,13 +63,13 @@ def test(q, bus, conn, stream, access_control): cs.SOCKET_ACCESS_CONTROL_LOCALHOST], props[cs.DBUS_TUBE_SUPPORTED_ACCESS_CONTROLS]) - tube_chan = wrap_channel(bus.get_object(conn.bus_name, path), 'DBusTube') + tube_chan = wrap_channel(bus.get_object(conn.bus_name, path), 'DBusTube1') # only Bob is in DBusNames dbus_names = tube_chan.Get(cs.CHANNEL_TYPE_DBUS_TUBE, 'DBusNames', dbus_interface=cs.PROPERTIES_IFACE) assertEquals({bob_handle: bob_bus_name}, dbus_names) - call_async(q, tube_chan.DBusTube, 'Accept', access_control) + call_async(q, tube_chan.DBusTube1, 'Accept', access_control) return_event, names_changed1, names_changed2, presence_event = q.expect_many( EventPattern('dbus-return', method='Accept'), diff --git a/tests/twisted/tubes/accept-muc-stream-tube.py b/tests/twisted/tubes/accept-muc-stream-tube.py index a209ab08e..670aa7fdf 100644 --- a/tests/twisted/tubes/accept-muc-stream-tube.py +++ b/tests/twisted/tubes/accept-muc-stream-tube.py @@ -47,7 +47,7 @@ def test(q, bus, conn, stream, bytestream_cls, cs.TARGET_ID: 'chat@conf.localhost'}) q.expect_many( - EventPattern('dbus-signal', signal='MembersChangedDetailed', + EventPattern('dbus-signal', signal='MembersChanged', predicate=lambda e: e.args[0] == [] and # added e.args[1] == [] and # removed @@ -64,7 +64,7 @@ def test(q, bus, conn, stream, bytestream_cls, # Send presence for own membership of room. stream.send(make_muc_presence('none', 'participant', 'chat@conf.localhost', 'test')) - event = q.expect('dbus-signal', signal='MembersChangedDetailed', + event = q.expect('dbus-signal', signal='MembersChanged', predicate=lambda e: len(e.args[0]) == 2 and # added e.args[1] == [] and # removed @@ -110,24 +110,20 @@ def test(q, bus, conn, stream, bytestream_cls, stream.send(presence) # text channel - new_event = q.expect('dbus-signal', signal='NewChannels') + new_event = q.expect('dbus-signal', signal='NewChannel') - channels = new_event.args[0] - assert len(channels) == 1 - path, props = channels[0] + path, props = new_event.args assert props[cs.CHANNEL_TYPE] == cs.CHANNEL_TYPE_TEXT def new_chan_predicate(e): - path, props = e.args[0][0] + path, props = e.args return props[cs.CHANNEL_TYPE] == cs.CHANNEL_TYPE_STREAM_TUBE # tube channel is announced - new_event = q.expect('dbus-signal', signal='NewChannels', + new_event = q.expect('dbus-signal', signal='NewChannel', predicate=new_chan_predicate) - channels = new_event.args[0] - assert len(channels) == 1 - path, props = channels[0] + path, props = new_event.args assert props[cs.CHANNEL_TYPE] == cs.CHANNEL_TYPE_STREAM_TUBE assert props[cs.INITIATOR_HANDLE] == bob_handle assert props[cs.INITIATOR_ID] == 'chat@conf.localhost/bob' diff --git a/tests/twisted/tubes/accept-private-dbus-tube.py b/tests/twisted/tubes/accept-private-dbus-tube.py index fb81cb63e..7f3efab71 100644 --- a/tests/twisted/tubes/accept-private-dbus-tube.py +++ b/tests/twisted/tubes/accept-private-dbus-tube.py @@ -91,14 +91,12 @@ def test(q, bus, conn, stream, bytestream_cls, access_control): contact_offer_dbus_tube(bytestream, last_tube_id) def new_chan_predicate(e): - path, props = e.args[0][0] + path, props = e.args return props[cs.CHANNEL_TYPE] == cs.CHANNEL_TYPE_DBUS_TUBE - e = q.expect('dbus-signal', signal='NewChannels', + e = q.expect('dbus-signal', signal='NewChannel', predicate=new_chan_predicate) - channels = e.args[0] - assert len(channels) == 1 - path, props = channels[0] + path, props = e.args assert props[cs.CHANNEL_TYPE] == cs.CHANNEL_TYPE_DBUS_TUBE assert props[cs.INITIATOR_HANDLE] == bob_handle diff --git a/tests/twisted/tubes/accept-private-stream-tube.py b/tests/twisted/tubes/accept-private-stream-tube.py index 37ed1693d..386e51b5c 100644 --- a/tests/twisted/tubes/accept-private-stream-tube.py +++ b/tests/twisted/tubes/accept-private-stream-tube.py @@ -36,16 +36,13 @@ def receive_tube_offer(q, bus, conn, stream): stream.send(message) def new_chan_predicate(e): - path, props = e.args[0][0] + path, props = e.args return props[cs.CHANNEL_TYPE] == cs.CHANNEL_TYPE_STREAM_TUBE - new_sig = q.expect('dbus-signal', signal='NewChannels', + new_sig = q.expect('dbus-signal', signal='NewChannel', predicate=new_chan_predicate) - assert len(new_sig.args) == 1 - assert len(new_sig.args[0]) == 1 - - path, props = new_sig.args[0][0] + path, props = new_sig.args assertEquals(cs.CHANNEL_TYPE_STREAM_TUBE, props[cs.CHANNEL_TYPE]) assertEquals(cs.HT_CONTACT, props[cs.TARGET_HANDLE_TYPE]) assertEquals(False, props[cs.REQUESTED]) diff --git a/tests/twisted/tubes/check-create-tube-return.py b/tests/twisted/tubes/check-create-tube-return.py index 2f1e34aa9..a2af73f9f 100644 --- a/tests/twisted/tubes/check-create-tube-return.py +++ b/tests/twisted/tubes/check-create-tube-return.py @@ -41,7 +41,7 @@ def test(q, bus, conn, stream): ret, _ = q.expect_many( EventPattern('dbus-return', method='CreateChannel'), - EventPattern('dbus-signal', signal='NewChannels'), + EventPattern('dbus-signal', signal='NewChannel'), ) _, props = ret.value @@ -63,7 +63,7 @@ def test(q, bus, conn, stream): ret, _ = q.expect_many( EventPattern('dbus-return', method='CreateChannel'), - EventPattern('dbus-signal', signal='NewChannels'), + EventPattern('dbus-signal', signal='NewChannel'), ) _, props = ret.value diff --git a/tests/twisted/tubes/close-muc-with-closed-tube.py b/tests/twisted/tubes/close-muc-with-closed-tube.py index c5a7a5da4..3cf23fdef 100644 --- a/tests/twisted/tubes/close-muc-with-closed-tube.py +++ b/tests/twisted/tubes/close-muc-with-closed-tube.py @@ -28,7 +28,7 @@ def test(q, bus, conn, stream): cs.TARGET_ID: 'chat@conf.localhost'}) q.expect_many( - EventPattern('dbus-signal', signal='MembersChangedDetailed', + EventPattern('dbus-signal', signal='MembersChanged', predicate=lambda e: e.args[0] == [] and # added e.args[1] == [] and # removed @@ -45,7 +45,7 @@ def test(q, bus, conn, stream): # Send presence for own membership of room. stream.send(make_muc_presence('none', 'participant', 'chat@conf.localhost', 'test')) - event = q.expect('dbus-signal', signal='MembersChangedDetailed', + event = q.expect('dbus-signal', signal='MembersChanged', predicate=lambda e: len(e.args[0]) == 2 and # added e.args[1] == [] and # removed @@ -96,14 +96,14 @@ def test(q, bus, conn, stream): stream.send(presence) def new_chan_predicate(e): - path, props = e.args[0][0] + path, props = e.args return props[cs.CHANNEL_TYPE] == cs.CHANNEL_TYPE_DBUS_TUBE # tube channel is automatically created - event = q.expect('dbus-signal', signal='NewChannels', + event = q.expect('dbus-signal', signal='NewChannel', predicate=new_chan_predicate) - path, props = event.args[0][0] + path, props = event.args assertEquals(cs.CHANNEL_TYPE_DBUS_TUBE, props[cs.CHANNEL_TYPE]) assertEquals(cs.HT_ROOM, props[cs.TARGET_HANDLE_TYPE]) diff --git a/tests/twisted/tubes/ensure-si-tube.py b/tests/twisted/tubes/ensure-si-tube.py index 259c464a7..868ec63d0 100644 --- a/tests/twisted/tubes/ensure-si-tube.py +++ b/tests/twisted/tubes/ensure-si-tube.py @@ -27,6 +27,9 @@ def test(q, bus, conn, stream): properties = conn.GetAll( cs.CONN_IFACE_REQUESTS, dbus_interface=cs.PROPERTIES_IFACE) assert properties.get('Channels') == [], properties['Channels'] + + properties = conn.GetAll( + cs.CONN, dbus_interface=cs.PROPERTIES_IFACE) assert ({cs.CHANNEL_TYPE: cs.CHANNEL_TYPE_STREAM_TUBE, cs.TARGET_HANDLE_TYPE: cs.HT_CONTACT, }, @@ -73,11 +76,8 @@ def test(q, bus, conn, stream): bob_handle = conn.get_contact_handle_sync('bob@localhost') def new_chan_predicate(e): - types = [] - for _, props in e.args[0]: - types.append(props[cs.CHANNEL_TYPE]) - - return cs.CHANNEL_TYPE_STREAM_TUBE in types + _, props = e.args + return props[cs.CHANNEL_TYPE] == cs.CHANNEL_TYPE_STREAM_TUBE call_async(q, conn.Requests, 'CreateChannel', { cs.CHANNEL_TYPE: cs.CHANNEL_TYPE_STREAM_TUBE, @@ -88,7 +88,7 @@ def test(q, bus, conn, stream): ret, _ = q.expect_many( EventPattern('dbus-return', method='CreateChannel'), - EventPattern('dbus-signal', signal='NewChannels', + EventPattern('dbus-signal', signal='NewChannel', predicate=new_chan_predicate), ) @@ -122,14 +122,14 @@ def test(q, bus, conn, stream): ret, new_sig = q.expect_many( EventPattern('dbus-return', method='EnsureChannel'), - EventPattern('dbus-signal', signal='NewChannels', + EventPattern('dbus-signal', signal='NewChannel', predicate=new_chan_predicate), ) yours, path, props = ret.value assert yours - emitted_props = new_sig.args[0][0][1] + emitted_props = new_sig.args[1] assert props == emitted_props, (props, emitted_props) chan = bus.get_object(conn.bus_name, path) diff --git a/tests/twisted/tubes/offer-muc-dbus-tube.py b/tests/twisted/tubes/offer-muc-dbus-tube.py index ff10045c9..0e138a22a 100644 --- a/tests/twisted/tubes/offer-muc-dbus-tube.py +++ b/tests/twisted/tubes/offer-muc-dbus-tube.py @@ -127,11 +127,9 @@ def test(q, bus, conn, stream, access_control): } join_muc(q, bus, conn, stream, muc, request=request) - e = q.expect('dbus-signal', signal='NewChannels') + e = q.expect('dbus-signal', signal='NewChannel') - channels = e.args[0] - assert len(channels) == 1 - path, prop = channels[0] + path, prop = e.args assert prop[cs.CHANNEL_TYPE] == cs.CHANNEL_TYPE_DBUS_TUBE assert prop[cs.INITIATOR_ID] == 'chat2@conf.localhost/test' assert prop[cs.REQUESTED] == True @@ -146,21 +144,21 @@ def test(q, bus, conn, stream, access_control): dbus_interface=cs.PROPERTIES_IFACE, byte_arrays=True) assertContains((path, prop), all_channels) - tube_chan = wrap_channel(bus.get_object(conn.bus_name, path), 'DBusTube') + tube_chan = wrap_channel(bus.get_object(conn.bus_name, path), 'DBusTube1') tube_props = tube_chan.Properties.GetAll(cs.CHANNEL_IFACE_TUBE, byte_arrays=True) assert tube_props['State'] == cs.TUBE_CHANNEL_STATE_NOT_OFFERED # try to offer using a wrong access control try: - tube_chan.DBusTube.Offer(sample_parameters, cs.SOCKET_ACCESS_CONTROL_PORT) + tube_chan.DBusTube1.Offer(sample_parameters, cs.SOCKET_ACCESS_CONTROL_PORT) except dbus.DBusException, e: assertEquals(e.get_dbus_name(), cs.INVALID_ARGUMENT) else: assert False # offer the tube - call_async(q, tube_chan.DBusTube, 'Offer', sample_parameters, access_control) + call_async(q, tube_chan.DBusTube1, 'Offer', sample_parameters, access_control) presence_event, return_event, status_event, dbus_changed_event = q.expect_many( EventPattern('stream-presence', to='chat2@conf.localhost/test', predicate=lambda e: t.presence_contains_tube(e)), @@ -267,28 +265,27 @@ def test(q, bus, conn, stream, access_control): stream.send(make_muc_presence('none', 'participant', muc, 'test')) def new_tube(e): - path, props = e.args[0][0] + path, props = e.args return props[cs.CHANNEL_TYPE] == cs.CHANNEL_TYPE_DBUS_TUBE def new_text(e): - path, props = e.args[0][0] + path, props = e.args return props[cs.CHANNEL_TYPE] == cs.CHANNEL_TYPE_TEXT # tube and text is created - text_event, tube_event = q.expect_many(EventPattern('dbus-signal', signal='NewChannels', + text_event, tube_event = q.expect_many(EventPattern('dbus-signal', signal='NewChannel', predicate=new_text), - EventPattern('dbus-signal', signal='NewChannels', + EventPattern('dbus-signal', signal='NewChannel', predicate=new_tube)) - channels = e.args[0] - tube_path, props = tube_event.args[0][0] + tube_path, props = tube_event.args assertEquals(cs.CHANNEL_TYPE_DBUS_TUBE, props[cs.CHANNEL_TYPE]) assertEquals('chat2@conf.localhost/test', props[cs.INITIATOR_ID]) assertEquals(False, props[cs.REQUESTED]) assertEquals(cs.HT_ROOM, props[cs.TARGET_HANDLE_TYPE]) assertEquals('com.example.TestCase', props[cs.DBUS_TUBE_SERVICE_NAME]) - _, props = text_event.args[0][0] + _, props = text_event.args assertEquals(cs.CHANNEL_TYPE_TEXT, props[cs.CHANNEL_TYPE]) assertEquals(True, props[cs.REQUESTED]) diff --git a/tests/twisted/tubes/offer-muc-stream-tube.py b/tests/twisted/tubes/offer-muc-stream-tube.py index 1a3604563..ab0603710 100644 --- a/tests/twisted/tubes/offer-muc-stream-tube.py +++ b/tests/twisted/tubes/offer-muc-stream-tube.py @@ -79,11 +79,8 @@ def test(q, bus, conn, stream, bytestream_cls, address = t.create_server(q, address_type) def new_chan_predicate(e): - types = [] - for _, props in e.args[0]: - types.append(props[cs.CHANNEL_TYPE]) - - return cs.CHANNEL_TYPE_STREAM_TUBE in types + _, props = e.args + return props[cs.CHANNEL_TYPE] == cs.CHANNEL_TYPE_STREAM_TUBE def find_stream_tube(channels): for path, props in channels: @@ -104,10 +101,10 @@ def test(q, bus, conn, stream, bytestream_cls, _, new_tube_path, new_tube_props = \ join_muc(q, bus, conn, stream, 'chat@conf.localhost', request) - e = q.expect('dbus-signal', signal='NewChannels', + e = q.expect('dbus-signal', signal='NewChannel', predicate=new_chan_predicate) - path, prop = find_stream_tube(e.args[0]) + path, prop = e.args assert prop[cs.CHANNEL_TYPE] == cs.CHANNEL_TYPE_STREAM_TUBE assert prop[cs.INITIATOR_ID] == 'chat@conf.localhost/test' assert prop[cs.REQUESTED] == True @@ -120,13 +117,13 @@ def test(q, bus, conn, stream, bytestream_cls, dbus_interface=cs.PROPERTIES_IFACE, byte_arrays=True) assertContains((path, prop), all_channels) - tube_chan = wrap_channel(bus.get_object(conn.bus_name, path), 'StreamTube') + tube_chan = wrap_channel(bus.get_object(conn.bus_name, path), 'StreamTube1') tube_props = tube_chan.GetAll(cs.CHANNEL_IFACE_TUBE, dbus_interface=cs.PROPERTIES_IFACE) assert tube_props['State'] == cs.TUBE_CHANNEL_STATE_NOT_OFFERED # offer the tube - call_async(q, tube_chan.StreamTube, 'Offer', address_type, address, access_control, {'foo': 'bar'}) + call_async(q, tube_chan.StreamTube1, 'Offer', address_type, address, access_control, {'foo': 'bar'}) stream_event, _, status_event = q.expect_many( EventPattern('stream-presence', to='chat@conf.localhost/test', predicate=lambda e: t.presence_contains_tube(e)), @@ -173,8 +170,9 @@ def test(q, bus, conn, stream, bytestream_cls, EventPattern('dbus-signal', signal='NewRemoteConnection', interface=cs.CHANNEL_TYPE_STREAM_TUBE)) - handle, access, conn_id = conn_event.args + handle, identifier, access, conn_id = conn_event.args assert handle == bob_handle + assertEquals('chat@conf.localhost/bob', identifier) protocol = socket_event.protocol # start to read from the transport so we can read the control byte diff --git a/tests/twisted/tubes/offer-private-dbus-tube.py b/tests/twisted/tubes/offer-private-dbus-tube.py index ee4e190a7..a7b2de54a 100644 --- a/tests/twisted/tubes/offer-private-dbus-tube.py +++ b/tests/twisted/tubes/offer-private-dbus-tube.py @@ -104,11 +104,8 @@ def offer_new_dbus_tube(q, bus, conn, stream, self_handle, alice_handle, # Offer a tube to Alice (new API) def new_chan_predicate(e): - types = [] - for _, props in e.args[0]: - types.append(props[cs.CHANNEL_TYPE]) - - return cs.CHANNEL_TYPE_DBUS_TUBE in types + _, props = e.args + return props[cs.CHANNEL_TYPE] == cs.CHANNEL_TYPE_DBUS_TUBE def find_dbus_tube(channels): for path, props in channels: @@ -125,11 +122,11 @@ def offer_new_dbus_tube(q, bus, conn, stream, self_handle, alice_handle, }, byte_arrays=True) cc_ret, nc = q.expect_many( EventPattern('dbus-return', method='CreateChannel'), - EventPattern('dbus-signal', signal='NewChannels', + EventPattern('dbus-signal', signal='NewChannel', predicate=new_chan_predicate), ) tube_path, tube_props = cc_ret.value - _, new_channel_props = find_dbus_tube(nc.args[0]) + _, new_channel_props = nc.args # check tube channel properties assert tube_props[cs.CHANNEL_TYPE] == cs.CHANNEL_TYPE_DBUS_TUBE @@ -151,8 +148,8 @@ def offer_new_dbus_tube(q, bus, conn, stream, self_handle, alice_handle, all_channels = conn.Get(cs.CONN_IFACE_REQUESTS, 'Channels', dbus_interface=cs.PROPERTIES_IFACE, byte_arrays=True) - for path, props in nc.args[0]: - assertContains((path, props), all_channels) + path, props = nc.args + assertContains((path, props), all_channels) assertEquals(tube_props, new_channel_props) diff --git a/tests/twisted/tubes/offer-private-stream-tube.py b/tests/twisted/tubes/offer-private-stream-tube.py index 807959d8e..b6a488323 100644 --- a/tests/twisted/tubes/offer-private-stream-tube.py +++ b/tests/twisted/tubes/offer-private-stream-tube.py @@ -107,20 +107,20 @@ def test(q, bus, conn, stream, bytestream_cls, cs.STREAM_TUBE_SERVICE: "newecho", }) - def find_stream_tube(channels): - for path, props in channels: - if props[cs.CHANNEL_TYPE] == cs.CHANNEL_TYPE_STREAM_TUBE: - return path, props + def find_stream_tube(e): + path, props = e.args + if props[cs.CHANNEL_TYPE] == cs.CHANNEL_TYPE_STREAM_TUBE: + return path, props return None, None def new_chan_predicate(e): - path, _ = find_stream_tube(e.args[0]) + path, _ = find_stream_tube(e) return path is not None ret, new_sig = q.expect_many( EventPattern('dbus-return', method='CreateChannel'), - EventPattern('dbus-signal', signal='NewChannels', + EventPattern('dbus-signal', signal='NewChannel', predicate=new_chan_predicate), ) @@ -142,7 +142,7 @@ def test(q, bus, conn, stream, bytestream_cls, # the tube created using the new API is in the "not offered" state assert new_tube_props['State'] == cs.TUBE_CHANNEL_STATE_NOT_OFFERED - _, stream_tube_channel_properties = find_stream_tube(new_sig.args[0]) + _, stream_tube_channel_properties = find_stream_tube(new_sig) assert cs.TUBE_STATE not in stream_tube_channel_properties assert cs.TUBE_PARAMETERS not in stream_tube_channel_properties @@ -216,8 +216,9 @@ def test(q, bus, conn, stream, bytestream_cls, si_reply_event.stanza) assert len(tube) == 1 - handle, access, id = new_conn_event.args + handle, identifier, access, id = new_conn_event.args assert handle == bob_handle + assertEquals('bob@localhost', identifier) protocol = socket_event.protocol # we don't want to echo the access control byte protocol.echoed = False @@ -247,8 +248,9 @@ def test(q, bus, conn, stream, bytestream_cls, si_reply_event.stanza) assert len(tube) == 1 - handle, access, conn_id = new_conn_event.args + handle, identifier, access, conn_id = new_conn_event.args assert handle == bob_handle + assertEquals('bob@localhost', identifier) protocol = socket_event.protocol # we don't want to echo the access control byte protocol.echoed = False diff --git a/tests/twisted/tubes/test-get-available-tubes.py b/tests/twisted/tubes/test-get-available-tubes.py index a5508486d..74660d730 100644 --- a/tests/twisted/tubes/test-get-available-tubes.py +++ b/tests/twisted/tubes/test-get-available-tubes.py @@ -40,7 +40,7 @@ def test(q, bus, conn, stream): stream.send(make_muc_presence('owner', 'moderator', 'chat@conf.localhost', 'test')) _, event = q.expect_many( - EventPattern('dbus-signal', signal='MembersChangedDetailed', + EventPattern('dbus-signal', signal='MembersChanged', predicate=lambda e: len(e.args[0]) == 2 and # added e.args[1] == [] and # removed diff --git a/tests/twisted/tubes/test-socks5-muc.py b/tests/twisted/tubes/test-socks5-muc.py index 54947ec55..1c9236dfa 100644 --- a/tests/twisted/tubes/test-socks5-muc.py +++ b/tests/twisted/tubes/test-socks5-muc.py @@ -42,14 +42,12 @@ def test(q, bus, conn, stream): stream.send(presence) def new_chan_predicate(e): - path, props = e.args[0][0] + path, props = e.args return props[cs.CHANNEL_TYPE] == cs.CHANNEL_TYPE_STREAM_TUBE - e = q.expect('dbus-signal', signal='NewChannels', + e = q.expect('dbus-signal', signal='NewChannel', predicate=new_chan_predicate) - channels = e.args[0] - assert len(channels) == 1 - path, props = channels[0] + path, props = e.args assert props[cs.CHANNEL_TYPE] == cs.CHANNEL_TYPE_STREAM_TUBE tube_chan = bus.get_object(conn.bus_name, path) diff --git a/tests/twisted/tubes/tubetestutil.py b/tests/twisted/tubes/tubetestutil.py index 3c53d1533..f1c5092ac 100644 --- a/tests/twisted/tubes/tubetestutil.py +++ b/tests/twisted/tubes/tubetestutil.py @@ -82,6 +82,9 @@ def check_conn_properties(q, conn, channel_list=None): assert i in properties['Channels'], \ (i, properties['Channels']) + properties = conn.GetAll( + cs.CONN, dbus_interface=cs.PROPERTIES_IFACE) + # 1-1 StreamTube channel assert ({cs.CHANNEL_TYPE: cs.CHANNEL_TYPE_STREAM_TUBE, cs.TARGET_HANDLE_TYPE: cs.HT_CONTACT @@ -112,46 +115,6 @@ def check_conn_properties(q, conn, channel_list=None): ) in properties.get('RequestableChannelClasses'),\ properties['RequestableChannelClasses'] - -def check_NewChannel_signal(args, channel_type, chan_path, contact_handle, - suppress_handler): - """ - Checks the first argument, a tuple of arguments from NewChannel, matches - the other arguments. - """ - if chan_path is not None: - assert args[0] == chan_path, (args, chan_path) - assert args[1] == channel_type, (args, channel_type) - assert args[2] == cs.HT_CONTACT, (args, cs.HT_CONTACT) - assert args[3] == contact_handle, (args, contact_handle) - assert args[4] == suppress_handler, (args, suppress_handler) - -def check_NewChannels_signal(conn, args, channel_type, chan_path, contact_handle, - contact_id, initiator_handle): - """ - Checks the first argument, a one-tuple of arguments from NewChannels, - matches the other arguments. - """ - assert len(args) == 1, args - assert len(args[0]) == 1 # one channel - path, props = args[0][0] - - assert path == chan_path, (emitted_path, chan_path) - - assert props[cs.CHANNEL_TYPE] == channel_type, (props, channel_type) - assert props[cs.TARGET_HANDLE_TYPE] == cs.HT_CONTACT, props - assert props[cs.TARGET_HANDLE] == contact_handle, (props, contact_handle) - assert props[cs.TARGET_ID] == contact_id, (props, contact_id) - assert props[cs.REQUESTED] == True, props - assert props[cs.INITIATOR_HANDLE] == initiator_handle, \ - (props, initiator_handle) - assert props[cs.INITIATOR_ID] == 'test@localhost', props - - # check that the newly announced channel is in the channels list - all_channels = conn.Get(cs.CONN_IFACE_REQUESTS, 'Channels', - dbus_interface=cs.PROPERTIES_IFACE, byte_arrays=True) - assertContains((path, props), all_channels) - def check_platform_socket_types(sock_types): assertContains(cs.SOCKET_ADDRESS_TYPE_IPV4, sock_types) assertContains(cs.SOCKET_ADDRESS_TYPE_IPV6, sock_types) @@ -171,8 +134,8 @@ def check_channel_properties(q, bus, conn, channel, channel_type, channel_props = channel.GetAll(cs.CHANNEL, dbus_interface=cs.PROPERTIES_IFACE) assert channel_props.get('TargetHandle') == contact_handle, \ (channel_props.get('TargetHandle'), contact_handle) - assert channel_props.get('TargetHandleType') == cs.HT_CONTACT, \ - channel_props.get('TargetHandleType') + assert channel_props.get('TargetEntityType') == cs.HT_CONTACT, \ + channel_props.get('TargetEntityType') assert channel_props.get('ChannelType') == channel_type, \ channel_props.get('ChannelType') assert 'Interfaces' in channel_props, channel_props diff --git a/tests/twisted/vcard/get-contact-info.py b/tests/twisted/vcard/get-contact-info.py index f546c350f..c9542f47e 100644 --- a/tests/twisted/vcard/get-contact-info.py +++ b/tests/twisted/vcard/get-contact-info.py @@ -56,7 +56,7 @@ def test(q, bus, conn, stream): u'Exemplary Team']), ] # The request should be satisfied from the cache. - h2asv = conn.Contacts.GetContactAttributes([handle], [cs.CONN_IFACE_CONTACT_INFO], False) + h2asv = conn.Contacts.GetContactAttributes([handle], [cs.CONN_IFACE_CONTACT_INFO]) assertEquals(contact_info, h2asv[handle][cs.ATTR_CONTACT_INFO]) if __name__ == '__main__': diff --git a/tests/twisted/vcard/set-contact-info.py b/tests/twisted/vcard/set-contact-info.py index 0035c4c4b..2338d030c 100644 --- a/tests/twisted/vcard/set-contact-info.py +++ b/tests/twisted/vcard/set-contact-info.py @@ -129,7 +129,7 @@ def test(q, bus, conn, stream): q.expect_many( EventPattern('dbus-return', method='SetContactInfo'), EventPattern('dbus-signal', signal='AliasesChanged', - predicate=lambda e: e.args[0][0][1] == 'HR Ninja'), + predicate=lambda e: e.args[0].values()[0] == 'HR Ninja'), EventPattern('dbus-signal', signal='ContactInfoChanged'), ) diff --git a/tests/twisted/vcard/test-alias-message.py b/tests/twisted/vcard/test-alias-message.py index 07f889bf2..5d7efef05 100644 --- a/tests/twisted/vcard/test-alias-message.py +++ b/tests/twisted/vcard/test-alias-message.py @@ -15,7 +15,7 @@ import constants as cs import ns def get_aliases(conn, contacts): - h2asv = conn.Contacts.GetContactAttributes(contacts, [cs.CONN_IFACE_ALIASING], False) + h2asv = conn.Contacts.GetContactAttributes(contacts, [cs.CONN_IFACE_ALIASING]) ret = {} for h in contacts: ret[h] = h2asv[h][cs.ATTR_ALIAS] @@ -39,7 +39,7 @@ def test(q, bus, conn, stream): )) _, mr = q.expect_many( EventPattern('dbus-signal', signal='AliasesChanged', - args=[[(handle, alias)]]), + args=[{handle: alias}]), EventPattern('dbus-signal', signal='MessageReceived'), ) @@ -57,7 +57,7 @@ def test(q, bus, conn, stream): # FIXME: Gabble forgets the alias, but it doesn't signal that it has done # so; it probably should. - # q.expect('dbus-signal', signal='AliasesChanged', args=[[(handle, jid)]]) + # q.expect('dbus-signal', signal='AliasesChanged', args=[{handle: jid}]) assertEquals({handle: jid}, get_aliases(conn, [handle])) @@ -90,7 +90,7 @@ def test(q, bus, conn, stream): q.expect_many( EventPattern('dbus-signal', signal='AliasesChanged', - args=[[(bob_handle, alias)]]), + args=[{bob_handle: alias}]), EventPattern('dbus-signal', signal='MessageReceived'),) assertEquals({bob_handle: alias}, get_aliases(conn, [bob_handle])) @@ -105,7 +105,7 @@ def test(q, bus, conn, stream): # FIXME: Gabble forgets the alias, but it doesn't signal that it has done # so; it probably should. # q.expect('dbus-signal', signal='AliasesChanged', - # args=[[(bob_handle, 'bob')]]) + # args=[{bob_handle: 'bob'}]) assertEquals({bob_handle: 'bob'}, get_aliases(conn, [bob_handle])) if __name__ == '__main__': diff --git a/tests/twisted/vcard/test-alias-pep.py b/tests/twisted/vcard/test-alias-pep.py index 201eeeeb1..75a77a723 100644 --- a/tests/twisted/vcard/test-alias-pep.py +++ b/tests/twisted/vcard/test-alias-pep.py @@ -32,7 +32,7 @@ def test(q, bus, conn, stream): stream.send(result) q.expect('dbus-signal', signal='AliasesChanged', - args=[[(handle, u'Bobby')]]) + args=[{handle: u'Bobby'}]) q.expect('dbus-return', method='RequestAliases', value=(['Bobby'],)) @@ -56,12 +56,9 @@ def test(q, bus, conn, stream): event = q.expect('dbus-signal', signal='AliasesChanged') aliases = event.args[0] - assertLength(1, aliases) - h, a = aliases[0] - assertEquals(handle, h) # The contact explicitly cleared their PEP nick; Gabble should fall back to # their JID. - assertEquals(a, 'bob@foo.com') + assertEquals({handle: 'bob@foo.com'}, aliases) if __name__ == '__main__': exec_test(test) diff --git a/tests/twisted/vcard/test-alias.py b/tests/twisted/vcard/test-alias.py index 72d0bf5bc..0d0455939 100644 --- a/tests/twisted/vcard/test-alias.py +++ b/tests/twisted/vcard/test-alias.py @@ -37,7 +37,7 @@ def test(q, bus, conn, stream): stream.send(result) q.expect('dbus-signal', signal='AliasesChanged', - args=[[(handle, u'Bobby')]]) + args=[{handle: u'Bobby'}]) q.expect('dbus-return', method='RequestAliases', value=(['Bobby'],)) diff --git a/tests/twisted/vcard/test-avatar-tokens.py b/tests/twisted/vcard/test-avatar-tokens.py index 281a733bc..e0f93a916 100644 --- a/tests/twisted/vcard/test-avatar-tokens.py +++ b/tests/twisted/vcard/test-avatar-tokens.py @@ -44,7 +44,7 @@ def test(q, bus, conn, stream): handles = conn.get_contact_handles_sync([ 'amy@foo.com', 'bob@foo.com', 'che@foo.com', 'daf@foo.com' ]) - h2asv = conn.Contacts.GetContactAttributes(handles, [cs.CONN_IFACE_AVATARS], False) + h2asv = conn.Contacts.GetContactAttributes(handles, [cs.CONN_IFACE_AVATARS]) assertEquals('SHA1SUM-FOR-AMY', h2asv[handles[0]][cs.ATTR_AVATAR_TOKEN]) assertEquals('SHA1SUM-FOR-BOB', h2asv[handles[1]][cs.ATTR_AVATAR_TOKEN]) assertEquals('', h2asv[handles[2]][cs.ATTR_AVATAR_TOKEN]) diff --git a/tests/twisted/vcard/test-set-alias.py b/tests/twisted/vcard/test-set-alias.py index 8d69d5193..2b356bce7 100644 --- a/tests/twisted/vcard/test-set-alias.py +++ b/tests/twisted/vcard/test-set-alias.py @@ -35,8 +35,8 @@ def test(q, bus, conn, stream): assertEquals('lala', nickname.children[0]) expect_and_handle_set_vcard(q, stream, check=check) - event = q.expect('dbus-signal', signal='AliasesChanged', - args=[[(self_handle, u'lala')]]) + q.expect('dbus-signal', signal='AliasesChanged', + args=[{self_handle: u'lala'}]) conn.Aliasing.SetAliases({self_handle: ''}) pep_update = q.expect('stream-iq', iq_type='set', query_ns=ns.PUBSUB, query_name='pubsub') @@ -49,8 +49,8 @@ def test(q, bus, conn, stream): assertLength(0, vCard.children) expect_and_handle_set_vcard(q, stream, check=check) - event = q.expect('dbus-signal', signal='AliasesChanged', - args=[[(self_handle, u'test@localhost')]]) + q.expect('dbus-signal', signal='AliasesChanged', + args=[{self_handle: u'test@localhost'}]) if __name__ == '__main__': exec_test(test) diff --git a/tools/Makefile.am b/tools/Makefile.am index 5b78d699c..46bfc6e0d 100644 --- a/tools/Makefile.am +++ b/tools/Makefile.am @@ -38,7 +38,6 @@ EXTRA_DIST = \ libglibcodegen.py \ make-release-mail.py \ make-version-script.py \ - manager-file.py \ shave.mk \ telepathy.am \ telepathy-glib.supp \ diff --git a/tools/doc-generator.xsl b/tools/doc-generator.xsl index 76fc96964..90090d290 100644 --- a/tools/doc-generator.xsl +++ b/tools/doc-generator.xsl @@ -276,7 +276,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA <xsl:when test="tp:property"> <h2 xmlns="http://www.w3.org/1999/xhtml">Telepathy Properties:</h2> <p xmlns="http://www.w3.org/1999/xhtml">Accessed using the - <a href="#org.freedesktop.Telepathy.Properties">Telepathy + <a href="#im.telepathy1.Properties">Telepathy Properties</a> interface.</p> <dl xmlns="http://www.w3.org/1999/xhtml"> <xsl:apply-templates select="tp:property"/> diff --git a/tools/manager-file.py b/tools/manager-file.py deleted file mode 100644 index e1b51a616..000000000 --- a/tools/manager-file.py +++ /dev/null @@ -1,187 +0,0 @@ -#!/usr/bin/python - -# manager-file.py: generate .manager files and TpCMParamSpec arrays from the -# same data (should be suitable for all connection managers that don't have -# plugins) -# -# The master copy of this program is in the telepathy-glib repository - -# please make any changes there. -# -# Copyright (c) Collabora Ltd. <http://www.collabora.co.uk/> -# -# This library is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public -# License as published by the Free Software Foundation; either -# version 2.1 of the License, or (at your option) any later version. -# -# This library is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - -import re -import sys - -_NOT_C_STR = re.compile(r'[^A-Za-z0-9_-]') - -def c_string(x): - # whitelist-based brute force and ignorance - escape nearly all punctuation - return '"' + _NOT_C_STR.sub(lambda c: r'\x%02x' % ord(c), x) + '"' - -def desktop_string(x): - return x.replace(' ', r'\s').replace('\n', r'\n').replace('\r', r'\r').replace('\t', r'\t') - -supported = list('sbuiqn') - -fdefaultencoders = { - 's': desktop_string, - 'b': (lambda b: b and '1' or '0'), - 'u': (lambda n: '%u' % n), - 'i': (lambda n: '%d' % n), - 'q': (lambda n: '%u' % n), - 'n': (lambda n: '%d' % n), - } -for x in supported: assert x in fdefaultencoders - -gtypes = { - 's': 'G_TYPE_STRING', - 'b': 'G_TYPE_BOOLEAN', - 'u': 'G_TYPE_UINT', - 'i': 'G_TYPE_INT', - 'q': 'G_TYPE_UINT', - 'n': 'G_TYPE_INT', -} -for x in supported: assert x in gtypes - -gdefaultencoders = { - 's': c_string, - 'b': (lambda b: b and 'GINT_TO_POINTER (TRUE)' or 'GINT_TO_POINTER (FALSE)'), - 'u': (lambda n: 'GUINT_TO_POINTER (%u)' % n), - 'i': (lambda n: 'GINT_TO_POINTER (%d)' % n), - 'q': (lambda n: 'GUINT_TO_POINTER (%u)' % n), - 'n': (lambda n: 'GINT_TO_POINTER (%d)' % n), - } -for x in supported: assert x in gdefaultencoders - -gdefaultdefaults = { - 's': 'NULL', - 'b': 'GINT_TO_POINTER (FALSE)', - 'u': 'GUINT_TO_POINTER (0)', - 'i': 'GINT_TO_POINTER (0)', - 'q': 'GUINT_TO_POINTER (0)', - 'n': 'GINT_TO_POINTER (0)', - } -for x in supported: assert x in gdefaultdefaults - -gflags = { - 'has-default': 'TP_CONN_MGR_PARAM_FLAG_HAS_DEFAULT', - 'register': 'TP_CONN_MGR_PARAM_FLAG_REGISTER', - 'required': 'TP_CONN_MGR_PARAM_FLAG_REQUIRED', - 'secret': 'TP_CONN_MGR_PARAM_FLAG_SECRET', - 'dbus-property': 'TP_CONN_MGR_PARAM_FLAG_DBUS_PROPERTY', -} - -def write_manager(f, manager, protos): - # pointless backwards compat section - print >> f, '[ConnectionManager]' - print >> f, 'BusName=org.freedesktop.Telepathy.ConnectionManager.' + manager - print >> f, 'ObjectPath=/org/freedesktop/Telepathy/ConnectionManager/' + manager - - # protocols - for proto, params in protos.iteritems(): - print >> f - print >> f, '[Protocol %s]' % proto - - defaults = {} - - for param, info in params.iteritems(): - dtype = info['dtype'] - flags = info.get('flags', '').split() - struct_field = info.get('struct_field', param.replace('-', '_')) - filter = info.get('filter', 'NULL') - filter_data = info.get('filter_data', 'NULL') - setter_data = 'NULL' - - if 'default' in info: - default = fdefaultencoders[dtype](info['default']) - defaults[param] = default - - if flags: - flags = ' ' + ' '.join(flags) - else: - flags = '' - - print >> f, 'param-%s=%s%s' % (param, desktop_string(dtype), flags) - - for param, default in defaults.iteritems(): - print >> f, 'default-%s=%s' % (param, default) - -def write_c_params(f, manager, proto, struct, params): - print >> f, "static const TpCMParamSpec %s_%s_params[] = {" % (manager, proto) - - for param, info in params.iteritems(): - dtype = info['dtype'] - flags = info.get('flags', '').split() - struct_field = info.get('struct_field', param.replace('-', '_')) - filter = info.get('filter', 'NULL') - filter_data = info.get('filter_data', 'NULL') - setter_data = 'NULL' - - if 'default' in info: - default = gdefaultencoders[dtype](info['default']) - else: - default = gdefaultdefaults[dtype] - - if flags: - flags = ' | '.join([gflags[flag] for flag in flags]) - else: - flags = '0' - - if struct is None or struct_field is None: - struct_offset = '0' - else: - struct_offset = 'G_STRUCT_OFFSET (%s, %s)' % (struct, struct_field) - - print >> f, (''' { %s, %s, %s, - %s, - %s, /* default */ - %s, /* struct offset */ - %s, /* filter */ - %s, /* filter data */ - %s /* setter data */ },''' % - (c_string(param), c_string(dtype), gtypes[dtype], flags, - default, struct_offset, filter, filter_data, setter_data)) - - print >> f, " { NULL }" - print >> f, "};" - -if __name__ == '__main__': - environment = {} - execfile(sys.argv[1], environment) - - filename = '%s/%s.manager' % (sys.argv[2], environment['MANAGER']) - try: - os.remove(filename) - except OSError: - pass - f = open(filename + '.tmp', 'w') - write_manager(f, environment['MANAGER'], environment['PARAMS']) - f.close() - os.rename(filename + '.tmp', filename) - - filename = '%s/param-spec-struct.h' % sys.argv[2] - try: - os.remove(filename) - except OSError: - pass - f = open(filename + '.tmp', 'w') - for protocol in environment['PARAMS']: - write_c_params(f, environment['MANAGER'], protocol, - environment['STRUCTS'][protocol], - environment['PARAMS'][protocol]) - f.close() - os.rename(filename + '.tmp', filename) |