mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-10-01 02:35:48 -04:00
connected GUI to distant chat permission flags system
This commit is contained in:
parent
b32eb6e0c8
commit
9dfac71822
@ -60,6 +60,12 @@ static const uint32_t DISTANT_CHAT_GXS_TUNNEL_SERVICE_ID = 0xa0001 ;
|
||||
|
||||
typedef RsGxsTunnelService::RsGxsTunnelId RsGxsTunnelId;
|
||||
|
||||
DistantChatService::DistantChatService() : mDistantChatMtx("distant chat")
|
||||
{
|
||||
mGxsTunnels = NULL ;
|
||||
mDistantChatPermissions = RS_DISTANT_CHAT_CONTACT_PERMISSION_FLAG_FILTER_NONE ; // default: accept everyone
|
||||
}
|
||||
|
||||
void DistantChatService::connectToGxsTunnelService(RsGxsTunnelService *tr)
|
||||
{
|
||||
mGxsTunnels = tr ;
|
||||
@ -111,10 +117,10 @@ void DistantChatService::handleRecvChatStatusItem(RsChatStatusItem *cs)
|
||||
|
||||
bool DistantChatService::acceptDataFromPeer(const RsGxsId& gxs_id)
|
||||
{
|
||||
if(mDistantChatPermissions & RS_DISTANT_MESSAGING_CONTACT_PERMISSION_FLAG_FILTER_NON_CONTACTS)
|
||||
if(mDistantChatPermissions & RS_DISTANT_CHAT_CONTACT_PERMISSION_FLAG_FILTER_NON_CONTACTS)
|
||||
return (rsIdentity!=NULL) && rsIdentity->isARegularContact(gxs_id) ;
|
||||
|
||||
if(mDistantChatPermissions & RS_DISTANT_MESSAGING_CONTACT_PERMISSION_FLAG_FILTER_EVERYBODY)
|
||||
if(mDistantChatPermissions & RS_DISTANT_CHAT_CONTACT_PERMISSION_FLAG_FILTER_EVERYBODY)
|
||||
return false ;
|
||||
|
||||
return true ;
|
||||
|
@ -39,11 +39,7 @@ public:
|
||||
// So, public interface only uses DistandChatPeerId, but internally, this is converted into a RsGxsTunnelService::RsGxsTunnelId
|
||||
|
||||
|
||||
DistantChatService() : mDistantChatMtx("distant chat")
|
||||
{
|
||||
mGxsTunnels = NULL ;
|
||||
mDistantChatPermissions = RS_DISTANT_MESSAGING_CONTACT_PERMISSION_FLAG_FILTER_NONE ; // default: accept everyone
|
||||
}
|
||||
DistantChatService() ;
|
||||
|
||||
virtual void triggerConfigSave()=0 ;
|
||||
bool processLoadListItem(const RsItem *item) ;
|
||||
|
@ -270,6 +270,10 @@ public:
|
||||
#define RS_DISTANT_MESSAGING_CONTACT_PERMISSION_FLAG_FILTER_NON_CONTACTS 0x0001
|
||||
#define RS_DISTANT_MESSAGING_CONTACT_PERMISSION_FLAG_FILTER_EVERYBODY 0x0002
|
||||
|
||||
#define RS_DISTANT_CHAT_CONTACT_PERMISSION_FLAG_FILTER_NONE 0x0000
|
||||
#define RS_DISTANT_CHAT_CONTACT_PERMISSION_FLAG_FILTER_NON_CONTACTS 0x0001
|
||||
#define RS_DISTANT_CHAT_CONTACT_PERMISSION_FLAG_FILTER_EVERYBODY 0x0002
|
||||
|
||||
struct DistantChatPeerInfo
|
||||
{
|
||||
RsGxsId to_id ;
|
||||
|
@ -506,16 +506,15 @@ void ChatPage::distantChatComboBoxChanged(int i)
|
||||
{
|
||||
switch(i)
|
||||
{
|
||||
case 0: ;
|
||||
default:
|
||||
case 0: rsMsgs->setDistantChatPermissionFlags(RS_DISTANT_CHAT_CONTACT_PERMISSION_FLAG_FILTER_NONE) ;
|
||||
break ;
|
||||
|
||||
case 1: ;
|
||||
case 1: rsMsgs->setDistantChatPermissionFlags(RS_DISTANT_CHAT_CONTACT_PERMISSION_FLAG_FILTER_NON_CONTACTS) ;
|
||||
break ;
|
||||
|
||||
case 2: ;
|
||||
case 2: rsMsgs->setDistantChatPermissionFlags(RS_DISTANT_CHAT_CONTACT_PERMISSION_FLAG_FILTER_EVERYBODY) ;
|
||||
break ;
|
||||
|
||||
default: ;
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user