PDA

View Full Version : adding xfire


syndicate
02-17-2005, 10:00 PM
i've seen a number of calls for the addition of xfire to the postbit alongside the other four major IM services, and i wanted it myself.

result: a quick template hack. this will get you a nice little icon on that row in postbit, linking to the user's xfire profile (i couldn't find a send-message protocol).

step 1: go to admin panel, create a new one-line editable profile entry for the xfire username.

step 2: note the name of the field you've created (mine's field5, for example). i'll use fieldX in place of that value, you'll need to replace it with your own (in two places. lines 1 and 2 of my code)

step 3: open postbit (or postbit legacy, woo) template.

find:

<div>$post[icqicon] $post[aimicon] $post[msnicon] $post[yahooicon]


after, add:

<if condition="$post['fieldX']">
<a href="http://www.xfire.com/xf/modules.php?name=XFire&file=profile&uname=$userinfo[fieldX]" target="_blank"><img src="$stylevar[imgdir_misc]/im_xfire.png" alt="<phrase 1="$userinfo[username]">$vbphrase[view_xfire_profile]</phrase>" border="0" /></a>
</if>

important note: make sure you add it before the following </div> tags.


i won't provide you with my image, because i'm hazy on copyright/trademark laws regarding that kind of thing... but you make your own by using the ICO plugin from http://www.telegraphix.com.au and simply pulling the xfire program icon into photoshop.
name it im_xfire.png and upload it to forum/images/misc/

demo: i have this all installed on my own board, of course, at http://comms.planetsidesyndicate.com

comments, suggestions, improvements, optimizations, ... heck, anything you say is welcome. hope this helps somebody.

-martyr

Creed
02-21-2005, 02:50 AM
To have this show up in a user's profile, do this:
(make sure to replace fieldx with the field number that you created for xFire username)

In MEMBERINFO template find:
<if condition="$vboptions['usereferrer']">

Add above:
<!-- [Xfire Hack ] -->
<if condition="$userinfo['fieldx']">
<fieldset class="fieldset">
<legend>xFire Info</legend>
<div class="fieldset">
<div style="padding:$stylevar[formspacer]px">
<a href="http://profile.xfire.com/$userinfo[fieldx]"><img src="http://miniprofile.xfire.com/$userinfo[fieldx].png" border="0"></a>

</div>
</div>
</fieldset>
</if>
<!-- [end Xfire Hack ] -->

jr1001
06-28-2005, 01:24 PM
is there a way to add the xfire IM logo into the User Profile Contact Info block? I tried the hack applied in the first post above and that's not working. See my example:

http://www.doomsdaywarriors.com/images/xfire_profile.jpg

Dan
06-28-2005, 02:25 PM
Search for this phrase $vbphrase[instant_messaging] in the getinfo and you could move it there. I do suggest you use the small one instead of the normal big one.

jr1001
06-28-2005, 03:11 PM
That worked great! Thanks! :)

Only problem now is - the link only takes you to the XFIRE public profile page, rather than open a popup that allows you to IM or add this user from within vB - like you can with the other IM clients.

Can someone coding experience and some spare time create a quick IM_XFIRE and IM_SEND_XFIRE template? ;)

How much of this code is IM client specific? Could I just duplicate and rename one of the existing templates for XFIRE?

Dan
06-28-2005, 03:22 PM
That worked great! Thanks! :)

Only problem now is - the link only takes you to the XFIRE public profile page, rather than open a popup that allows you to IM or add this user from within vB - like you can with the other IM clients.

Can someone coding experience and some spare time create a quick IM_XFIRE and IM_SEND_XFIRE template? ;)

How much of this code is IM client specific? Could I just duplicate and rename one of the existing templates for XFIRE?
I don't think that it is possible to do that, might want to ask around over at xfire.com to see if there is any web interface for it.

jr1001
06-30-2005, 08:16 PM
Making progress...

I am working with an XFIRE modder (gammast) who wrote a XFIRE PLUS module that will allow people to add people to their buddy list via:

xfireb://<nickname>

The plugin works great - so here's what I want to do:

1) Use the add buddy feature provided by this plugin and
2) drop the messaging feature and offer a download link for this plugin instead

Here's what I've done so far:

took a copy of the im_aim template, made a new template called im_xfire and modified the code as follows:

<a href="#" onclick="return imwindow('xfire', '$userinfo[userid]', 400, 200)"><img src="$stylevar[imgdir_misc]/im_xfire.gif" alt="<phrase 1="$userinfo[username]">$vbphrase[send_message_via_xfire_to_x]</phrase>" border="0" /></a>

Then I took the im_send_aim template, copied and made a im_send_xfire template, and modified the code as follows:

<table class="tborder" cellpadding="$stylevar[cellpadding]" cellspacing="$stylevar[cellspacing]" border="0" width="100%" align="center">
<tr>
<td class="tcat">
<span class="smallfont" style="float:$stylevar[right]"><a href="#" onclick="self.close()">$vbphrase[close_this_window]</a></span>
$vbphrase[field5]
</td>
</tr>
<tr>
<td class="panelsurround" align="center">
<div class="panel">
<div align="$stylevar[left]">
<div class="fieldset">
<phrase 1="member.php?$session[sessionurl]u=$userinfo[userid]" 2="$userinfo[username]">$vbphrase[send_message_via_xfire_to_x_link]</phrase> (<strong>$userinfo[field5]</strong>)
</div>
<div class="fieldset"><a href="xfireb://$userinfo[field5]"><phrase 1="$userinfo[field5]">$vbphrase[add_x_to_your_contact_list]</phrase></a></div>
<div align="center">Click <a href="http://www.doomsdaywarriors.com/downloads/XfireBInstall.exe">here</a> to install the XFIRE Plus module needed to add buddies via a web interface.</div>
<div class="fieldset">
$vbphrase[these_functions_require_xfire]
</div>
</div>
</div>
</td>
</tr>
</table>

Then I went into the MEMBERINFO template and changed the code as follows:

from:

<fieldset class="fieldset">
<legend>$vbphrase[instant_messaging]</legend>
<table cellpadding="0" cellspacing="$stylevar[formspacer]" border="0">
<if condition="$userinfo['showicq']">
<tr>
<td>$userinfo[icqicon]</td>
<td><a href="#" onclick="return imwindow('icq', '$userinfo[userid]', 500, 450)">$userinfo[icq]</a></td>
</tr>
</if>
<if condition="$userinfo['showaim']">
<tr>
<td>$userinfo[aimicon]</td>
<td><a href="#" onclick="return imwindow('aim', '$userinfo[userid]', 400, 200)">$userinfo[aim]</a></td>
</tr>
</if>
<if condition="$userinfo['showmsn']">
<tr>
<td>$userinfo[msnicon]</td>
<td><a href="#" onclick="return imwindow('msn', '$userinfo[userid]', 400, 200)">$userinfo[msn]</a></td>
</tr>
</if>
<if condition="$userinfo['showyahoo']">
<tr>
<td>$userinfo[yahooicon]</td>
<td><a href="#" onclick="return imwindow('yahoo', '$userinfo[userid]', 400, 200)">$userinfo[yahoo]</a></td>
</tr>
</if>
<if condition="$post['field5']">
<tr>
<td><img src="$stylevar[imgdir_misc]/im_xfire.gif" alt="<phrase 1="$userinfo[username]">$vbphrase[view_xfire_profile]</phrase>" border="0" /></td>
<td><a href="http://www.xfire.com/xf/modules.php?name=XFire&file=profile&uname=$userinfo[field5]" target="_blank">$userinfo[field5]</a></td>
</tr>
</if>
</table>
</fieldset>

to:

<fieldset class="fieldset">
<legend>$vbphrase[instant_messaging]</legend>
<table cellpadding="0" cellspacing="$stylevar[formspacer]" border="0">
<if condition="$userinfo['showicq']">
<tr>
<td>$userinfo[icqicon]</td>
<td><a href="#" onclick="return imwindow('icq', '$userinfo[userid]', 500, 450)">$userinfo[icq]</a></td>
</tr>
</if>
<if condition="$userinfo['showaim']">
<tr>
<td>$userinfo[aimicon]</td>
<td><a href="#" onclick="return imwindow('aim', '$userinfo[userid]', 400, 200)">$userinfo[aim]</a></td>
</tr>
</if>
<if condition="$userinfo['showmsn']">
<tr>
<td>$userinfo[msnicon]</td>
<td><a href="#" onclick="return imwindow('msn', '$userinfo[userid]', 400, 200)">$userinfo[msn]</a></td>
</tr>
</if>
<if condition="$userinfo['showyahoo']">
<tr>
<td>$userinfo[yahooicon]</td>
<td><a href="#" onclick="return imwindow('yahoo', '$userinfo[userid]', 400, 200)">$userinfo[yahoo]</a></td>
</tr>
</if>
<if condition="$post['field5']">
<tr>
<td><img src="$stylevar[imgdir_misc]/im_xfire.gif" alt="<phrase 1="$userinfo[username]">$vbphrase[view_xfire_profile]</phrase>" border="0" /></td>
<td><a href="#" onclick="return imwindow('xfire', '$userinfo[userid]', 400, 200)">$userinfo[field5]</a></td>
</tr>
</if>
</table>
</fieldset>

Problem:

all looks good - but it does not seem to use the im_xfire or im_send_xfire templates like I planned. Instead it pulls up a MSN popup window.

Where do I need to add a template for this new XFIRE popup?

update:

found some arrary entries I needed to add in /forums/sendmessage.php and /forums/online.php where I needed to insert im_xfire and im_send_xfire - but I still can't get it to pull up the proper XFIRE popup....

update2:

did a search for all the im_aim references in the vB build using textpad and found these results:

announcement.php(34): 'im_aim',
member.php(37): 'im_aim',
memberlist.php(40): 'im_aim',
online.php(34): 'im_aim',
private.php(55): 'im_aim',
showpost.php(34): 'im_aim',
showthread.php(37): 'im_aim',
usernote.php(39): 'im_aim',
includes\functions_showthread.php(47): eval('$userinfo[\'aimicon\'] = "' . fetch_template('im_aim') . '";');

in these files I added a

'im_xfire',

entry into all the pages that had arrays defined for the im_xxx templates

the only one that gave me trouble was the one in the includes folder (functions_showthread.php)

Here is is listing entries for each IM - using AIM as an example:

if ($userinfo['aim'] != '' AND ($vboptions['showimicons'] OR $ignore_off_setting))
{
eval('$userinfo[\'aimicon\'] = "' . fetch_template('im_aim') . '";');
$userinfo['showaim'] = true;
$show['hasimicons'] = true;
}
else
{
$userinfo['aimicon'] = '';
$userinfo['showaim'] = false;
}

So I entered a couple of lines after the AIM entry and added this:

if ($userinfo['field5'] != '' AND ($vboptions['showimicons'] OR $ignore_off_setting))
{
eval('$userinfo[\'xfireicon\'] = "' . fetch_template('im_xfire') . '";');
$show['hasimicons'] = true;
}

leaving out the

$userinfo['field5'] = true;

line since it changed my field5 value to "1" since it was "true"

I'm not very good at php coding - what should this be changed to so it fetches the im_xfire template properly? All it really needs to do is check for a field5 value and if its present, fetch the template right?

Creed
07-02-2005, 03:55 AM
I have found where you need to make changes for this to work :)

In sendmessage.php you added the array, but you didn't add the case to tell it what to do when it requests an IM to 'xfire' and thus it defaults to MSN.


// ############################### start im message ###############################
if ($_REQUEST['do'] == 'im')
{
globalize ($_REQUEST, array('type', 'userid' => INT));

// verify userid
$userinfo = verify_id('user', $userid, 1, 1, 15);

switch ($type)
{
case 'aim':
case 'yahoo':
$userinfo["{$type}_link"] = urlencode($userinfo["$type"]);
break;
case 'icq':
$userinfo['icq'] = trim(htmlspecialchars_uni($userinfo['icq']));
break;
default:
$type = 'msn';
break;
}

if (empty($userinfo["$type"]))
{
// user does not have this messaging meduim defined
eval(print_standard_error('error_immethodnotdefine d'));
}

// shouldn't be a problem hard-coding this text, as they are all commercial names
$typetext = array(
'msn' => 'MSN',
'icq' => 'ICQ',
'aim' => 'AIM',
'yahoo' => 'Yahoo!'
);

$typetext = $typetext["$type"];

eval('$imtext = "' . fetch_template('im_send_' . $type) . '";');

eval('print_output("' . fetch_template('im_message') . '");');

}


There is where you need to add the case to tell it what to do when you send an xfire IM, or in your case simply click the link. All you should have to do is right under:

case 'aim':

add:

case 'xfire':

and all things should work out your way :D

jr1001
07-02-2005, 04:58 PM
Hey thanks - that took me another step closer. But the puzzle isn't quite complete yet. Now when I click the xfire link, the popup brings up a vBulletin message that states:

<username> has not specified contact details for this medium.

Any idea where those need to be "specifed"? I'm almost convinced that this has something directly to do with how the template is supposed to be called in the

/forums/includes/functions_showthread.php file (see my update2 post above).

Also - where is the language.xml file stored? I can't seem to find it...

MoJo Smirnoff
09-13-2005, 02:49 AM
Search for this phrase $vbphrase[instant_messaging] in the getinfo and you could move it there. I do suggest you use the small one instead of the normal big one.

great hack first of all!

To get the X logo with the rest of the messenging icons what exactly do you put where? I'm not the best with this stuff, but i did manage to get everything done from post 1!! Would be nice to have it in the Instant Messaging area too.

Thanks!