1 (edited by ingram 2009-02-10 20:30)

Topic: The making process of Xfire IM support extension

My aim is simple: to get xfire working in profiles. Xfire is Instant Messenger for gamers, has a cool and widely supported in-game overlay (like steam has, but better).

It's quite simple. But I haven't got the hang on hooks. I need a walkthrough, using hooks.

Modifiying directly the code, i was able to get it working. First one needs to add a new field into users table, let's examples from msn. Make the field exactly like msn's, just that the name is xfire. (i used phpmyadmin, due to novice sql skills, so it should be in install script, if one doesn't exist.)

in profile.php, it's also almost the copy of msn's, has one language variable.

Line 868:

$form = extract_elements(array('realname', 'url', 'location', 'jabber', 'icq', 'msn', 'aim', 'yahoo','xfire'));

so this array needs xfire.

below lines 1344-1345 are exact copies of msn (which are the named lines), with difference that they are named to xfire.
the same applies to lines 1555-1556

At the form (which is somewhere at the beginning of #1800 lines), there should be the input sizes size="20" maxlength="30" so it looks small, like aim and yahoo.

i thought the xfire username should be linked as http://www.xfire.com/profile/USERNAME and after that there is a link, which links as a friend. So we take advantage of xfire's own url protocol (xfire:add_friend?user=USERNAME). so, let's say it looks like this:

Xfire: username (Add as a friend)

unfortunately in this example the xfire's own protocol is being parsed differently by forum right now. The word Xfire doesn't require language string, because it's a name. Add as a friend phrase might need one.

In topics, below posts count (at poster's info). There's a simple Xfire: username
So people will see it.

and please, let's don't add uninstallation script (aka removal of the field in sql).

Re: The making process of Xfire IM support extension

A great place to start is http://fluxbb.org/wiki/v1.3:developing_extensions, then I'd recommend reading other extension's code to familiarize yourself with the extension system.

Re: The making process of Xfire IM support extension

I'm done. Thanks for the link! I'll release this extension later, it needs still an installation script and some formatting of the code. Technically it works.

Re: The making process of Xfire IM support extension

Cool.

5 (edited by ingram 2009-02-13 11:21)

Re: The making process of Xfire IM support extension

but is there any solution to the line

$form = extract_elements(array('realname', 'url', 'location', 'jabber', 'icq', 'msn', 'aim', 'yahoo','xfire'));

so that i don't have to write the whole array to extension, so it adds just 'xfire' instead?

Re: The making process of Xfire IM support extension

If you don't want to overwrite the array, you can just use something like this

$form['xfire'] = $_POST['form']['xfire'];

Re: The making process of Xfire IM support extension

Thanks, Slavok.

my last question before releasing is the matter of licence, should I use any, if yes, which, how should I include it to the extension file?