rendered paste bodyTelepathy = imports.gi.TelepathyGLib;
Gtk = imports.gi.Gtk;
GObject = imports.gi.GObject;
function account_ready(account){
connection = account.get_connection();
contact_list = connection.dup_contact_list();
for (i in contact_list) {
contact = contact_list[i];
if (contact.get_presence_type() == Telepathy.ConnectionPresenceType.AVAILABLE)
print("Contact: " + contact.get_identifier());
}
}
function manager_prepared(manager){
print (manager);
accounts = manager.get_valid_accounts();
for (i in accounts) {
account = accounts[i];
account.request_presence_async (Telepathy.ConnectionPresenceType.AVAILABLE, "Foo", "Foo", account_ready);
}
}
function main(){
var manager = Telepathy.AccountManager.prototype.dup();
factory = manager.get_factory();
factory.add_account_features([Telepathy.Account.get_feature_quark_connection(), Telepathy.Account.get_feature_quark_core()]);
factory.add_connection_features([Telepathy.Connection.get_feature_quark_contact_list(), Telepathy.Connection.get_feature_quark_contact_info()]);
factory.add_contact_features(1,[Telepathy.ContactFeature.PRESENCE]);
manager.prepare_async(null, manager_prepared);
Gtk.main();
}
main();