This is the interface between a protocol (twisted.words, TOC, etc.) and
InstanceMessenger.
It is now event-based, so all the commands are prefixed with event_ so
that InstanceMessenger know they are bound to UI events.
Events that the UI should trigger, and their keys, are:
receiveContactList: contacts
receiveDirectMessage: user, message
statusChanged: contact, status
nameChanged: contact, name
joinedGroup: group
leftGroup: group
receiveGroupMembers: group, members
receiveGroupMessage, group, member, message
memberJoined: group, member
memberLeft: group, member
other events may be called, but they may not be implemented by GUIs
Methods
|
|
|
|
__init__
|
__init__ ( self )
Initalize the Gateway instance.
|
|
attachIM
|
attachIM ( self, im )
Attach an InstanceMessanger to this gateway.
im := the InstanceMessanger to attach to (class InstanceMessanger)
|
|
detachIM
|
detachIM ( self )
Detach an InstanceMessanger from this gateway.
im := the InstanceMessanger to attach from (class InstanceMessanger)
|
|
event_addContact
|
event_addContact ( self, contact )
add the given contact to the users contact list.
contact := the username to add to the contact list
|
|
event_changeStatus
|
event_changeStatus ( self, status )
change the status for the user.
newStatus := string for the new status (currently, one of: )
["Online","Offline","Away"]
|
|
event_directMessage
|
event_directMessage (
self,
user,
message,
)
send a direct message to recipientName.
recipientName := the user to send the message to
message := the message to send them
|
|
event_getGroupMembers
|
event_getGroupMembers ( self, group )
ask for the members of a group we are in.
group := the name of the group we want the members for
|
|
event_groupMessage
|
event_groupMessage (
self,
group,
message,
)
send a message to the group groupName.
groupName := the group to send the message to
message := the message to send
|
|
event_joinGroup
|
event_joinGroup ( self, group )
join a group.
if this method returns true, we are already in the group, and shouldn't
recreate the window.
group := the name of the group to join
|
|
event_leaveGroup
|
event_leaveGroup ( self, group )
leave a group.
group := the name of the group to leave
|
|
event_removeContact
|
event_removeContact ( self, contact )
remove the given contact from the users contact list.
contact := the username to remove from the contact list
|
|
joinedGroup
|
joinedGroup ( self, group )
|
|
leftGroup
|
leftGroup ( self, group )
|
|
memberJoined
|
memberJoined (
self,
member,
group,
)
called when a member joins a group we are in.
member := the member who joined
group := the group they joined
|
|
memberLeft
|
memberLeft (
self,
member,
group,
)
called when a member leaves a group we are in.
member := the member who left
group := the group they left
|
|
notifyNameChanged
|
notifyNameChanged (
self,
contact,
newName,
)
called when the nickname of a contact we're observing (on contact list,
in chat room, direct message) changes their name. we get one of these
as well if we change our nickname.
contact := the /old/ contact name (string)
newName := the new contact name (string)
|
|
notifyStatusChanged
|
notifyStatusChanged (
self,
contact,
newStatus,
)
called when the status of a user on our contact list changes.
contact := the user whos status changed
newStatus := their current status, one of ["Online","Offline","Away"]
|
|
receiveContactList
|
receiveContactList ( self, contacts )
called when the contact list is received.
contacts := a list of the contacts on the contact list
|
|
receiveDirectMessage
|
receiveDirectMessage (
self,
sender,
message,
)
called when someone sends us a message.
sender := the user who sent the message
message := the actual message
|
|
receiveGroupEmote
|
receiveGroupEmote (
self,
member,
group,
emote,
)
called when a emote is sent to the group.
member := the user who sent the message
group := the group the message was sent to
emote := the actual emote
|
|
receiveGroupMembers
|
receiveGroupMembers (
self,
members,
group,
)
called when we receive the members for a group.
members := a list of users in the group
group := the name of the group
|
|
receiveGroupMessage
|
receiveGroupMessage (
self,
member,
group,
message,
)
called when a message is sent to the group.
member := the user who sent the message
group := the group the message was sent to
message := the actual message
|
|