Class AjaxIM
In: lib/ajaxim.rb
Parent: Object

Main class that takes responsibility for processing client queries and generating responces.

Methods

isuser   joinroom   leaveroom   login   new   ping   pingroom   send   update_status  

Attributes

user  [R] 

Public Class methods

  • db - existing database object
  • from - user who sent request
  • tid - session
  • recipient - destination user
  • message - message string

Public Instance methods

verifing user status for recipient

joining room

  • room - the room name to join

leaving room

  • room - the room name to leave

loading user status/online and offline buddies/list of the user chatrooms/list of available chatrooms by criteria

ping the server since the server cannot contact the client, the client must ping the server for new msgs

  • new_user_status - on ping user status
  • new_user_status_msg - on ping user status msg

special ping type that returns list of active rooms by criteria is implemented to minimize server load

sending a message

  • params is a hash of message parameters: font, etc.

in this method @recipient can be either user name, or room name

updates status of users and autologout

[Validate]