diff options
Diffstat (limited to 'seggetd/response.cpp')
-rw-r--r-- | seggetd/response.cpp | 67 |
1 files changed, 67 insertions, 0 deletions
diff --git a/seggetd/response.cpp b/seggetd/response.cpp new file mode 100644 index 0000000..f8456c0 --- /dev/null +++ b/seggetd/response.cpp @@ -0,0 +1,67 @@ +/* +* Copyright (C) 2010 Robin H.Johnson, Ovechko Kostyantyn <fastinetserver@gmail.com>. +* +* Project: IDFetch. +* Developer: Ovechko Kostyantyn Olexandrovich (Kharkiv State Technical University of Construction and Architecture, Ukraine). +* Mentor: Robin H. Johnson (Gentoo Linux: Developer, Trustee & Infrastructure Lead). +* Mentoring organization: Gentoo Linux. +* Sponsored by GSOC 2010. +* +* This file is part of Segget. +* +* Segget is free software; you can redistribute it and/or +* modify it under the terms of the GNU Lesser General Public +* License as published by the Free Software Foundation; either +* version 2.1 of the License, or (at your option) any later version. +* +* Segget is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +* Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public +* License along with Segget; if not, write to the Free Software +* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +#include "response.h" +#include "tui.h" + +int decode_server_response(string server_response){ + int int_server_response=atoi(server_response.c_str()); + switch (int_server_response){ + case R_PF_NOT_REQUESTED_YET:{ + debug("Server response:"+server_response+" - R_PF_NOT_REQUESTED_YET"); + return int_server_response; + }; + case R_PF_REJECTED:{ + debug("Server response:"+server_response+" - R_PF_REJECTED"); + return int_server_response; + }; + case R_PF_ERROR_ADDING_TO_PROXY_QUEUE:{ + debug("Server response:"+server_response+" - R_PF_ERROR_ADDING_TO_PROXY_QUEUE"); + return int_server_response; + }; + case R_PF_ADDED_TO_PROXY_QUEUE:{ + debug("Server response:"+server_response+" - R_PF_ADDED_TO_PROXY_QUEUE"); + return int_server_response; + }; + case R_PF_ALREADY_WAS_IN_QUEUE:{ + debug("Server response:"+server_response+" - R_PF_ALREADY_WAS_IN_QUEUE"); + return int_server_response; + }; + case R_PF_DOWNLOADED:{ + debug("Server response:"+server_response+" - R_PF_DOWNLOADED"); + return int_server_response; + }; + case R_PF_FAILED:{ + debug("Server response:"+server_response+" - R_PF_FAILED"); + return int_server_response; + }; + default :{ + debug("Server response:"+server_response+" - unknown => R_PF_FAILED"); + return R_PF_FAILED; + }; + } +} + |