Abstract baseclass for all protocols.
Abstract baseclass for all protocols. Defines the interface that all protocols should comply with.The various c_* functions are callbacks, override these in a child class if you're interested in the event that happens. Typically, a client will override all of them. For example c_loggedIn() is called as soon as the login process is finished.
The states that the protocol can be in are defined here. The current state the protocol is in is returned by getState().
- Protocol::S_online - Online and connected. Ready to send and recive messages and presence notification
- Protocol::S_connecting - Connection in progress
- Protocol::S_offline - Disconnected.
- Protocol::S_registring - While registering a new account
- Protocol::S_away - When the user is online, but away.
- Protocol::S_getPubKey - When a public rsa key is needed (internal to kit protocol only)
Sometimes everything doesnt go as planned, and a way of reporting error are needed. These are the currently defined protocol errors.When an error occurs, c_error() will be called with the error code (this) and plaintext description of the error.
- Protocol::E_invalidLogin - Either the password or the username was wrong while attempting to log in
- Protocol::E_userTaken - If the user name was already taken while attempting to register a new user
- Protocol::E_network - A Network error
- Protocol::E_success - An error that's no error :)
You call these functions to initiate an event. For example, to send an instant message or to login to the server. Hopefully the names should be descriptive enough for you to figure out what they do. Usually all actions are supported by all protocols with the exception of getPubkey()
These are meant to be overiden in the acctual client to allow the client to recive messages in a systemindependant clean way.
The protocol classes are completely network agnostic - they contain no code to interface with the outside world. This is both to increase portability and flexibility. User interfaces and network code needs to share a common event system, and the protocol can't know in advance how a client may choose to implement the network.
Alphabetic index HTML hierarchy of classes or Java