PDA

View Full Version : P2P chat system with restricted conversation



Momergil
28th November 2013, 02:48
Hello!

I want to develop a P2P chat system. For now, I developed one that is strongly based on the chat example that comes with Qt Examples. But, as in the example, what happens is that all instances of my apps that are opened in the same network endup entering in the same, "global" conversation. Actually that's not a problem, because I do want to have such a general chat "room" where all the online instances of my application will be connected to all other instances. But I also want to give the user the option of choosing one of the online users to have a private conversation. The question is: how exactly do I do that?

I know that the conversion will be placed in a new QTextEdit inside a new tab as soon as the user is selected by double-click in the online user list. But how that I stabilish this private communication? I need to create a new instance of the Communicaton class? But whith which configuration (so it will not somehow confuse the conversation in the General chat room)?

I thought about the idea of, all times when the user sends a message, it comes with a header containing the receiver of that message and that all in the network would read; so if the header is "Global", than all online instances of the chat application deals with the message; but if the header contains the name of a given user, than all instances that are not that user discard that message and the noted receiver shows and deals with it. But I want to avoid this method because the idea of everyone online receiving a personal message and having to discard it when required sounds to much innapropriate when thinking about internet and processing consumption (that may one day be thousands of people online at the same time :x).


I'm glad for any help/suggestions,

Momergil