Each object of this class represents a single thread dedicated to a client.
Field Summary |
||
Access | Data Type | Name |
Constructor Summary |
||
CClientThread() |
Destructor Summary |
||
~CClientThread() |
Field Detail |
Constructor Detail |
CClientThread()
Default constructor.
Destructor Detail |
~CClientThread()
Default destructor.
Method Detail |
AddUserToList(CMessagePacket &msg, CMessengerServerDoc *pDoc, int nWhichList, bool bLoggedInClient)
Adds a user name (sent in the Message packet) to the list specified by nWhichList. This may be an online or offline
users' list.
AskClientForAddPermission(CMessagePacket& msg, CMessengerServerDoc *m_pDoc)
Sends a message to the client, asking for his/her permission to be added to sender's friends' list.
FindBlockedUserElement(CString owner, CMessengerServerDoc *pDoc)
Finds the address of element from Blocked Users list whose owner is the sender.
FindOutTheClient(CMessagePacket& msg, CMessengerServerDoc *m_pDoc)
Finds the address of a socket where the client is sending messages.
GetAllOfflineMessagesForThisUser(CMessagePacket& msg, CMessengerServerDoc *m_pDoc, bool isGettingMessages)
Reads thru offline messages list and if a msg belongs to the
requester, sends it to him.
Removes the sent msg from the list. To ensure this op is
Thread safe, we call our owan method RemoveAListMember insted
of RemoveAt list member of CListPtr class.
GetListItemIndex(CListCtrl *list, CMessagePacket &msg)
Used to find position of an item in a list
GetListOfAllFriends(CMessagePacket& msg, CStringList& friendsList, CMessengerServerDoc *m_pDoc)
Gets the list of all friends for the From field in the msg packet. Puts these names into friendsList var.
GetViewPtr()
Gets a pointer to the view object.
IsThisFromPartyBlocked(CMessagePacket &msg, CMessengerServerDoc *pDoc)
Finds out whether the To name in msg has blocked From name in msg.
LogMessage(CMessagePacket &msg)
Logs the message sent by a client into the view of server window.
ProcessAddAFriendRequest(CMessagePacket& msg, BOOL acceptAndAdd, CMessengerClientSocket *pCurrentClient, CMessengerServerDoc *m_pDoc)
Adds a user as the friend of another as specified by acceptAndAdd var to the database. Uses User.dll for database ops.
ProcessBlockUserRequest(CMessagePacket &msg, CMessengerClientSocket *pCurrentClient, CMessengerServerDoc *m_pDoc, bool bForWhatTime)
ProcessChangePasswordRequest(CMessagePacket& msg, CMessengerClientSocket *pCurrentClient, CMessengerServerDoc *m_pDoc)
ProcessDeleteFriendsRequest(CMessagePacket& msg, CMessengerClientSocket *pCurrentClient, CMessengerServerDoc *m_pDoc)
ProcessLoginRequest(CMessagePacket& msg, CMessengerClientSocket *pCurrentClient, CMessengerServerDoc *m_pDoc)
ProcessLogoffRequest(CMessagePacket &msg, CMessengerClientSocket *pCurrentClient, CMessengerServerDoc *m_pDoc)
ProcessMessageFromOneUserToAnother(CMessagePacket& msg, CMessengerClientSocket *pCurrentClient, CMessengerServerDoc *pDoc)
ProcessMessagePacket(CMessagePacket& msg, CMessengerClientSocket *pCurrentClient)
ProcessRegistrationRequest(CMessagePacket& msg, CMessengerClientSocket *pCurrentClient, CMessengerServerDoc *m_pDoc)
ReceiveMessagePacket(CMessengerClientSocket *pCurrentClient)
RemoveAListMember(CPtrList *list, POSITION pos, CMessengerServerDoc *m_pDoc, int whichList)
RemoveFromSocketsList(CMessengerClientSocket *socket, CMessengerServerDoc *m_pDoc)
RemoveSelBlockedUsers(CMessagePacket &msg, CMessengerClientSocket *pCurrentClient, CMessengerServerDoc *pDoc)
SendBlockUserList(CMessagePacket &msg, CMessengerClientSocket *pCurrentClient, CMessengerServerDoc *pDoc)
SendListOfFriendsToThisLogin(CMessagePacket& msg, CMessengerServerDoc *m_pDoc)
SendMessagePacket(CMessagePacket& msgPacket, CMessengerClientSocket *clientSocket, CMessengerServerDoc *m_pDoc)
SendMessageToRecepient(CMessagePacket& msg, CMessengerServerDoc *m_pDoc)
SendNextOfflineMessageForThisUser(CMessagePacket& msg, CMessengerServerDoc *m_pDoc, CPtrList& offlineMessagesList)
SendStatusMessageToClient(CString msg, CString status, CString strRecipient, CMessengerClientSocket *sock, CMessengerServerDoc *m_pDoc)
TellFriendsAbtLogin(CMessagePacket& msg, CMessengerServerDoc *m_pDoc)
TellFriendsAbtLogoff(CMessagePacket& msg, CMessengerServerDoc *m_pDoc)
Blocks a user. Also enters this blocking in database, if specified so in bForWhatTime var.
Changes password for the Message sender.
Deletes a user from another user's friends' list.
Verifies login details for a user, logs him/her in the system.
Logs off a user and deletes the client socket created for this user. Deletes all the entries of blocked users who were
tempararily blocked by this user.
If the receiver (specified in To field of msg) is online, redirects the msg to his socket. Otherwise keeps the msg in
offline messages list.
Processes a message packet arriving on a client socket. Calls diff methods depending on the ReasonFlag field
of the message packet. For more info on ReasonFlag, see the Protocol Document.
Registers a user with Chatter-jee Server. Uses User.dll for database ops.
Called when some data arrives on a client socket. Receives that data and sends it for processing.
Removes a member of a list shared by all client threads in a thread safe way. Uses mutexes to delete these objects.
Removes a socket from Sockets list (the list containing all the sockets of clients who have not logged in).
Called when a user has logged on. It's a thread safe method.
Removes the specified users from the Blocked Users list owned by sender of message.
Sends the list of all users blocked by the sender to him/her.
Sends the list of all friends of the sender to him/her.
Sends a single message packet on the given client socket.
Sends a message to the socket belonging to a user.
Sends the next offline message for this user to the client.
Sends a given message to the recipient name sent as parameter.
Sends a broadcast to all users that a new user has come online.
Sends a broadcast to all users that a user has logged off.