Jquerychat

Summary: Provide a quite simple recipe to add a robust gmail/facebook style chat, with a sql table
Version: 0.1
Prerequisites: PHP 5 (for iterator), and access to a sql database to create a table
Status: alpha
Maintainer: Fran├žois Elie (francois@elie.org
Categories: Uncategorized
Users: (view? / edit)
Discussion: Jquerychat-Talk?

Questions answered by this recipe

How to offer a modern and private chat to the authenticated users of my PmWiki ?

All sections are optional, you can remove those that do not apply to your recipe, and add new ones.

Description

Provide recipe to use a jquery chat into pmwiki.

The jquery chat, by Anant Garg, is a robust system. A js "chat.js" telling messages and events to a chat.php which has to be in the root of the PmWiki. The stream of messages is in a sql table.

I have just wrote a very ugly system to list connected people... and offer a minimal markup (:chats:)

You can see a standalone online demo of this chat system:

Put these urls in three differents browsers: you can chat between them.

http://anantgarg.com/chat/samplea.php
http://anantgarg.com/chat/sampleb.php
http://anantgarg.com/chat/samplec.php

Installation

Intallation of jquerychat

cd pub [of your PmWiki]
sudo wget http://anantgarg.com/wp-content/uploads/2009/05/jquerychat.zip
unzip jquerychat.zip
sudo cp chat/chat.php ..

Create a sql table for the communication stream

CREATE TABLE `chat` (
  `id` INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,
  `from` VARCHAR(255) NOT NULL DEFAULT '',
  `to` VARCHAR(255) NOT NULL DEFAULT '',
  `message` TEXT NOT NULL,
  `sent` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00',
  `recd` INTEGER UNSIGNED NOT NULL DEFAULT 0,
  PRIMARY KEY (`id`),
 INDEX `to` (`to`),
 INDEX `from` (`from`)
)
ENGINE = InnoDB;

Create un loggedin directory

The recipe jquerychat.php uses a 'very ugly' system to know who is connected (if you have a better, tell me!).

You have to create pub/loggedin directory with right to PmWiki to write in it

Installation of jquerychat.php

Download jquerychat.txtΔ in your cookbook directory and rename it jquerychat.php

Tell to PmWiki that you want to use the recipe

Add in your local/config.php the linge

$_SESSION['username']=$Author;
include_once('cookbook/jquerychat.php');
include_once('chat.php');

Configuration

Access to the sql table

You have to tell to chat.php' how to connect to the database to retreive the chat table.

The default nickname in the chat system is $Author but maybe you can change it: jquerychat use $_SESSION['username']

Usage

The recipe provide a very simple markup (:chats:) which provide links to chats with each other connected people.

Notes

Change log / Release notes

If the recipe has multiple releases, then release notes can be placed here. Note that it's often easier for people to work with "release dates" instead of "version numbers".

See also

Contributors

Comments

See discussion at Jquerychat-Talk?

User notes? : If you use, used or reviewed this recipe, you can add your name. These statistics appear in the Cookbook listings and will help newcomers browsing through the wiki.