Extension:ICQ

From MediaWiki.org
Jump to: navigation, search
MediaWiki extensions manual - list
Crystal Clear action run.png
ICQ Button

Release status: stable

Implementation Tag, MyWiki
Description Render ICQ Button showing users online status
Last version 1.0 (11-05-2006)
MediaWiki 1.5. X
License No license specified
Download see below
Hooks used
ParserFirstCallInit
Check usage and version matrix

This is the simplest extension ever.... but it works ;) It will give out your current ICQ-Status in a small graphic and a Link to your Web-Profile.

The $img=21 in the url sets the type of image...ICQ has prepared some real ugly ones. I think number 21 fits best. Example

<?php
# Usage: <icq>your UIN</icq>
# save it in your extensions-folder
# include("extensions/icq.php");

$wgHooks['ParserFirstCallInit'][] = "wfICQStatus";
function wfICQStatus( $parser ) {
        $parser->setHook( "icq", "ICQfunction" );
        return true;
}
 
 
function ICQfunction( $input, $argv ) {
        if ( !is_numeric( $input ) )
                return "";
 
        $output = "<a href=\"http://www.icq.com/people/about_me.php?uin=$input\"><img  src=\"http://status.icq.com/online.gif?icq=$input&img=21\"></a>";
 
        return $output;
}

Contents

ICQ Status [edit]

Please Upgrade to 1.0a or above from all version to prevent a XSS attack

The ICQ Button rendered inside MediaWiki

syntax
"<icq style="style" action="action">ICQ number</icq>"
ICQ Privacy
To enable your status to be shown online please select
Main->Preferences->General there is a button called "Allow others to view my Online/Offline status from the Web". Enable it

Use Extension talk:ICQ for feedback

<?php
 
// MediaWiki ICQ Extension Ver 1.0a (http://www.mediawiki.org/wiki/Extension:ICQ)
 
// set up MediaWiki to react to the "<icq>" tag
$wgHooks['ParserFirstCallInit'][] = "wfICQ";
 
function wfICQ( $parser ) {
        $parser->setHook( "icq", "RenderICQ" );
        return true;
}
 
 
// the function that reacts to "<icq>"
 
function RenderICQ( $input, $argv ) {
 
// set your defaults for the style and action (0 to 26) (add)
 
        $style_default = "1" ;
        $action_default = "add" ;
 
// the varibles are: <icq style="$argv['style']" action="$argv['action']">$input</icq>
 
// escape $input to prevent XSS
        $input = htmlspecialchars($input) ;
 
// test to see if the optinal elements of the tags are set and supported. if not set them to the defaults
 
        if( isset( $argv['style'] ) ){
                $style = $argv['style'] ;
                if( !($style >= "0" AND $style <= "26") ){
                        $style = $style_default ;
                }
        } else {
                $style = $style_default ;
        }
 
        if( isset( $argv['action'] ) ){
                $action = $argv['action'] ;
                if( !($action == "add") ){
                        $action = $action_default ;
                }
        } else {
                $action = $action_default ;
        }
 
// set the url to the image and the style of the image
 
$image = '<img src="http://web.icq.com/whitepages/online?icq='.$input.'&img='.$style.'"> ' ;
 
 
// start the rendering the html outupt
 
     $output  = '<!-- MediaWiki extension http://www.mediawiki.org/wiki/Extension:ICQ -->';
     $output .= '<a href="http://www.icq.com/people/about_me.php?uin='.$input.'&action='.$action.'">'.$image.'</a>';
     $output .= '<!-- end of ICQ button -->';
 
// send the output to MediaWiki
     return $output;
}

Installation [edit]

  1. Copy the code into a file (e.g. icq.php)
  2. Save the file in the extensions directory of your mediawiki folder
  3. Add the line include('extensions/icq.php'); to the end of your LocalSettings.php file

Now you can use the extension with <icq>ICQ number</icq> in the wiki

Example [edit]

See an example of this add-on in action at: Syncleus Technology Wiki (both run by the author of the AIM extension)

Related extensions [edit]

Chat Extensions AIM · ICQ · IM Status · Jabber · Skype · Yahoo