Reply
Thread Tools
Posts: 187 | Thanked: 41 times | Joined on May 2010
#1
Hi guys, i am newbie on dbus and i am trying to learn how to understand the output from dbus-monitor and send it using dbus-send command.

Right now i want to disable my skype account... When i click disable in the interface i can see in dbus-monitor these lines:
Code:
method call sender=:1.138 -> dest=org.freedesktop.Telepathy.AccountManager serial=45 path=/org/freedesktop/Telepathy/Account/spirit/skype/MYACCOUNT0; interface=org.freedesktop.DBus.Properties; member=Set                                                                                                        
string "org.freedesktop.Telepathy.Account"                                                                                                           
string "Enabled"                                                                                                                                          
variant       boolean false
How can i send that same command in dbus-launch ?

I tried :
Code:
dbus-send --session --type=method_call --dest=org.freedesktop.Telepathy.AccountManager /org/freedesktop/Telepathy/Account/spirit/skype/MYACCOUNT0 org.freedesktop.Telepathy.Account.Enabled  string:"org.freedesktop.Telepathy.Account" string:"Enabled" boolean:false
after send this i can see in dbus-monitor
Code:
method call sender=:1.229 -> dest=org.freedesktop.Telepathy.AccountManager serial=2 path=/org/freedesktop/Telepathy/Account/spirit/skype/MYACCOUNT0; interface=org.freedesktop.Telepathy.Account; member=Enabled
   string "org.freedesktop.Telepathy.Account"
   string "Enabled"
   boolean false

but that does nothing ...

any help ?
 
qwerty12's Avatar
Posts: 4,274 | Thanked: 5,358 times | Joined on Sep 2007 @ Looking at y'all and sighing
#2
dbus-send doesn't support the sending of Variants, which is what the Properties interface is all about...

You may be able to hack something up using http://talk.maemo.org/showthread.php?p=500800. That's the best I can help, alas, due to my finding python-dbus to be a total ********. (I was doing some Properties manipulation in Vala and I swear to God it's so easy...)
 
Posts: 187 | Thanked: 41 times | Joined on May 2010
#3
hhanks , i was able to change that code to do what i wanted ...
 
eitama's Avatar
Posts: 702 | Thanked: 334 times | Joined on Feb 2010 @ Israel.
#4
Originally Posted by colchaodemola View Post
hhanks , i was able to change that code to do what i wanted ...
Can you show us your final code? It would help me a lot!!!
__________________
| Developer of Horizontal-Call - Call your contacts, fast! |
| Reverse SSH - access your N900 from anywhere, anytime |
| Using Samsung Galaxy S GT-i9000 and Nokia N900 |
| DonateMe - If you feel I helped you in a very good way, feel free to donate |
 
Posts: 12 | Thanked: 3 times | Joined on Jun 2010 @ Madrid
#5
yes, please share with us
 
Posts: 187 | Thanked: 41 times | Joined on May 2010
#6
i am using this code right now ...
there is an enable/disable and a change_status method...

Code:
#!/usr/bin/env python
import conic
import dbus
import gobject
import dbus.glib
import time
import telepathy
import os

accounts = {
"/org/freedesktop/Telepathy/Account/gabble/jabber/account1_40gmail_2ecom0": ["eb81ac58-1b84-47e4-8859-dce88d50c143"],
"/org/freedesktop/Telepathy/Account/spirit/skype/account2 ["eb81ac58-1b84-47e4-8859-dce88d50c143"],
}

loop = gobject.MainLoop()
bus = dbus.SessionBus()

def change_state(account , presence_const, presence_text , personal_message):
    accountd = bus.get_object('org.freedesktop.Telepathy.AccountManager', account)
    accountd.Set('org.freedesktop.Telepathy.Account', 'RequestedPresence', \
                dbus.Struct(( dbus.UInt32( presence_const) ,  presence_text, personal_message ), signature='uss'),
                dbus_interface='org.freedesktop.DBus.Properties')
    
def disable(account):
    accountd = bus.get_object('org.freedesktop.Telepathy.AccountManager', account)
    iface = dbus.Interface(accountd, 'org.freedesktop.DBus.Properties')
    iface.Set("org.freedesktop.Telepathy.Account", "Enabled", False)

def enable(account):
    accountd = bus.get_object('org.freedesktop.Telepathy.AccountManager', account)
    iface = dbus.Interface(accountd, 'org.freedesktop.DBus.Properties')
    iface.Set("org.freedesktop.Telepathy.Account", "Enabled", True)

def connection_cb(connection, event):
    print event.get_status()
    if event.get_status() == conic.STATUS_DISCONNECTING:
        iap_id = event.get_iap_id()
        for account in accounts:
	    if iap_id in accounts[account]:
		print "Disabling " + account + " on " + iap_id + " ..."
            	disable(account)
		#change_state(account, telepathy.constants.CONNECTION_PRESENCE_TYPE_OFFLINE, 'offline' , 'On N900 Mobile')

    if event.get_status() == conic.STATUS_CONNECTED:
        iap_id = event.get_iap_id()
	if not (os.path.exists("/home/user/.Skype")):
		print "Invalid Home dir ..."
		return
	time.sleep(30)
        for account in accounts:
	    if iap_id in accounts[account]:
		print "Enabling " + account + " on " + iap_id + " ..."
		enable(account)
		#change_state(account, telepathy.constants.CONNECTION_PRESENCE_TYPE_AVAILABLE, 'dnd' , 'On N900 Mobile')


connection = conic.Connection()
connection.connect("connection-event", connection_cb)
connection.set_property("automatic-connection-events", True)

loop.run()
 
Reply

Thread Tools

 
Forum Jump


All times are GMT. The time now is 18:27.