Changeset 6 in chevmsgr for trunk/msgsrv.cpp


Ignore:
Timestamp:
08/29/15 02:20:50 (9 years ago)
Author:
cheese
Message:

modify client interface and message protocol

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/msgsrv.cpp

    r4 r6  
    283283}
    284284
    285 static bool command(const Message::Parser & parser)
     285static bool command(const Protocol::Message & parser)
    286286{
    287287    bool isContinued = true;
     
    305305}
    306306
    307 static std::string httpSMS(const Message::Parser & parser)
     307static std::string httpSMS(const Protocol::Message & parser)
    308308{
    309309    std::string phone = parser.get<std::string>("phone");
     
    319319        CRLF;
    320320
    321     Message::Response response;
     321    Protocol::Response response;
    322322    cf::network::tcp smsSock;
    323323    cf::network::host smsServer(url, 80);
     
    330330}
    331331
    332 static bool join(const Message::Parser & parser, const std::string & sms, const std::string & address)
     332static bool join(const Protocol::Message & parser, const std::string & sms, const std::string & address)
    333333    throw (cf::exception)
    334334{
     
    342342}
    343343
    344 static bool login(const Message::Parser & parser)
     344static bool login(const Protocol::Message & parser)
    345345    throw (cf::exception)
    346346{
     
    351351}
    352352
    353 static bool chat(const Message::Parser & parser,
     353static bool chat(const Protocol::Message & parser,
    354354                 const std::string & message)
    355355{
     
    381381        while (true)
    382382        {
    383             Message::Parser parser;
     383            Protocol::Message parser;
    384384            parser.parse(sock.receive().toString());
    385385
     
    417417        workerInitiator(*sock);
    418418
    419         Message::Response response;
     419        Protocol::Response response;
    420420        bool result = true;
    421421
     
    423423        {
    424424            std::string message = sock->receive().toString();
    425             Message::Parser parser;
     425            Protocol::Message parser;
    426426            parser.parse(message);
    427427
     
    433433                result = chat(parser, message);
    434434
    435             sock->send(response.result(result));
     435            sock->send(response.result(parser.type(), result));
    436436        }
    437437    }
Note: See TracChangeset for help on using the changeset viewer.