Re: libpurple php binding

From: Date: Fri, 30 Nov 2007 22:36:34 +0000
Subject: Re: libpurple php binding
References: 1  Groups: php.pecl.dev 
Request: Send a blank email to pecl-dev+get-4936@lists.php.net to get a copy of this message
I didn't yet test it, but it definitely looks interesting :) Will try to test it this weekend. Are you planning to add object-oriented api? php-code would become much cleaner. Constants can be converted into class-constants too… function-names are not obvious, currently, and calling 4 functions without parameters for initialization seems a bit… redundant. By the way, PHP 5.2+ has DateTime object, which can be used instead of timestamp. I'll be give more thoughts after testing. On 12/1/07, Anatoliy Belsky <weltling@0ext.net> wrote: > Hi there, > > so I would present the begin of my work on the libpurple php binding. It's yet > very rudimentary but I've already realized the nullclient and a little bit > more. > > The project site can be found on: > > http://sourceforge.net/projects/phpurple > > The code itself can be fetched with; > > svn co https://phpurple.svn.sourceforge.net/svnroot/phpurple > phpurple > > The further steps would be (don't forget to install the php devel package on > your system): > > cd phpurple > phpize > ./configure --enable-purple > make > > After this you should have the modules/purple.so file. And you can use it. > Eventually you can run > > make install > > if you have root rights and want to install it globally as a php extension > (but it's not nesessary yet). > > than make the file test.php (in the phpurple dir) with the following content: > > #!/usr/bin/php > <?php > > if(!extension_loaded('purple')) { > dl('purple.' . PHP_SHLIB_SUFFIX); > } > > $ui_id = "hello world"; > > purple_php_write_conv_function("my_write_conv"); > function my_write_conv($conversation, $who, $alias, $message, $flags, $time) > { > if ($alias) { > $name = $alias; > } else if ($who) { > $name = $who; > } else { > $name = NULL; > } > > if(PURPLE_MESSAGE_RECV == $flags) { > printf( "(%s) %s %s: %s\n", > purple_conversation_get_name($conversation), > date("H:i:s", $time), > $name, > $message > ); > } > > if(!purple_core_init($ui_id)) { > die("libpurple initialization failed\n"); > } > > purple_blist_new(); > purple_prefs_load(); > purple_plugins_load_saved(); > purple_pounces_load(); > > //or some protocol ever supported > $account = purple_account_new("somenick@hotmail.com", "MSN"); > purple_account_set_password($account, "somepass"); > purple_account_set_enabled($account, $ui_id, true); > > purple_savedstatus_new(NULL, PURPLE_STATUS_AVAILABLE); > purple_savedstatus_activate(); > > purple_signal_connect("signed-on"); > > purple_loop(); > > ?> > > Now you should be able to start a conversation from the other side and see the > outputs in the console. To run the php ( I expect u still in the phpurple > dir ) run > > php -n -d extension_dir=modules -f test.php > > I've tested and built the whole thing on debian etch with PHP 5.2.0-8 > > So if someone has tested this, I would hear something, what should be it the > ext, to can call it something like phpurple1.0 ... may be you see something > wrong in my c code ... I'll assume any meaning > > thanks a lot > > Anatoliy > > -- > PECL development discussion Mailing List (http://pecl.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- Alexey Zakhlestin http://blog.milkfarmsoft.com/

« previous php.pecl.dev (#4936) next »