home
|
Login
Online users
|
IntroductionTo seperate gui and protocol, and to abstract things it is necessary that the model(protocol) has no knowledge of the gui. But if this is so, how can the model notify the gui of things that happened? This is where events come in. When something happens (a contact comes online) the model handles everything, and it fires an event (contactChangeState for example). That is all it does, it never has to call a proc in the gui namespace. This way, it is fairly easy to change the whole gui without changing a single bit in the model.Now the gui, who has registered itself to listen to certain events from certain sources, has in this case registered itself to listen to contactChangeState events from all sources. So when the event is fired, the contactChangeState proc of the gui will be called with the appropriate arguments. It can then use it to update the display. The GUI on the other hand does have to know the model, but this is not a problem. There just has to be a good API, that we won't change too much. Also, you can create another model (like lets say a jabber one, wich has the same api, so it can be used by the gui. contactlistLoadedThis event is called when the initial contact list is loaded. It can happen that is finished downloading from the server or that it is loaded from the hard-disk.contactDataChange (user_login)When a visual data has changed. We should redraw the contact list.groupAdded (Group_ID)A group is succesfully added.groupDeleted (Group_ID)A group is successfully deletedgroupRenamed (Group_ID, Group_Name)A group is successfuly renamedcontactAdded (user_login, New_Group_ID)A contact is succesfully added.loggedOut ()We're successfully logged out.myNickChange ()Our nickname has changedcontactNickChange (user_login)The nick of a contact has changedcontactBlocked (user_login)A contact is blockedcontactUnBlocked (user_login)A contact is unblockedcontactMoved (user_login, Old_Group_ID?, New_Group_ID)A contact is moved from an Old_Group_ID? to New_Group)contactRemoved (user_login, Group_ID)A contact is removed from Group_IDcontactChangeState ( ...)contactPSMChange (user_login)messageReceivedloggedInThose following events are not yet coded: groupAddFailedA group failed to be addedgroupDeleteFailedA group failed to be deleted (eg group isnt empty)groupRenameFailedA group failde to be renamedcontactDeletedA contact was successfully deletedcontactDeleteFailedA contact failed to be deleted (eg it doesn't exist anyway)contactAddFailedA contact failed to be added (eg it's already in the group)contactBlockedA contact was successfully added to the BLcontactBlockFailedA contact failed to be added to the BL (eg it doesn't exist)contactCopiedTocontactCopyFailedcontactMovedTocontactMoveFailedcontactChangeStatecontactChangeNickcontactChangePSMcontactChangeMusicCreated by: tjikkun last modification: Sunday 09 of July, 2006 [20:34:25 UTC] by billiob |