-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathBitMessage
More file actions
73 lines (71 loc) · 2.48 KB
/
Copy pathBitMessage
File metadata and controls
73 lines (71 loc) · 2.48 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
/* -*- c++ -*- */
///////////////////////////////////////////
// BitMessage
// -------------------------------------
// file : BitMessage
// author : Ben Kietzman
// begin : 2013-08-21
// copyright : Ben Kietzman
// email : ben@kietzman.org
///////////////////////////////////////////
/*! \file BitMessage
* \brief BitMessage Functions
*/
#ifndef _COMMON_BITMESSAGE_
#define _COMMON_BITMESSAGE_
// {{{ includes
#include <cmath>
#include <cstring>
#include <map>
#include <openssl/bio.h>
#include <openssl/buffer.h>
#include <openssl/evp.h>
#include <openssl/hmac.h>
#include <openssl/sha.h>
#include <vector>
#include <xmlrpc-c/base.h>
#include <xmlrpc-c/client.h>
using namespace std;
#include "Json"
// }}}
extern "C++"
{
namespace common
{
// {{{ BitMessage
//! Interfaces with the PyBitmessage client.
/*!
* Uses the XML-RPC API access to interface with the PyBitmessage client.
*/
class BitMessage
{
private:
list<string> m_trash;
string m_strUrl;
xmlrpc_env m_env;
xmlrpc_server_info *m_pServerInfo;
int is_base64(char c);
public:
BitMessage();
~BitMessage();
bool add(const string strA, const string strB, string &strResult, string &strError);
void decodeBase64(string strIn, string &strOut);
void encodeBase64(string strIn, string &strOut);
bool getAllInboxMessages(const string strAccount, vector<map<string, string> > &message, string &strError);
bool getAllInboxMessages(vector<map<string, string> > &message, string &strError);
bool getAllSentMessages(const string strAccount, vector<map<string, string> > &message, string &strError);
bool getAllSentMessages(vector<map<string, string> > &message, string &strError);
void getTrashedMessages(list<string> &trash);
bool helloWorld(const string strA, const string strB, string &strResult, string &strError);
bool listAddresses(vector<map<string, string> > &address, string &strError);
bool sendBroadcast(const string strFrom, const string strSubject, const string strMessage, string &strError);
bool sendMessage(const string strTo, const string strFrom, const string strSubject, const string strMessage, string &strError);
void setCredentials(const string strUser, const string strPassword, const string strServer, const string strPort);
void trashMessage(const string strMsgID);
bool trashMessages();
void untrashMessage(const string strMsgID);
};
// }}}
}
}
#endif