Send and receive messages via (libpurple) message protocols

I came up with an idea that would require me to be able to send and receive messages through standard message protocols such as msn, icq, aim, skype, etc.

I am currently familiar with PHP and Python and thus get a library with which I can access from these languages. I found phurple ( http://sourceforge.net/projects/phurple/ ) for php and python-purple ( http://developer.pidgin.im/wiki/PythonHowTo ) that don't seem to be updated. What do you guys suggest doing? My goal will be to write a web application remotely, like meebo.com

The answer should include a tutorial or example implementation and decent documentation .. pidgin.im really doesn't have a useful tutorial.

alternativly you can also just tell me different implementation options so that I can build my own class from the existing icq, aim, msn implementation, etc.

An example of how to connect to an account (login), and then send one message, will be the last help!

Come to one guy :)

+4
source share
4 answers

Here's how to connect to a Pidgin DBus server.

#!/usr/bin/env python import dbus bus = dbus.SessionBus() if "im.pidgin.purple.PurpleService" in bus.list_names(): purple = bus.get_object("im.pidgin.purple.PurpleService", "/im/pidgin/purple/PurpleObject", "im.pidgin.purple.PurpleInterface") print "Connected to the pidgin DBus." for conv in purple.PurpleGetIms(): purple.PurpleConvImSend(purple.PurpleConvIm(conv), "Ignore this message.") else: print "Could not find piding DBus service, make sure Pidgin is running." 

I don't know if you saw this, but here is the official DBus python tutorial: link .

EDIT: Re-adding the link to the pidgin wiki. He teaches you everything that I wrote above, just scroll down the page. http://developer.pidgin.im/wiki/PythonHowTo

+11
source

A good bet would be to go through the DBus interface: Pidgin (purple) fully supports it, and the DBus interface library for Python is pretty stable.

+2
source

If you unzip the file from phurple, you will get the following example:

 <?php if(!extension_loaded('phurple')) { dl('phurple.' . PHP_SHLIB_SUFFIX); } class CustomPhurpleClient extends PhurpleClient { private $someVar; protected function initInternal() { $this->someVar = "Hello World"; } protected function writeIM($conversation, $buddy, $message, $flags, $time) { if(PhurpleClient::MESSAGE_RECV == $flags) { printf( "(%s) %s %s: %s\n", $conversation->getName() ? $conversation->getName() : $buddy->getName(), date("H:i:s", $time), is_object($buddy) ? $buddy->getAlias() : $buddy, $message ); } } protected function onSignedOn($connection) { print $this->justForFun($this->someVar); } public function justForFun($param) { return "just for fun, the param is: $param"; } } // end Class CustomPhurpleClient // Example Code Below: try { $user_dir = "/tmp/phphurple-test"; if(!file_exists($user_dir) || !is_dir($user_dir)) { mkdir($user_dir); } PhurpleClient::setUserDir($user_dir); PhurpleClient::setDebug(true); PhurpleClient::setUiId("TestUI"); $client = CustomPhurpleClient::getInstance(); $client->addAccount("msn:// nick@hotmail.com : password@messenger.hotmail.com :1863"); $client->connect(); $client->runLoop(); } catch (Exception $e) { echo "[Phurple]: " . $e->getMessage() . "\n"; die(); } ?> 
+1
source

I am using WebIcqLite: the sender of ICQ messages for the ICQ protocol. This works, and the class is easy to understand. However, I do not know about other protocols. What is wrong with the Phurple library?

0
source

All Articles