|
|
2010-06-05
, 22:37
|
|
|
Posts: 4,274 |
Thanked: 5,358 times |
Joined on Sep 2007
@ Looking at y'all and sighing
|
#2
|
(I was doing some Properties manipulation in Vala and I swear to God it's so easy...)
|
|
2010-06-05
, 23:17
|
|
Posts: 187 |
Thanked: 41 times |
Joined on May 2010
|
#3
|
|
|
2010-06-20
, 21:36
|
|
|
Posts: 702 |
Thanked: 334 times |
Joined on Feb 2010
@ Israel.
|
#4
|
|
|
2010-06-20
, 22:20
|
|
Posts: 12 |
Thanked: 3 times |
Joined on Jun 2010
@ Madrid
|
#5
|
|
|
2010-06-23
, 21:48
|
|
Posts: 187 |
Thanked: 41 times |
Joined on May 2010
|
#6
|
#!/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()
Right now i want to disable my skype account... When i click disable in the interface i can see in dbus-monitor these lines:
I tried :
but that does nothing ...
any help ?