Extension:OICQ

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

Release status: stable

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

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.

Contents

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 AIM · ICQ · IM Status · Jabber · Skype · Yahoo