Extension:OICQ

From MediaWiki.org
Jump to: navigation, search
MediaWiki extensions manualManual:Extensions
Crystal Clear action run.png
OICQ Button

Release status:Extension status stable

ImplementationTemplate:Extension#type Tag, MyWiki
DescriptionTemplate:Extension#description Render OICQ Button showing users online status
Latest versionTemplate:Extension#version 1.0 (11-05-2012)
MediaWikiTemplate:Extension#mediawiki 1.5. X
LicenseTemplate:Extension#license No license specified
Download see below
Hooks usedTemplate:Extension#hook
ParserFirstCallInitManual:Hooks/ParserFirstCallInit

Translate the OICQ extension if it is available at translatewiki.net

Check usage and version matrix.

This is based on the ICQ extension. It will give out a nickname and your current OICQ-Status in a small graphic.

The style="20" in the url sets the type of image...if the number is not provided by OICQ, then it will default to 1.

The exe="QQ" in the url sets the exe to launch, availilbe values are "QQ" and "TM"

The site="Tecent" in the url set the site name.

The menu="no" does not open recent users dialog.

The nick="your nick name" sets the nickname to be displayed before the OICQ-status icon.

OICQ Status[edit]

The OICQ Button rendered inside MediaWiki

syntax
"<oicq style="20" exe="QQ" site="Tecent" menu="no" nick="your nick name">your oicq number</oicq>"

Use Extension talk:OICQ for feedback

<?php
 
// MediaWiki OICQ Extension Ver 1.0a (http://www.mediawiki.org/wiki/Extension:OICQ)
 
// set up MediaWiki to react to the "<oicq>" tag
$wgHooks['ParserFirstCallInit'][] = "wfOICQ";
 
function wfOICQ( $parser ) {
        $parser->setHook( "oicq", "RenderOICQ" );
        return true;
}
 
 
// the function that reacts to "<oicq>"
 
function RenderOICQ( $input, $argv ) {
 
// set your defaults for the style and action (0 to 26) (add)
 
        global $wgSitename ;

        $style_default = "1" ;
        $exe_default = "QQ" ;
        $site_default = $wgSitename ;
        $menu_default = "No" ;
 
// the varibles are: <oicq style="$argv['style']" exe="$argv['exe']"
// site="$argv['site']" menu="$argv['menu']" nick="$argv['nick']">$input</oicq>
 
// escape $input to prevent XSS
        $input = htmlspecialchars($input) ;

        $nick_default = $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 >= "1" AND $style <= "17") AND $style != "20" AND $style != "41" ){
                        $style = $style_default ;
                }
        } else {
                $style = $style_default ;
        }
 
        if( isset( $argv['exe'] ) ){
                $exe = $argv['exe'] ;
                if( !($exe == "TM") ){
                        $exe = $exe_default ;
                }
        } else {
                $exe = $exe_default ;
        }

        if( isset( $argv['site'] ) ){
                $site = $argv['site'] ;
        } else {
                $site = $site_default ;
        }
 
        if( isset( $argv['menu'] ) ){
                $menu = $argv['menu'] ;
                if( !($menu == "Yes") ){
                        $menu = $menu_default ;
                }
        } else {
                $menu = $menu_default ;
        }

        if( isset( $argv['nick'] ) ){
                $nick = $argv['nick'] ;
        } else {
                $nick = $nick_default ;
        }

// set the url to the image and the style of the image
 
$image = '<img src="http://wpa.qq.com/pa?p=1:'.$input.':'.$style.'"> ' ;
 
 
// start the rendering the html outupt
 
     $output  = '<!-- MediaWiki extension http://www.mediawiki.org/wiki/Extension:OICQ -->';
     $output .= $nick.'<a href="http://wpa.qq.com/msgrd?V=1&Uin='.$input.'&Exe='.$exe.'&Site='.$site.'&Menu='.$menu.'">'.$image.'</a>';
     $output .= '<!-- end of OICQ button -->';
 
// send the output to MediaWiki
     return $output;
}

Installation[edit]

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

Now you can use the extension with <oicq>OICQ number</oicq> in the wiki

Example[edit]

Related extensions[edit]

Chat Extensions AIMExtension:AIM · ICQExtension:ICQ · IM StatusExtension:IM Status · JabberExtension:Jabber · SkypeExtension:Skype · YahooExtension:Yahoo