Last active
December 17, 2015 19:49
-
-
Save Mononofu/5663248 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* in SessionImpl */ | |
void SessionImpl::sendMessage(ByteSeq message, string chatID) { | |
auto server = getServerForChan(chatID); | |
/* user is the user this session belongs to */ | |
server->sendMessage(user, message, chatID); | |
} | |
/* in our InterServerImpl */ | |
void InterServerImpl::sendMessage(User sender, ByteSeq message, string chatID) { | |
for(auto user : getUsersForChan(chatID)) { | |
for(auto server : getServerForUser(user)) { | |
server->clientAppendMessageToChat(user, message, chatID, sender); | |
} | |
} | |
} | |
void InterServerImpl::clientAppendMessageToChat(User receiver, ByteSeq message, string chatID, User sender) { | |
for(auto clientCallback : getCallbacksForUser(receiver)) { | |
clientCallback->appendMessageToChat(message, chatID, sender); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment