aboutsummaryrefslogtreecommitdiff
path: root/ui.cpp
diff options
context:
space:
mode:
authorsirius-m <sirius-m@1a98c847-1fd6-4fd8-948a-caf3550aa51b>2010-02-04 15:31:46 +0000
committersirius-m <sirius-m@1a98c847-1fd6-4fd8-948a-caf3550aa51b>2010-02-04 15:31:46 +0000
commit082e725b33addda32ec4b31eba60b47f0dc6879f (patch)
tree17f221a28133394f5a0cd0931ceadf0eaa463cb4 /ui.cpp
parent53d508072b02d522371bde148dcc3e925f472be7 (diff)
downloadbitcoin-082e725b33addda32ec4b31eba60b47f0dc6879f.tar.xz
Added some basic IPC functionality using wxServer, wxClient and wxConnection.
Added the -blockamount command line option for an example of usage. git-svn-id: https://bitcoin.svn.sourceforge.net/svnroot/bitcoin/trunk@56 1a98c847-1fd6-4fd8-948a-caf3550aa51b
Diffstat (limited to 'ui.cpp')
-rw-r--r--ui.cpp29
1 files changed, 27 insertions, 2 deletions
diff --git a/ui.cpp b/ui.cpp
index 5d93ad227f..1f22170302 100644
--- a/ui.cpp
+++ b/ui.cpp
@@ -21,6 +21,7 @@ DEFINE_EVENT_TYPE(wxEVT_REPLY3)
CMainFrame* pframeMain = NULL;
CMyTaskBarIcon* ptaskbaricon = NULL;
+CServer* pserver = NULL;
map<string, string> mapAddressBook;
bool fRandSendTest = false;
void RandSend();
@@ -384,6 +385,8 @@ CMainFrame::~CMainFrame()
pframeMain = NULL;
delete ptaskbaricon;
ptaskbaricon = NULL;
+ delete pserver;
+ pserver = NULL;
}
void ExitTimeout(void* parg)
@@ -1687,8 +1690,8 @@ CAboutDialog::CAboutDialog(wxWindow* parent) : CAboutDialogBase(parent)
#if !wxUSE_UNICODE
// Workaround until upgrade to wxWidgets supporting UTF-8
wxString str = m_staticTextMain->GetLabel();
- if (str.Find('Â') != wxNOT_FOUND)
- str.Remove(str.Find('Â'), 1);
+ if (str.Find('�') != wxNOT_FOUND)
+ str.Remove(str.Find('�'), 1);
m_staticTextMain->SetLabel(str);
#endif
#ifndef __WXMSW__
@@ -3548,6 +3551,26 @@ bool CMyApp::OnInit2()
return false;
}
+ if (mapArgs.count("-blockamount")) {
+ CClient client;
+ wxString hostname = "localhost";
+ wxString server = GetDataDir() + "service";
+ CClientConnection * pconnection = (CClientConnection *)client.MakeConnection(hostname, server, "ipc test");
+ string output = "";
+ if (pconnection) {
+ char * pbuffer = (char *)pconnection->Request("blockamount");
+ while (*pbuffer != '\n') {
+ output += *pbuffer;
+ pbuffer++;
+ }
+ }
+ else {
+ output = "Cannot access Bitcoin. Are you sure the program is running?\n";
+ }
+ fprintf(stderr, "%s", output.c_str());
+ return false;
+ }
+
if (mapArgs.count("-datadir"))
strlcpy(pszSetDataDir, mapArgs["-datadir"].c_str(), sizeof(pszSetDataDir));
@@ -3755,6 +3778,8 @@ bool CMyApp::OnInit2()
if (fFirstRun)
SetStartOnSystemStartup(true);
+ pserver = new CServer;
+ pserver->Create(GetDataDir() + "service");
//
// Tests