Created
June 3, 2013 11:53
-
-
Save jsmarkus/5697649 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var dbus = require('dbus-native'); | |
var sessionBus = dbus.sessionBus(); | |
var svc = sessionBus.getService('im.pidgin.purple.PurpleService'); | |
svc.getInterface('/im/pidgin/purple/PurpleObject', 'im.pidgin.purple.PurpleInterface', function (err, purple) { | |
if(err) { | |
console.error('Could not get interface'); | |
console.error(err); | |
return process.exit(1); | |
console.log('Interface obtained'); | |
} | |
purple.PurpleSavedstatusNew('Вася Ложкин', 2, function (err, status) { | |
//BUT - this callback is never called if the 1st argument of PurpleSavedstatusNew contains Cyrillic characters! | |
if(err) { | |
console.error('Could not create status'); | |
console.error(err); | |
return process.exit(1); | |
} | |
console.log('Status created'); | |
console.log(status); | |
}); | |
}); |
well actually i do it with pogoscript - it is convenient for such things. for example:
dbus = require 'dbus-native'
sessionBus = dbus.sessionBus()
svc = sessionBus.getService('im.pidgin.purple.PurpleService')
purple = svc.getInterface!('/im/pidgin/purple/PurpleObject', 'im.pidgin.purple.PurpleInterface')
accountId = purple.PurpleAccountsFind!('[email protected]', 'prpl-jabber')
conversationId = purple.PurpleConversationNew!(1, accountId, '[email protected]')
im = purple.PurpleConvIm!(conversationId)
purple.PurpleConvImSend!(im, 'Some message')
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
you can generate similar code with dbus2js utility:
node ./bin/dbus2js.js --service im.pidgin.purple.PurpleService --path /im/pidgin/purple/PurpleObject > pidgin_client.js