added translations and human readable messages for ID activity statistics

This commit is contained in:
csoler 2017-01-04 20:21:49 +01:00
parent 2919058652
commit 98524e861c
2 changed files with 80 additions and 2 deletions

View File

@ -46,6 +46,7 @@
#include <retroshare/rspeers.h>
#include "retroshare/rsgxsflags.h"
#include "retroshare/rsmsgs.h"
#include "retroshare/rsservicecontrol.h"
#include <iostream>
#include <algorithm>
@ -1894,11 +1895,87 @@ void IdDialog::insertIdDetails(uint32_t token)
QString IdDialog::createUsageString(const RsIdentityUsage& u) const
{
RetroShareLink::enumType service_type ;
switch(u.mServiceId)
{
case RS_SERVICE_GXS_TYPE_CHANNELS: service_type = RetroShareLink::TYPE_CHANNEL ; break ;
case RS_SERVICE_GXS_TYPE_FORUMS: service_type = RetroShareLink::TYPE_FORUM ; break ;
case RS_SERVICE_GXS_TYPE_POSTED: service_type = RetroShareLink::TYPE_POSTED ; break ;
default:
service_type = RetroShareLink::TYPE_UNKNOWN ; break ;
}
QString service_name = QString::fromStdString(rsServiceControl->getServiceName(uint32_t(u.mServiceId)<< 8)) ;
switch(u.mUsageCode)
{
case RsIdentityUsage::UNKNOWN_USAGE:
return tr("[Unknown]") ;
case RsIdentityUsage::GROUP_ADMIN_SIGNATURE_CREATION: // These 2 are normally not normal GXS identities, but nothing prevents it to happen either.
return tr("Admin signature in service %1").arg(service_name);
case RsIdentityUsage::GROUP_ADMIN_SIGNATURE_VALIDATION:
return tr("Admin signature verification in service %1").arg(service_name);
case RsIdentityUsage::GROUP_AUTHOR_SIGNATURE_CREATION: // not typically used, since most services do not require group author signatures
return tr("Creation of author signature in service %1").arg(service_name);
case RsIdentityUsage::GROUP_AUTHOR_SIGNATURE_VALIDATION:
case RsIdentityUsage::MESSAGE_AUTHOR_SIGNATURE_CREATION: // most common use case. Messages are signed by authors in e.g. forums.
case RsIdentityUsage::GROUP_AUTHOR_KEEP_ALIVE: // Identities are stamped regularly by crawlign the set of messages for all groups. That helps keepign the useful identities in hand.
break ;
case RsIdentityUsage::MESSAGE_AUTHOR_SIGNATURE_VALIDATION:
case RsIdentityUsage::MESSAGE_AUTHOR_KEEP_ALIVE: // Identities are stamped regularly by crawlign the set of messages for all groups. That helps keepign the useful identities in hand.
{
RetroShareLink l;
l.createGxsMessageLink(service_type,u.mGrpId,u.mMsgId,tr("here"));
return tr("Message author validation %1").arg(l.toHtml()) ;
}
case RsIdentityUsage::CHAT_LOBBY_MSG_VALIDATION: // Chat lobby msgs are signed, so each time one comes, or a chat lobby event comes, a signature verificaiton happens.
{
// there is no link for chat lobby yet.
return tr("Message in chat lobby %1").arg(u.mAdditionalId) ;
}
case RsIdentityUsage::GLOBAL_ROUTER_SIGNATURE_CHECK: // Global router message validation
{
return tr("Distant message signature validation.");
}
case RsIdentityUsage::GLOBAL_ROUTER_SIGNATURE_CREATION: // Global router message signature
{
return tr("Distant message signature creation.");
}
case RsIdentityUsage::GXS_TUNNEL_DH_SIGNATURE_CHECK: //
{
return tr("Signature validation in distant tunnel system.");
}
case RsIdentityUsage::GXS_TUNNEL_DH_SIGNATURE_CREATION: //
{
return tr("Signature in distant tunnel system.");
}
case RsIdentityUsage::IDENTITY_DATA_UPDATE: // Group update on that identity data. Can be avatar, name, etc.
{
return tr("Update of identity data.");
}
case RsIdentityUsage::IDENTITY_GENERIC_SIGNATURE_CHECK: // Any signature verified for that identity
{
return tr("Generic signature validation.");
}
case RsIdentityUsage::IDENTITY_GENERIC_SIGNATURE_CREATION: // Any signature made by that identity
{
return tr("Generic signature.");
}
case RsIdentityUsage::IDENTITY_GENERIC_ENCRYPTION:
{
return tr("Generic encryption.");
}
case RsIdentityUsage::IDENTITY_GENERIC_DECRYPTION:
{
return tr("Generic decryption.");
}
case RsIdentityUsage::CIRCLE_MEMBERSHIP_CHECK:
{
return tr("Membership verification in circle %1.").arg(QString::fromStdString(u.mGrpId.toStdString()));
}
#warning TODO! Add the different strings and translations here.
default:
return QString("Undone yet");
default:
return QString("Undone yet");
}
}

View File

@ -76,6 +76,7 @@ class RetroShareLink
RetroShareLink(const QUrl& url);
RetroShareLink(const QString& url);
#warning these methods should be static and return a created link
bool createFile(const QString& name, uint64_t size, const QString& hash);
bool createExtraFile(const QString& name, uint64_t size, const QString& hash, const QString& ssl_id);
bool createPerson(const RsPgpId &id);