jerklib.util
Class NickServAuthPlugin

java.lang.Object
  extended by jerklib.tasks.TaskImpl
      extended by jerklib.util.NickServAuthPlugin
All Implemented Interfaces:
IRCEventListener, Task

public class NickServAuthPlugin
extends TaskImpl

A Task to identify with NickServ and then join a list of channels names. Once the Task has succsessfully identifed with NickServ TaskCompletion Listeners will be notified with a true Boolean object.

If 40 seconds passes and the mode event to indicate ident success has not been received, TaskCompletion Listeners will be notified with a false Boolean object.

This plugin assumes Nickserv responds to the following syntax

"identify password"

To cancel this Task call cancel()

To Use This Task: You must use onEvent(Task , Type ... type) to add the Task You must pass Type.CONNECT_COMPLETE and Type.MODE_EVENT. Example of adding the Task:

session.onEvent(auth, Type.CONNECT_COMPLETE , Type.MODE_EVENT);

Example Code:

           
                final NickServAuthPlugin auth = new NickServAuthPlugin
                (
                        "letmein", //password
                        'e', //mode char that indicates success
                        session, //session
                        Arrays.asList("#jerklib" , "##swing") // list of channels to join on success
                );

                auth.addTaskListener(new TaskCompletionListener()
                {
                        public void taskComplete(Object result)
                        {
                                if(result.equals(new Boolean(false)))
                                {
                                        conman.quit();
                                }
                                else
                                {
                                        System.out.println("Authed!");
                                }
                        }
                });

                session.onEvent(auth, Type.CONNECT_COMPLETE , Type.MODE_EVENT);

Author:
mohadib
See Also:
Session.onEvent(jerklib.tasks.Task, jerklib.events.IRCEvent.Type...), IRCEvent.Type

Constructor Summary
NickServAuthPlugin(String pass, char identMode, Session session, List<String> channels)
           
 
Method Summary
 void receiveEvent(IRCEvent e)
          recieveEvent() - receive IRCEvents
 
Methods inherited from class jerklib.tasks.TaskImpl
addTaskListener, cancel, getName, getTaskListeners, isCanceled, removeTaskListener
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NickServAuthPlugin

public NickServAuthPlugin(String pass,
                          char identMode,
                          Session session,
                          List<String> channels)
Parameters:
pass - - nickserv password
identMode - - mode that indicates ident success
session - - Session this Task is attatched to
channels - - A list of channel names to join on ident success
Method Detail

receiveEvent

public void receiveEvent(IRCEvent e)
Description copied from interface: IRCEventListener
recieveEvent() - receive IRCEvents

Parameters:
e - IRCEvent the event