diff options
author | Teddy <[email protected]> | 2013-09-01 10:32:23 +0800 |
---|---|---|
committer | Teddy <[email protected]> | 2013-09-01 10:32:23 +0800 |
commit | 096ca60866991ccfd218c7af9b79757cd4fdd4c5 (patch) | |
tree | 9b6b48c59d9f82c7ddaaa92713090fd099dba891 | |
parent | c2ac1f73431bbcef437aac017465865e5fb086d9 (diff) |
ptp v2.0d
-rw-r--r-- | server/piztor/mesg_sender.py | 10 | ||||
-rw-r--r-- | server/piztor/ptp.rst | 6 | ||||
-rw-r--r-- | server/piztor/ptp_send.py | 4 | ||||
-rw-r--r-- | server/piztor/server.py | 6 |
4 files changed, 17 insertions, 9 deletions
diff --git a/server/piztor/mesg_sender.py b/server/piztor/mesg_sender.py index f7df236..c3fc385 100644 --- a/server/piztor/mesg_sender.py +++ b/server/piztor/mesg_sender.py @@ -20,11 +20,11 @@ if len(argv) == 4: token = user_auth(username, password) -update_location(token, username, 31.028616, 121.434661) -update_location(token, username, 31.028616, 121.434661) -set_marker(token, username, 10.028716, 121.545661, 0x7fffffff) -send_text_mesg(token, username, mesg) +#update_location(token, username, 31.028616, 121.434661) +#update_location(token, username, 31.028616, 121.434661) +#set_marker(token, username, 10.028716, 121.545661, 0x7fffffff) +#send_text_mesg(token, username, mesg) #send_text_mesg(token, username, "a") #send_text_mesg(token, username, "the last") - +update_sub(token, username, [(0, 0)]) logout(token, username) diff --git a/server/piztor/ptp.rst b/server/piztor/ptp.rst index 4473e5c..24a9612 100644 --- a/server/piztor/ptp.rst +++ b/server/piztor/ptp.rst @@ -1,4 +1,4 @@ -Piztor Transmission Protocol v2.0c +Piztor Transmission Protocol v2.0d ---------------------------------- - Pull @@ -176,6 +176,10 @@ Piztor Transmission Protocol v2.0c +--------+ | STATUS | +--------+ + + - ``0x00`` for success + - ``0x01`` for invalid token + - ``0x04`` for group not found - User Logout ``0x04`` diff --git a/server/piztor/ptp_send.py b/server/piztor/ptp_send.py index 6c3b476..42a566d 100644 --- a/server/piztor/ptp_send.py +++ b/server/piztor/ptp_send.py @@ -24,8 +24,8 @@ class _SectionSize: LOCATION_ENTRY = USER_ID + LATITUDE + LONGITUDE PADDING = 1 -host = "202.120.7.4" -#host = "localhost" +#host = "202.120.7.4" +host = "localhost" port = 2223 def pack_data(optcode, data): diff --git a/server/piztor/server.py b/server/piztor/server.py index 9435ccc..512eb68 100644 --- a/server/piztor/server.py +++ b/server/piztor/server.py @@ -70,6 +70,7 @@ class _StatusCode: auth_fail = 0x01 insuf_lvl = 0x02 wrong_pass = 0x03 + grp_not_found = 0x04 class PushData(object): from hashlib import sha256 @@ -476,7 +477,10 @@ class UpdateSubscription(RequestHandler): logger.warning("Authentication failure") return self.pack(struct.pack("!B", _StatusCode.auth_fail)) - uauth.user.sub = map(self._find_group, sub_list) + try: + uauth.user.sub = map(self._find_group, sub_list) + except BadReqError: + return self.pack(struct.pack("!B", _StatusCode.grp_not_found)) self.session.commit() logger.info("Subscription is updated sucessfully") |