Ejemplo n.º 1
0
	IStorageAccount* AccountsManager::GetAccountFromUniqueID (const QString& id) const
	{
		auto accounts = GetAccounts ();
		auto it = std::find_if (accounts.begin (), accounts.end (),
				[id] (const auto& acc) { return acc->GetUniqueID () == id; });
		return it == accounts.end () ? 0 : *it;
	}
Ejemplo n.º 2
0
void GetProtocols(std::vector<Protocol> *result)
{
	std::vector<PROTOACCOUNT *> accs;
	GetAccounts(&accs);

	unsigned int accsSize = accs.size();
	for (unsigned int i = 0; i < accsSize ; ++i)
		result->push_back(Protocol(accs[i]->szModuleName));
}
Ejemplo n.º 3
0
Protocol GetProtocolByIndex(int index)
{
	std::vector<PROTOACCOUNT *> protos;
	GetAccounts(&protos);
	int protosSize = protos.size();
	
	if (protosSize < 1)
		return Protocol(NULL);
	
	index = (index % protosSize + protosSize) % protosSize;
	return Protocol(protos[index]->szModuleName);
}
Ejemplo n.º 4
0
int GetProtocolIndexByName(const char *moduleName)
{
	std::vector<PROTOACCOUNT *> protos;
	GetAccounts(&protos);

	int protosSize = (int) protos.size();
	for(int i = 0; i < protosSize; ++i)
	{
		if (strcmp(protos[i]->szModuleName, moduleName) == 0)
			return i;
	}

	return -1;
}
Ejemplo n.º 5
0
   bool 
   Domain::XMLStore(XNode *pParentNode, int iBackupOptions)
   {
      XNode *pNode = pParentNode->AppendChild(_T("Domain"));

      pNode->AppendAttr(_T("Name"), name_);
      pNode->AppendAttr(_T("Postmaster"), postmaster_);
      pNode->AppendAttr(_T("ADDomainName"), addomain_name_);
      pNode->AppendAttr(_T("Active"), StringParser::IntToString(active_));
      pNode->AppendAttr(_T("MaxMessageSize"), StringParser::IntToString(max_message_size_));
      pNode->AppendAttr(_T("MaxSize"), StringParser::IntToString(max_size_mb_));
      pNode->AppendAttr(_T("MaxAccountSize"), StringParser::IntToString(max_account_size_));

      pNode->AppendAttr(_T("UsePlusAddressing"), use_plus_addressing_ ? _T("1") : _T("0"));
      pNode->AppendAttr(_T("PlusAddressingChar"), plus_addressing_char_);
      pNode->AppendAttr(_T("AntiSpamOptions"), StringParser::IntToString(anti_spam_options_));

      pNode->AppendAttr(_T("EnableSignature"), enable_signature_ ? _T("1") : _T("0"));
      pNode->AppendAttr(_T("SignatureMethod"), StringParser::IntToString(signature_method_));
      pNode->AppendAttr(_T("SignaturePlainText"), signature_plain_text_);
      pNode->AppendAttr(_T("SignatureHTML"), signature_html_);
      pNode->AppendAttr(_T("AddSignaturesToLocalMail"), add_signatures_to_local_mail_ ? _T("1") : _T("0"));
      pNode->AppendAttr(_T("AddSignaturesToReplies"), add_signatures_to_replies_ ? _T("1") : _T("0"));

      pNode->AppendAttr(_T("MaxNoOfAccounts"), StringParser::IntToString(max_no_of_accounts_));
      pNode->AppendAttr(_T("MaxNoOfAliases"), StringParser::IntToString(max_no_of_aliases_));
      pNode->AppendAttr(_T("MaxNoOfLists"), StringParser::IntToString(max_no_of_distribution_lists_));
      pNode->AppendAttr(_T("LimitationsEnabled"), StringParser::IntToString(limitations_enabled_));

      pNode->AppendAttr(_T("DKIMSelector"), dkim_selector_);
      pNode->AppendAttr(_T("DKIMPrivateKeyFile"), dkim_private_key_file_);

      if (!GetDomainAliases()->XMLStore(pNode, iBackupOptions))
         return false;

      // Accounts
      if (!GetAccounts()->XMLStore(pNode, iBackupOptions))
         return false;

      if (!GetAliases()->XMLStore(pNode, iBackupOptions))
         return false;

      if (!GetDistributionLists()->XMLStore(pNode, iBackupOptions))
         return false;

      return true;
   }
Ejemplo n.º 6
0
   bool 
   Domain::XMLLoadSubItems(XNode *pNode, int iRestoreOptions)
   {
      if (!GetDomainAliases()->XMLLoad(pNode, iRestoreOptions))
         return false;

      if (!GetAccounts()->XMLLoad(pNode, iRestoreOptions))
         return false;

      if (!GetAliases()->XMLLoad(pNode, iRestoreOptions))
         return false;

      if (!GetDistributionLists()->XMLLoad(pNode, iRestoreOptions))
         return false;

      return true;
   }
Ejemplo n.º 7
0
Protocol * GetCurrentProtocol(bool createIfDontExist)
{
	if (createIfDontExist && current.index >= 0 && current.proto == NULL)
	{
		std::vector<PROTOACCOUNT *> protos;
		GetAccounts(&protos);

		int protosSize = protos.size();
		if (current.index >= protosSize)
		{
			current.index = -1;
			return NULL;
		}

		current.proto = new Protocol(protos[current.index]->szModuleName);
	}
	
	return current.proto;	
}
Ejemplo n.º 8
0
int GetNumProtocols()
{
	std::vector<PROTOACCOUNT *> protos;
	GetAccounts(&protos);
	return protos.size();
}