Tag Archives: IM Plugin

I Have an IM Agent

In previous post, we introduced izuz.net’s web IM plugin development. And I developed an IM agent robot plugin. So I have an IM agent robot now!

About a year ago, I wrote a post “Everyone Has a Robot” on my blog, saying:

I have a dream that everyone has a robot for him/her on the Internet.

It seems that dream is coming to the edge of true. At least everyone would have her/his IM agent robot if s/he would like to use izuz.net’s web IM services.

And here was a conversation from my robot with someone. Enjoy the conversation (It seems that my agent robot does not understand “thanks”):

[17:6 on Tuesday] java2script.demo@gmail.com : ( talking to you through http://izuz.net/ web IM )
hi

(17:6 on Tuesday) me : [Zhou Renjian’s robot agent speaking] hello
[17:6 on Tuesday] java2script.demo@gmail.com : how r u?
(17:6 on Tuesday) me : [Zhou Renjian’s robot agent speaking] fine, thanks
[17:6 on Tuesday] java2script.demo@gmail.com : r u an agent?
(17:6 on Tuesday) me : [Zhou Renjian’s robot agent speaking] how about google it
[17:6 on Tuesday] java2script.demo@gmail.com : ok
(17:6 on Tuesday) me : [Zhou Renjian’s robot agent speaking] enjoy your web IMs
[17:6 on Tuesday] java2script.demo@gmail.com : thanks
(17:6 on Tuesday) me : [Zhou Renjian’s robot agent speaking] oops, add zhourenjian to your friend list for further information
[17:6 on Tuesday] java2script.demo@gmail.com : ok
(17:6 on Tuesday) me : [Zhou Renjian’s robot agent speaking] enjoy your web IMs

If you want to take a try on this agent robot, paste

javascript:ClazzLoader.loadClass(‘net.izuz.gtalk.DemoRobot’,function(){net.izuz.gtalk.DemoRobot.main([]);})

to address bar and press <Enter>.

And then login using demo accounts ( java2script.demo for example). And then add yourself to the demo account’s friend list and talk to yourself. You will get your agent robot’s response. The agent robot only responses to demo accounts automatically without telling you. Your friends’ messages will always bring up chatting dialogs for you.

Enjoy web IM plugins.

P.S. (Oct 22, 2008) I am always enjoying my IM agent robot. 😀

[10:26 on Wednesday] java2script.talk@gmail.com : ( talking to you through http://izuz.net/ web IM )
hi ..

(10:26 on Wednesday) me : [Zhou Renjian’s robot agent speaking] hello
[10:26 on Wednesday] java2script.talk@gmail.com : how r u…
(10:26 on Wednesday) me : [Zhou Renjian’s robot agent speaking] fine, thanks
[10:26 on Wednesday] java2script.talk@gmail.com : u r from which country??
(10:26 on Wednesday) me : [Zhou Renjian’s robot agent speaking] hello
[10:27 on Wednesday] java2script.talk@gmail.com : hello..
(10:27 on Wednesday) me : [Zhou Renjian’s robot agent speaking] hi
[10:27 on Wednesday] java2script.talk@gmail.com : r u a robot..
(10:27 on Wednesday) me : [Zhou Renjian’s robot agent speaking] how about google it
[10:27 on Wednesday] java2script.talk@gmail.com : r u a ai robot
(10:27 on Wednesday) me : [Zhou Renjian’s robot agent speaking] how about google it
[10:28 on Wednesday] java2script.talk@gmail.com : who are you
(10:28 on Wednesday) me : [Zhou Renjian’s robot agent speaking] oops, add zhourenjian to your friend list for further information
[10:28 on Wednesday] java2script.talk@gmail.com : are you a robot.
(10:28 on Wednesday) me : [Zhou Renjian’s robot agent speaking] oops, add zhourenjian to your friend list for further information
[10:28 on Wednesday] java2script.talk@gmail.com : ok bye.
(10:28 on Wednesday) me : [Zhou Renjian’s robot agent speaking] enjoy your web IMs
[10:29 on Wednesday] java2script.talk@gmail.com : take care
(10:29 on Wednesday) me : [Zhou Renjian’s robot agent speaking] oops, add zhourenjian to your friend list for further information

More…

[Updated 2008-12-12]

[10:03 on Friday] java2script.talk@gmail.com : ( talking to you through http://webuzz.im/ web IM )
who am i?
(10:03 on Friday) me : [Zhou Renjian’s robot agent speaking] oops, add zhourenjian to your friend list for further information
[10:03 on Friday] java2script.talk@gmail.com : who are u?
(10:03 on Friday) me : [Zhou Renjian’s robot agent speaking] oops, add zhourenjian to your friend list for further information
[10:04 on Friday] java2script.talk@gmail.com : who is zhourenjian?
(10:04 on Friday) me : [Zhou Renjian’s robot agent speaking] oops, add zhourenjian to your friend list for further information
[10:04 on Friday] java2script.talk@gmail.com : good morning
(10:04 on Friday) me : [Zhou Renjian’s robot agent speaking] ok
[10:04 on Friday] java2script.talk@gmail.com : you are not very smart
(10:04 on Friday) me : [Zhou Renjian’s robot agent speaking] oops, add zhourenjian to your friend list for further information
[10:04 on Friday] java2script.talk@gmail.com : you are stupid
(10:04 on Friday) me : [Zhou Renjian’s robot agent speaking] oops, add zhourenjian to your friend list for further information
[10:04 on Friday] java2script.talk@gmail.com : ok?
(10:04 on Friday) me : [Zhou Renjian’s robot agent speaking] enjoy your web IMs
[10:04 on Friday] java2script.talk@gmail.com : enjoy
(10:04 on Friday) me : [Zhou Renjian’s robot agent speaking] oops, add zhourenjian to your friend list for further information
[10:04 on Friday] java2script.talk@gmail.com : stupid
(10:04 on Friday) me : [Zhou Renjian’s robot agent speaking] oops, add zhourenjian to your friend list for further information

[12:26 on Friday] java2script.talk@gmail.com : ( talking to you through http://webuzz.im/ web IM )
testing
(12:26 on Friday) me : [Zhou Renjian’s robot agent speaking] ok
[12:26 on Friday] java2script.talk@gmail.com : hii
(12:26 on Friday) me : [Zhou Renjian’s robot agent speaking] hello
[12:26 on Friday] java2script.talk@gmail.com : h r u
(12:26 on Friday) me : [Zhou Renjian’s robot agent speaking] fine, thanks
[12:26 on Friday] java2script.talk@gmail.com : who r u
(12:26 on Friday) me : [Zhou Renjian’s robot agent speaking] how about google it
[12:27 on Friday] java2script.talk@gmail.com : its gr8
(12:27 on Friday) me : [Zhou Renjian’s robot agent speaking] oops, add zhourenjian to your friend list for further information

Posted in Developer | Tagged , , , | 68 Comments

For Developers: Writing IM Plug-ins for izuz.net Web IMs

We are very pleased to annouce our newly IM plugin API for our potential developers.

http://izuz.net/ is providing web IM (instant messenging) services for our users. Currently, the web IM services include web Google Talk (Gtalk), web Windows Live Messenger (MSN), web Yahoo! Messenger (YMsg), AOL Instant Messenger (AIM). More services may be added later.

To illustrate our web IM plugin API, we will develop a plugin to export all contact emails.

The final plugin codes:

javascript:p=new net.izuz.gtalk.MainWindow.IMPluginAdapter();p.dealRoster=function(w, e){log(e.email);return false;}; net.izuz.gtalk.MainWindow.addIMPlugin(p);

How to use this web IM plugin

  1. Logout your web IM
  2. Copy the above line of codes (in fact, it is a link), and paste it into the browser’s address bar and press <Enter> to run the JavaScript code
  3. Login your web IM
  4. After all your contacts are listed, there will be a new link anchor generated inside the page named “Open System Console”. Click it will bring you a window with all your contacts’ email.
    If you can not find the link, copy
    javascript:ClazzLoader.loadClass(‘org.eclipse.swt.widgets.Console’,function(){$wt.widgets.Console.openConsole();});
    And paste it into address bar and <Enter> will also bring you a window with all your contacts’ email.

IM Plugin Development Details

In fact, the above plugin contains following lines:

var plugin = new net.izuz.gtalk.MainWindow.IMPluginAdapter ();
plugin.dealRoster = function (mw, evt) {
log (evt.email);
return false;
};
net.izuz.gtalk.MainWindow.addIMPlugin (plugin);

First, all plugins should be an instance of net.izuz.gtalk.MainWindow.IMPluginAdapter. Here is the its Java source (You are not required as a Java expert. But we think giving its source will help you to get a better understanding) :

public static class IMPluginAdapter implements IMPluginable {
public boolean dealLogin(MainWindow mw, DuplicateLoginEvent dle) {
return false;
}
public boolean dealTyping(MainWindow mw, TypingEvent ts) {
return false;
}
public boolean dealMessage(MainWindow mw, MessageEvent ms) {
return false;
}
public boolean dealRoster(MainWindow mw, RosterEvent rs) {
return false;
}
}

And you can override its methods to fulfill your job. The above plugin overrides its dealRoster method, which is about contacts’ information. To override a method using JavaScript is quite an easy job:

plugin.dealRoster = function (mw, evt) {
log (evt.email);
return false;
};

In the above codes, we use log() method to print email into console window. log() method is provided by Java2Script core library. For more information about Java2Script, please visit http://j2s.sourceforge.net/ .

And finally, you add the plugin to our web IM system by net.izuz.gtalk.MainWindow.addIMPlugin (plugin); And you can remove it later by net.izuz.gtalk.MainWindow.removeIMPlugin(plugin);

More about IMPluginAdapter’s Method

net.izuz.gtalk.MainWindow.IMPluginAdapter.dealLogin(MainWindow, DuplicateLoginEvent)
net.izuz.gtalk.MainWindow.IMPluginAdapter.dealMessage(MainWindow, MessageEvent)
net.izuz.gtalk.MainWindow.IMPluginAdapter.dealRoster(MainWindow, RosterEvent)
net.izuz.gtalk.MainWindow.IMPluginAdapter.dealTyping(MainWindow, TypingEvent)

These methods all have two parameters. The first parameter is the messenger window itself. You can do anything you want by using this MainWindow object. We will provide more information this instance in later articles.

The second parameter is about data passing back from web IM servers. There are four events. Here are their data structures:

iz.z.event.DuplicateLoginEvent
iz.z.event.DuplicateLoginEvent.beQuiet // always be true, if there is such a event

iz.z.event.MessageEvent
iz.z.event.MessageEvent.body // message in plain text
iz.z.event.MessageEvent.from // email of sender
iz.z.event.MessageEvent.thread // an ID to mark the chatting session
iz.z.event.MessageEvent.to // email of receiver

iz.z.event.RosterEvent
iz.z.event.RosterEvent.avatar // user’s avatar picture hash
iz.z.event.RosterEvent.confirmed // already a registered user or not
iz.z.event.RosterEvent.email
iz.z.event.RosterEvent.id
iz.z.event.RosterEvent.mode // available, away, idle, busy, offline
iz.z.event.RosterEvent.name
iz.z.event.RosterEvent.status // customized status message

iz.z.event.TypingEvent
iz.z.event.TypingEvent.from // email of sender
iz.z.event.TypingEvent.typing // is typing or not

So, you already can develop some interesting plug-ins to collect your messages and your contacts information.

We would like to hear your feedback for more APIs.

Posted in Developer | Tagged , , , | 19 Comments