Skip to content

Commit adf75e4

Browse files
Wire: Revert rsinit.cc, fix reference pulse linking and mMsgName
1 parent 42ee7b3 commit adf75e4

2 files changed

Lines changed: 25 additions & 36 deletions

File tree

src/rsserver/rsinit.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2240,8 +2240,8 @@ bool RsLoginHelper::createLocation(
22402240
std::string sslPassword =
22412241
RSRandom::random_alphaNumericString(RsInit::getSslPwdLen());
22422242

2243-
RsLoginHandler::cachePgpPassphrase(password);
2244-
// Note: setDisableAskPassword not available via static interface, skipping
2243+
if(!rsNotify->cachePgpPassphrase(password)) return false;
2244+
if(!rsNotify->setDisableAskPassword(true)) return false;
22452245

22462246
bool ret = RsAccounts::createNewAccount(
22472247
l.mPgpId, "", l.mLocationName, "", makeHidden, makeAutoTor,
@@ -2250,7 +2250,7 @@ bool RsLoginHelper::createLocation(
22502250
ret = ret && RsInit::LoadPassword(sslPassword);
22512251
ret = ret && RsInit::OK == attemptLogin(l.mLocationId, password);
22522252

2253-
// Note: setDisableAskPassword not available via static interface
2253+
rsNotify->setDisableAskPassword(false);
22542254
return ret;
22552255
}
22562256
#endif // !RS_VERSION_AT_LEAST(0,6,6)

src/services/p3wire.cc

Lines changed: 22 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -854,6 +854,7 @@ bool p3Wire::createOriginalPulse(const RsGxsGroupId &grpId, RsWirePulseSPtr pPul
854854
pulse.mPulseType = WIRE_PULSE_TYPE_ORIGINAL;
855855
pulse.mSentiment = pPulse->mSentiment;
856856
pulse.mPulseText = pPulse->mPulseText;
857+
pulse.mMeta.mMsgName = pPulse->mPulseText.substr(0, 50);
857858
pulse.mImage1 = pPulse->mImage1;
858859
pulse.mImage2 = pPulse->mImage2;
859860
pulse.mImage3 = pPulse->mImage3;
@@ -968,15 +969,21 @@ bool p3Wire::createReplyPulse(RsGxsGroupId grpId, RsGxsMessageId msgId, RsGxsGro
968969
responsePulse.mPulseType = WIRE_PULSE_TYPE_RESPONSE | reply_type;
969970
responsePulse.mSentiment = pPulse->mSentiment;
970971
responsePulse.mPulseText = pPulse->mPulseText;
972+
responsePulse.mMeta.mMsgName = pPulse->mPulseText.substr(0, 50);
971973
responsePulse.mImage1 = pPulse->mImage1;
972974
responsePulse.mImage2 = pPulse->mImage2;
973975
responsePulse.mImage3 = pPulse->mImage3;
974976
responsePulse.mImage4 = pPulse->mImage4;
975977

978+
RsGxsMessageId refMsgId = replyToPulse->mMeta.mOrigMsgId;
979+
if (refMsgId.isNull()) {
980+
refMsgId = replyToPulse->mMeta.mMsgId;
981+
}
982+
976983
// mRefs refer to parent post.
977984
responsePulse.mRefGroupId = replyToPulse->mMeta.mGroupId;
978985
responsePulse.mRefGroupName = replyToGroup.mMeta.mGroupName;
979-
responsePulse.mRefOrigMsgId = replyToPulse->mMeta.mOrigMsgId;
986+
responsePulse.mRefOrigMsgId = refMsgId;
980987
responsePulse.mRefAuthorId = replyToPulse->mMeta.mAuthorId;
981988
responsePulse.mRefPublishTs = replyToPulse->mMeta.mPublishTs;
982989
responsePulse.mRefPulseText = replyToPulse->mPulseText;
@@ -1015,56 +1022,38 @@ bool p3Wire::createReplyPulse(RsGxsGroupId grpId, RsGxsMessageId msgId, RsGxsGro
10151022
std::cerr << responsePair.second.toStdString() << ")";
10161023
std::cerr << std::endl;
10171024

1018-
// retrieve newly generated message.
1019-
// **********************************************************
1020-
RsWirePulseSPtr createdResponsePulse;
1021-
if (!fetchPulse(responsePair.first, responsePair.second, createdResponsePulse))
1022-
{
1023-
std::cerr << "p3Wire::createReplyPulse() fetch createdReponsePulse FAILED";
1024-
std::cerr << std::endl;
1025-
return false;
1026-
}
1027-
1028-
/* Check that pulses is created properly */
1029-
if ((createdResponsePulse->mMeta.mGroupId != responsePulse.mMeta.mGroupId) ||
1030-
(createdResponsePulse->mPulseText != responsePulse.mPulseText) ||
1031-
(createdResponsePulse->mRefGroupId != responsePulse.mRefGroupId) ||
1032-
(createdResponsePulse->mRefOrigMsgId != responsePulse.mRefOrigMsgId))
1033-
{
1034-
std::cerr << "p3Wire::createReplyPulse() fetch createdReponsePulse FAILED";
1035-
std::cerr << std::endl;
1036-
return false;
1037-
}
1038-
10391025
// create ReplyTo Ref Msg.
1040-
std::cerr << "PulseAddDialog::postRefPulse() create Reference!";
1026+
std::cerr << "p3Wire::createReplyPulse() create Reference!";
10411027
std::cerr << std::endl;
10421028

1029+
RsGxsMessageId parentMsgId = replyToPulse->mMeta.mOrigMsgId;
1030+
if (parentMsgId.isNull()) {
1031+
parentMsgId = replyToPulse->mMeta.mMsgId;
1032+
}
1033+
10431034
// Reference Pulse. posted on Parent's Group.
10441035
RsWirePulse refPulse;
10451036

10461037
refPulse.mMeta.mGroupId = replyToPulse->mMeta.mGroupId;
10471038
refPulse.mMeta.mAuthorId = replyWithGroup.mMeta.mAuthorId; // own author Id.
1048-
refPulse.mMeta.mThreadId = replyToPulse->mMeta.mOrigMsgId;
1049-
refPulse.mMeta.mParentId = replyToPulse->mMeta.mOrigMsgId;
1039+
refPulse.mMeta.mThreadId = parentMsgId;
1040+
refPulse.mMeta.mParentId = parentMsgId;
10501041
refPulse.mMeta.mOrigMsgId.clear();
10511042

10521043
refPulse.mPulseType = WIRE_PULSE_TYPE_REFERENCE | reply_type;
1053-
refPulse.mSentiment = 0; // should this be =? createdResponsePulse->mSentiment;
1044+
refPulse.mSentiment = 0;
10541045

10551046
// Dont put parent PulseText into refPulse - it is available on Thread Msg.
1056-
// otherwise gives impression it is correctly setup Parent / Reply...
1057-
// when in fact the parent PublishTS, and AuthorId are wrong.
10581047
refPulse.mPulseText = "";
10591048

1060-
// refs refer back to own Post.
1049+
// refs refer back to own Post - use responsePair.second as OrigMsgId
10611050
refPulse.mRefGroupId = replyWithGroup.mMeta.mGroupId;
10621051
refPulse.mRefGroupName = replyWithGroup.mMeta.mGroupName;
1063-
refPulse.mRefOrigMsgId = createdResponsePulse->mMeta.mOrigMsgId;
1052+
refPulse.mRefOrigMsgId = responsePair.second;
10641053
refPulse.mRefAuthorId = replyWithGroup.mMeta.mAuthorId;
1065-
refPulse.mRefPublishTs = createdResponsePulse->mMeta.mPublishTs;
1066-
refPulse.mRefPulseText = createdResponsePulse->mPulseText;
1067-
refPulse.mRefImageCount = createdResponsePulse->ImageCount();
1054+
refPulse.mRefPublishTs = time(NULL);
1055+
refPulse.mRefPulseText = responsePulse.mPulseText;
1056+
refPulse.mRefImageCount = responsePulse.ImageCount();
10681057

10691058
// publish Ref Msg.
10701059
if (!createPulse(token, refPulse))

0 commit comments

Comments
 (0)