Bazaar/Protect : Client/Server working now

git-svn-id: svn://ultimatepp.org/upp/trunk@2786 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
micio 2010-10-13 23:34:40 +00:00
parent 2073f18e1d
commit 408d643f4c
4 changed files with 32 additions and 8 deletions

View file

@ -31,6 +31,7 @@ ProtectClientDemo::ProtectClientDemo()
disconnectButton <<= THISBACK1(onAction, PROTECT_DISCONNECT);
getKeyButton <<= THISBACK1(onAction, PROTECT_GETKEY);
getInfoButton <<= THISBACK1(onAction, PROTECT_GETLICENSEINFO);
setInfoButton <<= THISBACK1(onAction, PROTECT_UPDATEUSERDATA);
quitButton <<= Breaker();
@ -47,8 +48,8 @@ void ProtectClientDemo::onAction(int reason)
responseText <<= "";
// setup client url and key
client.SetURL("localhost/scgi/testing");
// client.SetURL("www.timberstruct.it/scgi/testing");
// client.SetURL("localhost/scgi/testing");
client.SetURL("timberstruct.it/scgi/testing");
client.SetKey(ScanHexString("aabbccddeeff00112233445566778899"));
// sets user data
@ -91,7 +92,21 @@ void ProtectClientDemo::onAction(int reason)
case PROTECT_GETLICENSEINFO : // gets info about license (name, expiration date, app version....)
if(!client.GetLicenseInfo())
res += "GETLICENSEINFO ERROR\n";
else
{
nameEdit <<= client.GetUserName();
addressEdit <<= client.GetUserAddress();
countryEdit <<= client.GetUserCountry();
zipEdit <<= client.GetUserZip();
phoneEdit <<= client.GetUserPhone();
faxEdit <<= client.GetUserFax();
cellEdit <<= client.GetUserCell();
emailEdit <<= client.GetUserEMail();
}
break;
case PROTECT_UPDATEUSERDATA :
if(!client.UpdateUserData())
res += "UPDATEUSERDATA ERROR\n";
default:
break;
}

View file

@ -16,13 +16,14 @@ LAYOUT(ProtectClientDemoLayout, 552, 456)
ITEM(EditString, faxEdit, LeftPosZ(228, 108).TopPosZ(76, 19))
ITEM(EditString, cellEdit, LeftPosZ(400, 148).TopPosZ(76, 19))
ITEM(EditString, emailEdit, LeftPosZ(56, 200).TopPosZ(100, 19))
ITEM(Button, registerButton, SetLabel(t_("Register")).LeftPosZ(4, 68).TopPosZ(124, 20))
ITEM(Button, connectButton, SetLabel(t_("Connect")).LeftPosZ(80, 68).TopPosZ(124, 20))
ITEM(Button, refreshButton, SetLabel(t_("Refresh")).LeftPosZ(156, 68).TopPosZ(124, 20))
ITEM(Button, disconnectButton, SetLabel(t_("Disconnect")).LeftPosZ(232, 68).TopPosZ(124, 20))
ITEM(Button, getKeyButton, SetLabel(t_("Get Key")).HSizePosZ(308, 176).TopPosZ(124, 20))
ITEM(Button, getInfoButton, SetLabel(t_("Get Info")).HSizePosZ(384, 100).TopPosZ(124, 20))
ITEM(Button, registerButton, SetLabel(t_("Register")).LeftPosZ(4, 60).TopPosZ(124, 20))
ITEM(Button, connectButton, SetLabel(t_("Connect")).LeftPosZ(72, 60).TopPosZ(124, 20))
ITEM(Button, refreshButton, SetLabel(t_("Refresh")).LeftPosZ(140, 60).TopPosZ(124, 20))
ITEM(Button, disconnectButton, SetLabel(t_("Disconnect")).LeftPosZ(208, 60).TopPosZ(124, 20))
ITEM(Button, getKeyButton, SetLabel(t_("Get Key")).HSizePosZ(276, 216).TopPosZ(124, 20))
ITEM(Button, setInfoButton, SetLabel(t_("Set Info")).HSizePosZ(412, 80).TopPosZ(124, 20))
ITEM(Button, quitButton, SetLabel(t_("Quit")).LeftPosZ(480, 68).TopPosZ(124, 20))
ITEM(LineEdit, responseText, SetEditable(false).SetFrame(NullFrame()).LeftPosZ(4, 544).TopPosZ(176, 276))
ITEM(Button, getInfoButton, SetLabel(t_("Get Info")).HSizePosZ(344, 148).TopPosZ(124, 20))
END_LAYOUT

View file

@ -0,0 +1,4 @@
#ifndef _ProtectServerDemo_icpp_init_stub
#define _ProtectServerDemo_icpp_init_stub
#include "Protect/init"
#endif

View file

@ -20,6 +20,10 @@ CONSOLE_APP_MAIN
.Host("localhost")
.Port(25)
;
server
.SetWelcome("<HTML><BODY>License activation succeeded<BR><BR>Welcome to TIMBERSTRUCT, %USER%<BR></BODY></HTML>")
.SetActivationFailed("<HTML><BODY>We're sorry but product activation failed, %USER%<BR><BR>Please contact us to solve the problem<BR></BODY></HTML>")
;
// setup key
server.SetKey(ScanHexString("aabbccddeeff00112233445566778899"));