The main data storage and application controller class.
Field Summary |
||
Access | Data Type | Name |
public | static BOOL | m_bConnectedFlag |
public | bool | m_bIsBlockedUsersListObtained |
public | CPtrList | m_BlockedUsersList |
public | BOOL | m_bLoggedInFlag |
public | CDeleteFriendsDlg * | m_DeleteFriendsDlg |
public | fstream | m_fOfflineMessagesFile |
public | HTREEITEM | m_hFriends |
public | HTREEITEM | m_hOffline |
public | HTREEITEM | m_hOnline |
public | int | m_nNumOffline |
public | int | m_nNumOnline |
public | CPtrList | m_OfflineMessagesList |
public | CAcceptAndAddDlg * | m_pAcceptAndAddDlg |
public | CAddAFriend * | m_pAddAFriendDlg |
public | CString | m_Password |
public | CBlockedUsersListDlg* | m_pBlockedUsersDlg |
public | CChangePassword * | m_pChangePasswordDlg |
public | CMessengerDialog * | m_pMessengerLoginDlg |
public | COfflineMessagesWindow * | m_pOfflineMessagesDlg |
public | CPreferences * | m_pPreferencesDlg |
public | CPreferencesData | m_Preferences |
public | CSpeakWindow * | m_pSpeakDlg |
public | CPtrList | m_SpeakDialogsList |
public | CString | m_UserName |
Constructor Summary |
||
CMessengerClientDoc() |
Destructor Summary |
Field Detail |
m_bConnectedFlag
TRUE when this client is connected to the Chatter-jee Server. FALSE on startup.
m_bIsBlockedUsersListObtained
true when this user has fetched the blocked users' list. false on startup. This is needed to make sure
the user fetches blocked users' list only once.
m_BlockedUsersList
List of all users blocked by this user. Each element of the list points to a Message Packet
object.
m_bLoggedInFlag
Becomes true when the user has completed the Login Process.
m_DeleteFriendsDlg
Pointer to the Delete Friend(s) dialog.
m_fOfflineMessagesFile
Supposed to be used to write Offline messages to file. But not used in this version of Chatter-jee client. Redundent variable.
m_hFriends
Friends List is displayed inside the main Chatter-jee window, in a tree format. This var acts as the root of this tree.
m_hOffline
Friends List is displayed inside the main Chatter-jee window, in a tree format. This var acts as the root of the subtree
which contains names of all offline friends.
m_hOnline
Friends List is displayed inside the main Chatter-jee window, in a tree format. This var acts as the root of the subtree
which contains names of all online friends.
m_nNumOffline
Number of offline users.
m_nNumOnline
Number of online users.
m_OfflineMessagesList
List of all offline messages received by this user on logging in. Each member of the list points to a
Message Packet object.
m_pAcceptAndAddDlg
Pointer to Accept and Add Dialog.
m_pAddAFriendDlg
Pointer to Add a Friend Dialog.
m_Password
This User's password.
m_pBlockedUsersDlg
Pointer to Blocked Users List Dialog.
m_pChangePasswordDlg
Pointer to Change Password Dialog.
m_pMessengerLoginDlg
Pointer to Login/Change User Dialog.
m_pOfflineMessagesDlg
Pointer to Offline Messages Window.
m_pPreferencesDlg
Pointer to Preferences Dialog.
m_Preferences
A data structure containing all the User Preferences.
m_pSpeakDlg
Pointer to Speak Window.
m_SpeakDialogsList
List of pointers. Each pointer member points to a Speak Window object.
m_UserName
User ID of this user.
Constructor Detail |
CMessengerClientDoc()
Sets all pointers to NULL, all boolean vars to FALSE, and all numeric vars to 0.
Destructor Detail |
~CMessengerClientDoc()
Default destructor.
Method Detail |
AddFriendToList(CMessagePacket *m_pMsgPacket, BOOL online)
Puts a friend's name into the Friends List Tree. From field of the Message Packet
contains Friend's name, while the flag var online indicates whether the friend is online
(if true) or offline (if false). Depending on this flag, this method decides whether to
add the friend's name under Online Friends or
Offline Friends
ApplyPreferenceChanges(int whichPreferences /*= ALL_PREFERENCES */)
ClearFriendsList()
Deletes all members from Friends' list (on the screen only)
ConnectToServer()
Creates a Client Socket object to communicate with the Chatter-jee
Server, and makes a connection to Server.
CreateAnOfflineMessagesDialog()
DoCleanup()
This method is introduced just so that the SaveModified() method could be accessed from
outside. It just calls SaveModified().
EmptyAllLists()
It's a sort of a controller method, which calls several other methods to make cleanup.
It calls the following methods.
EmptyBlockedUsersList()
Clears the Blocked Users List. It also clears the memory pointed to by
each member of the Blocked Users List.
EmptyOfflineMessagesList()
Clears the Offline Messages List. It also clears the memory pointed to by
each member of the Offline Messages List.
EmptySpeakDialogsList()
Clears the Speak Windows List. It also clears the memory pointed to by
each member of the Speak Windows List, and shuts off all
Speak Windows.
FindFriendFromList(CMessagePacket *m_pMsgPacket)
Finds a friend's name from the friend's tree view. Calls the method
TraverseTree()
for finding the name.
FindSpeakDialogForFriend(CString strFriend)
Traverses thru the Speak windows list and finds the
Speak window for a particular friend.
GetApplicationSettingsFromRegistry()
Reads login and font/color preferences from registry. Accesses the registry branch
HKEY_CURRENT_USER/Software/ShirishSoft/Chatter-jee/Settings for this.
GetViewPtr()
Retrieves the view pointer for the application.
InsertMessagesIntoOfflineMessagesDialog(COfflineMessagesFrameWnd *pFrame)
OnNewDocument()
Method generated by MFC. Apart from default functionality, the method also does the following:
PopulateBlockedUsersList(CMessagePacket *pMsg)
Puts all the Blocked Users' names into the Blocked Users List.
ProcessMessageFromOtherUser(CMessagePacket *m_pMsgPacket)
When the user gets a message from another user, this method gets called. It does the following:
ProcessMessagePacket()
This is the main controller method of this class. Depending on the
Reason Flag inside a Message Packet, it calls
various methods to act on the incoming message packet. To see various possible values for the
Reason Flag and their meanings, see the Protocol document.
PutPreferencesIntoEffect(int whichPreferences /*= ALL_PREFERENCES*/)
Applies the new Preferences. Called when one presses Apply button on the
Preferences Dialog
RemoveFriendFromList(CMessagePacket *m_pMsgPacket, HTREEITEM& user)
Removes a Friend's name from the list on the screen.
RemoveSpeakDialogFromList(CString strFriend)
Removes a pointer to a Speak Window from the
Speak Windows List. Called when a Speak Window closes.
RequestFriendsList()
Sends a Message Packet to the Chatter-jee Server, asking for the
Friends List.
ResetTitle()
Sets the Main Frame Window title to "Not logged in".
SaveModified()
Called automatically when the User closes Chatter-jee client.
ShowFriendsList(CMessagePacket *m_pMsgPacket)
ShowOnlineOfflineSummary()
Shows the number of online and offline friends on the screen, in the tree view inside Main Frame Window. This number is
read from the vars m_nNumOnline and m_nNumOffline.
TraverseTree(HTREEITEM root, CMessengerClientView *pView)
This is a Recursive method. Used to find a handle to an item inside the Friends List. It's called from
method FindFriendFromList().
WriteOffLineMessageToDatabase(CMessagePacket *pMsgPacket)
Not fully implemented, placed here as a hook, if one wants to write offline messages for future retrieval.
Right now, the offline messages are lost if the user logs out.