/* * PostfixPolicyProtocol.cpp * * Created on: 27.03.2013 * Author: wn */ #include #include "PostfixPolicyProtocol.hpp" using namespace std; PostfixPolicyProtocol::PostfixPolicyProtocol() { sender = ""; recipient = ""; } void PostfixPolicyProtocol::processInput() { while (1) { string buffer; getline(cin, buffer); if (0 == buffer.length()) break; string::size_type equalsIdx = buffer.find('='); if (string::npos != equalsIdx) { string key = buffer.substr(0, equalsIdx); string value = buffer.substr(equalsIdx+1); if ("sender" == key) sender = value; if ("recipient" ==key) recipient = value; } } if ((0 == sender.length()) || (0 == recipient.length())) throw InvalidAddressTuple(); } void PostfixPolicyProtocol::sendResult(string const& result) { cout << "action=" << result << endl << endl; }