Go Back   vb.org Archive > vBulletin Article Depository > Read An Article > General Articles
adding xfire
syndicate's Avatar
syndicate
Join Date: Feb 2005
Posts: 7

 

Show Printable Version Email this Page Subscription
syndicate syndicate is offline 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:

HTML Code:
				<div>$post[icqicon] $post[aimicon] $post[msnicon] $post[yahooicon]
after, add:
HTML Code:
<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
Reply With Quote
  #2  
Old 02-21-2005, 02:50 AM
Creed's Avatar
Creed Creed is offline
 
Join Date: May 2002
Location: The Matrix
Posts: 281
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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)

Code:
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 ] -->
Reply With Quote
  #3  
Old 06-28-2005, 01:24 PM
jr1001 jr1001 is offline
 
Join Date: Feb 2005
Posts: 13
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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:

Reply With Quote
  #4  
Old 06-28-2005, 02:25 PM
Dan's Avatar
Dan Dan is offline
 
Join Date: Dec 2002
Location: Titusville, Florida
Posts: 1,787
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
  #5  
Old 06-28-2005, 03:11 PM
jr1001 jr1001 is offline
 
Join Date: Feb 2005
Posts: 13
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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?
Reply With Quote
  #6  
Old 06-28-2005, 03:22 PM
Dan's Avatar
Dan Dan is offline
 
Join Date: Dec 2002
Location: Titusville, Florida
Posts: 1,787
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by jr1001
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.
Reply With Quote
  #7  
Old 06-30-2005, 08:16 PM
jr1001 jr1001 is offline
 
Join Date: Feb 2005
Posts: 13
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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:

Code:
<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:

Code:
<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:

Code:
<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:

Code:
<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:

Code:
	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:

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

Code:
$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?
Reply With Quote
  #8  
Old 07-02-2005, 03:55 AM
Creed's Avatar
Creed Creed is offline
 
Join Date: May 2002
Location: The Matrix
Posts: 281
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.

Code:
// ############################### 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_immethodnotdefined'));
	}

	// 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:
Code:
		case 'aim':
add:
Code:
		case 'xfire':
and all things should work out your way
Reply With Quote
  #9  
Old 07-02-2005, 04:58 PM
jr1001 jr1001 is offline
 
Join Date: Feb 2005
Posts: 13
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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...
Reply With Quote
  #10  
Old 09-13-2005, 02:49 AM
MoJo Smirnoff MoJo Smirnoff is offline
 
Join Date: Sep 2005
Posts: 26
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Dan
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!
Reply With Quote
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 06:25 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.07861 seconds
  • Memory Usage 2,311KB
  • Queries Executed 23 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (11)bbcode_code
  • (2)bbcode_html
  • (2)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_article
  • (1)navbar
  • (4)navbar_link
  • (120)option
  • (10)post_thanks_box
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (10)post_thanks_postbit_info
  • (9)postbit
  • (10)postbit_onlinestatus
  • (10)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete