This is is part of datamodel for storing user profiles.
More...
#include <profilemodel.h>
|
| ProfileModel (MController *aMController, const MModelProtocolInterface &aModel) |
|
| ~ProfileModel () |
|
bool | publishProfile (const Profile &aProfile) |
|
Profile * | profileByFingerPrint (const Hash &aFingerPrint, bool aEmitErrorOnEncryptionErrors=true, bool aOmitImage=false) |
|
bool | profileDataByFingerPrint (const Hash &aFingerPrint, QByteArray &aResultingProfileData, QByteArray &aResultingSignature, bool *aIsProfilePrivate, quint32 *aTimeOfPublish=NULL, QByteArray *aResultingPublicKey=NULL) |
|
bool | publishedProfileReceived (const Hash &aFingerPrint, const QByteArray &aContent, const QByteArray &aSignature, const QList< quint32 > &aBangPath, const QByteArray &aProfilePublicKey, const unsigned char aFlags, const quint32 aTimeStamp, const Hash &aFromNode) |
|
bool | sentProfileReceived (const Hash &aFingerPrint, const QByteArray &aContent, const QByteArray &aSignature, const QByteArray &aProfilePublicKey, const unsigned char aFlags, const quint32 aTimeStamp, const Hash &fromNode) |
|
void | fillBucket (QList< SendQueueItem > &aSendQueue, const Hash &aStartOfBucket, const Hash &aEndOfBucket, quint32 aLastMutualConnectTime, const Hash &aForNode) |
|
Hash | profileWithOldestTimeSinceMsgPoll (quint32 *aLastPollTime) |
|
void | setPrivateMessagePollTimeForProfile (const quint32 aTimeStamp, const Hash &aProfile) |
|
void | setPrivateDataForProfile (const Hash &aProfile, const QVariant &aPrivateData) |
|
QVariant | privateDataOfProfile (const Hash &aProfile) |
|
time_t | getLastProfileUpdateTime (const Hash &aProfile) |
|
void | setLastProfileUpdateTime (const Hash &aProfile, time_t aTime) |
|
void | reIndexAllProfilesIntoFTS () |
|
| ModelBase (QString aDataTableName, unsigned aMaxRowsToKeep) |
|
| ~ModelBase () |
|
bool | setTimeLastReference (const Hash &aObjectFingerPrint, quint32 aTimeWhenLastReferenced) |
|
unsigned | getMaxRowsToKeep () |
|
void | setMaxRowsToKeep (unsigned aRows) |
|
void | truncateDataTableToMaxRows (void) |
|
void | updateDbTableRowCount () |
|
|
bool | doHandlepublishedOrSentProfile (const Hash &aFingerPrint, const QByteArray &aContent, const QByteArray &aSignature, const QList< quint32 > &aBangPath, const QByteArray &aProfilePublicKey, const unsigned char aFlags, const quint32 aTimeStamp, bool aWasPublish, const Hash &aFromNode) |
|
virtual bool | deleteOldestDataRowInTable () |
|
This is is part of datamodel for storing user profiles.
Encryption keys related to profiles need to be done using ContentEncryptionModel but after it has done its job, this part of datamodel handles that actual profile-content
ProfileModel::~ProfileModel |
( |
| ) |
|
void ProfileModel::contentReceived |
( |
const Hash & |
aHashOfContent, |
|
|
const ProtocolItemType |
aTypeOfReceivdContent |
|
) |
| |
|
signal |
emitted when new profile is received
virtual bool ProfileModel::deleteOldestDataRowInTable |
( |
| ) |
|
|
privatevirtual |
bool ProfileModel::doHandlepublishedOrSentProfile |
( |
const Hash & |
aFingerPrint, |
|
|
const QByteArray & |
aContent, |
|
|
const QByteArray & |
aSignature, |
|
|
const QList< quint32 > & |
aBangPath, |
|
|
const QByteArray & |
aProfilePublicKey, |
|
|
const unsigned char |
aFlags, |
|
|
const quint32 |
aTimeStamp, |
|
|
bool |
aWasPublish, |
|
|
const Hash & |
aFromNode |
|
) |
| |
|
private |
void ProfileModel::fillBucket |
( |
QList< SendQueueItem > & |
aSendQueue, |
|
|
const Hash & |
aStartOfBucket, |
|
|
const Hash & |
aEndOfBucket, |
|
|
quint32 |
aLastMutualConnectTime, |
|
|
const Hash & |
aForNode |
|
) |
| |
Method for filling connected peers send queue with items that we have and that belong to said peers bucket.
- Parameters
-
aSendQueue | is send-queue of the connection that serves particular node |
aStartOfBucket | is hash where bucket of that peer starts. In practice it is the hash of the node itself. |
aEndOfBucket | is hash where bucket of that peer ends. That in turn depends on network size, or number of active nodes in the network. See method NodeModel::bucketEndHash for details. |
aLastMutualConnectTime | time when node was last in contact. In practice we'll fill the bucket items published after this time. |
time_t ProfileModel::getLastProfileUpdateTime |
( |
const Hash & |
aProfile | ) |
|
Gets time of last (successful) profile update+comment poll.
QVariant ProfileModel::privateDataOfProfile |
( |
const Hash & |
aProfile | ) |
|
Getter-method for private data of a profile. This "Private data" is locally-stored settings-type of data specific to profile and it is not shared inside network.
Profile* ProfileModel::profileByFingerPrint |
( |
const Hash & |
aFingerPrint, |
|
|
bool |
aEmitErrorOnEncryptionErrors = true , |
|
|
bool |
aOmitImage = false |
|
) |
| |
gets a profile. caller is supposed to delete the returned profile.
- Parameters
-
aFingerPrint | profile serial number |
aEmitErrorOnEncryptionErrors | if true and profile cannot be opened because selected operator is not in list of readers then an error message shall be emit()ted. This is set to false for trust-tree related operations where it is likely that selected operator is not reader of every operator trusted by selected operator. |
aOmitImage | if set to true, possible image will not be loaded from data ; in cases where we know that we'll need only subset of information and no image, we can skip this costly operation |
- Returns
- profile or NULL
bool ProfileModel::profileDataByFingerPrint |
( |
const Hash & |
aFingerPrint, |
|
|
QByteArray & |
aResultingProfileData, |
|
|
QByteArray & |
aResultingSignature, |
|
|
bool * |
aIsProfilePrivate, |
|
|
quint32 * |
aTimeOfPublish = NULL , |
|
|
QByteArray * |
aResultingPublicKey = NULL |
|
) |
| |
Gets a profile. Because profile is signed .. and that means that a particular byte-stream (containing actually a serialized json object) gets signed those bytes can't be altered or signature will not verify. This methods gets the actual signed bytestream that has been checked against a public key.
Note that this method does not check the signature any more, idea is that we don't store into db profiles that fail the signature check so this method only gets the profile, does not set it.
- Parameters
-
aFingerPrint | profile serial number |
aResultingProfileData | will contain profile data |
aResultingSignature | will contain profile signature |
aIsProfilePrivate | will be set to true if aResultingProfileData is encrypted. |
aTimeOfPublish | is also output variable, if non-NULL, will get its value set to time of publish of the profile |
aResultingPublicKey | if non-NULL, will be written to contain the public key of the profile |
- Returns
- true if profile was found
Hash ProfileModel::profileWithOldestTimeSinceMsgPoll |
( |
quint32 * |
aLastPollTime | ) |
|
method for find a profile that we have private keys for and that has not had its private messages polled for given time (say, 15 minutes). See method NetworkConnectorEngine::createConnectionsToNodesStoringPrivateMessages
- Parameters
-
aLastPollTime | output variable. this points to quint32 that (if profile is found) will have its value set to time of last message poll for the profile returned. |
- Returns
- fingerprint of node or KNullHash if every profile with private keys has had its messages polled recently
bool ProfileModel::publishedProfileReceived |
( |
const Hash & |
aFingerPrint, |
|
|
const QByteArray & |
aContent, |
|
|
const QByteArray & |
aSignature, |
|
|
const QList< quint32 > & |
aBangPath, |
|
|
const QByteArray & |
aProfilePublicKey, |
|
|
const unsigned char |
aFlags, |
|
|
const quint32 |
aTimeStamp, |
|
|
const Hash & |
aFromNode |
|
) |
| |
called by protocol parser when a profile is received
- Parameters
-
aFingerPrint | is the profile Hash received from protocol header |
aContent | is actual profile data |
aSignature | is digital signature of the aContent |
aBangPath | is list of last nodes where this content has been, idea is to prevent re-sending content to somewhere where it has already been |
aProfilePublicKey | is the key that was used to sign the profile. that is transferred outside profile just because the recipient might not have the key beforehand ; if she does, the existing key will be used in verifying process. |
aFlag | possible flags telling about encyption and compression |
aTimeStamp | timestamp of profile (if encrypted, it must be carried outside..) |
- Returns
- true on success
bool ProfileModel::publishProfile |
( |
const Profile & |
aProfile | ) |
|
sends profile to selected nodes in network for others to retrieve.
The reason why this method is in model (and not for instance, in Controller) is that "publish" means that a particular profile is stored into and marked as "needs to be published". Before that happens we need to open network connections to nodes that are supposed to contain the profile and once connections are open, then same profile is pushed into several nodes until it is considered "published". That opening and pushing-part happens by networking-parts.
- Parameters
-
aProfile | is the profile to publish |
- Returns
- true if things went all right
void ProfileModel::reIndexAllProfilesIntoFTS |
( |
| ) |
|
bool ProfileModel::sentProfileReceived |
( |
const Hash & |
aFingerPrint, |
|
|
const QByteArray & |
aContent, |
|
|
const QByteArray & |
aSignature, |
|
|
const QByteArray & |
aProfilePublicKey, |
|
|
const unsigned char |
aFlags, |
|
|
const quint32 |
aTimeStamp, |
|
|
const Hash & |
fromNode |
|
) |
| |
called by protocol parser when a profile is received by "send" protocol type
- Parameters
-
aFingerPrint | is the profile Hash received from protocol header |
aContent | is actual profile data |
aSignature | is digital signature of the aContent |
aProfilePublicKey | is the key that was used to sign the profile. that is transferred outside profile just because the recipient might not have the key beforehand ; if she does, the existing key will be used in verifying process. |
aFlag | possible flags telling about encyption and compression |
aTimeStamp | timestamp of profile (if encrypted, it must be carried outside..) |
- Returns
- true on success
void ProfileModel::setLastProfileUpdateTime |
( |
const Hash & |
aProfile, |
|
|
time_t |
aTime |
|
) |
| |
sets time of last (successful) profile update+comment poll.
void ProfileModel::setPrivateDataForProfile |
( |
const Hash & |
aProfile, |
|
|
const QVariant & |
aPrivateData |
|
) |
| |
Updates private data of a profile whose private key we stored locally. In first stage this private data includes contact list, later maybe trust settings etc.
void ProfileModel::setPrivateMessagePollTimeForProfile |
( |
const quint32 |
aTimeStamp, |
|
|
const Hash & |
aProfile |
|
) |
| |
method that is called after successful message poll ; it set the message poll timestamp for a profile
The documentation for this class was generated from the following file: