mirror of
https://github.com/twisterarmy/twister-core.git
synced 2025-08-31 08:11:59 +00:00
Merge pull request #391 from erqan/groups
enables readding a group key by `rescandirectmsgs` and `creategroup`
This commit is contained in:
commit
30a5ebafa6
@ -8,7 +8,7 @@
|
|||||||
// These need to be macros, as version.cpp's and bitcoin-qt.rc's voodoo requires it
|
// These need to be macros, as version.cpp's and bitcoin-qt.rc's voodoo requires it
|
||||||
#define CLIENT_VERSION_MAJOR 0
|
#define CLIENT_VERSION_MAJOR 0
|
||||||
#define CLIENT_VERSION_MINOR 9
|
#define CLIENT_VERSION_MINOR 9
|
||||||
#define CLIENT_VERSION_REVISION 37
|
#define CLIENT_VERSION_REVISION 38
|
||||||
#define CLIENT_VERSION_BUILD 0
|
#define CLIENT_VERSION_BUILD 0
|
||||||
|
|
||||||
// Set to true for release, false for prerelease or test build
|
// Set to true for release, false for prerelease or test build
|
||||||
|
@ -1206,7 +1206,7 @@ string getGroupAliasByKey(const string &privKey)
|
|||||||
void registerNewGroup(const string &privKey, const string &desc, const string &member, const string &invitedBy, int64_t utcTime, int k)
|
void registerNewGroup(const string &privKey, const string &desc, const string &member, const string &invitedBy, int64_t utcTime, int k)
|
||||||
{
|
{
|
||||||
string groupAlias = getGroupAliasByKey(privKey);
|
string groupAlias = getGroupAliasByKey(privKey);
|
||||||
if( !groupAlias.length() ) {
|
|
||||||
CBitcoinSecret vchSecret;
|
CBitcoinSecret vchSecret;
|
||||||
bool fGood = vchSecret.SetString(privKey);
|
bool fGood = vchSecret.SetString(privKey);
|
||||||
if (!fGood) {
|
if (!fGood) {
|
||||||
@ -1225,7 +1225,7 @@ void registerNewGroup(const string &privKey, const string &desc, const string &m
|
|||||||
printf("registerGroupMember: Invalid group alias '%s' from wallet\n", groupAlias.c_str());
|
printf("registerGroupMember: Invalid group alias '%s' from wallet\n", groupAlias.c_str());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} else {
|
} else if (!groupAlias.length()) {
|
||||||
groupAlias = getRandomGroupAlias();
|
groupAlias = getRandomGroupAlias();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1235,7 +1235,6 @@ void registerNewGroup(const string &privKey, const string &desc, const string &m
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
LOCK(cs_twister);
|
LOCK(cs_twister);
|
||||||
GroupChat &group = m_groups[groupAlias];
|
GroupChat &group = m_groups[groupAlias];
|
||||||
@ -3866,19 +3865,26 @@ Object getLibtorrentSessionStatus()
|
|||||||
|
|
||||||
Value creategroup(const Array& params, bool fHelp)
|
Value creategroup(const Array& params, bool fHelp)
|
||||||
{
|
{
|
||||||
if (fHelp || params.size() != 1)
|
if (fHelp || params.size() < 1 || params.size() > 2)
|
||||||
throw runtime_error(
|
throw runtime_error(
|
||||||
"creategroup <description>\n"
|
"creategroup <description> [<groupprivkey>]\n"
|
||||||
"Create a new key pair for group chat and add it to wallet\n"
|
"Create (if <groupprivkey> is omited) a new key pair for group chat and add it to wallet\n"
|
||||||
"Hint: use groupcreate to invite yourself\n"
|
"Or import the given <groupprivkey> into wallet\n"
|
||||||
|
"Hint: use newgroupinvite to invite yourself\n"
|
||||||
"Returns the group alias");
|
"Returns the group alias");
|
||||||
|
|
||||||
string strDescription = params[0].get_str();
|
string strDescription = params[0].get_str();
|
||||||
|
string privKey;
|
||||||
|
|
||||||
|
if (params.size() == 2)
|
||||||
|
privKey = params[1].get_str();
|
||||||
|
else
|
||||||
|
{
|
||||||
RandAddSeedPerfmon();
|
RandAddSeedPerfmon();
|
||||||
CKey secret;
|
CKey secret;
|
||||||
secret.MakeNewKey(true);
|
secret.MakeNewKey(true);
|
||||||
string privKey = CBitcoinSecret(secret).ToString();
|
privKey = CBitcoinSecret(secret).ToString();
|
||||||
|
}
|
||||||
|
|
||||||
string noMember;
|
string noMember;
|
||||||
registerNewGroup(privKey, strDescription, noMember, noMember, GetTime(), -1);
|
registerNewGroup(privKey, strDescription, noMember, noMember, GetTime(), -1);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user