basic_action.cc
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #include <astxx/manager/connection.h>
00022 #include <astxx/manager/basic_action.h>
00023 #include <astxx/manager/message.h>
00024 #include <astxx/manager/error.h>
00025
00026 namespace astxx {
00027 namespace manager {
00048 message::response basic_action::handle_response(message::response response) {
00049 if (response == "Error") {
00050 if (response["Message"] == permission_error_string) {
00051 throw manager::permission_denied();
00052 }
00053 else if (response["Message"] == authentication_error_string) {
00054 throw manager::authentication_required();
00055 }
00056 else if (response["Message"] == "No timeout specified") {
00057 throw action::missing_data(response["Message"], action());
00058 }
00059 else if (response["Message"] == "No channel specified") {
00060 throw action::missing_data(response["Message"], action());
00061 }
00062 else if (response["Message"] == "Channel not specified") {
00063 throw action::missing_data(response["Message"], action());
00064 }
00065 else if (response["Message"] == "Extension not specified") {
00066 throw action::missing_data(response["Message"], action());
00067 }
00068 else if (response["Message"] == "No variable specified") {
00069 throw action::missing_data(response["Message"], action());
00070 }
00071 else if (response["Message"] == "No value specified") {
00072 throw action::missing_data(response["Message"], action());
00073 }
00074 else if (response["Message"] == "Mailbox not specified") {
00075 throw action::missing_data(response["Message"], action());
00076 }
00077 else if (response["Message"] == "Invalid priority") {
00078 throw action::bad_data(response["Message"], action());
00079 }
00080 else if (response["Message"] == "Invalid channel") {
00081 throw action::bad_data(response["Message"], action());
00082 }
00083 else if (response["Message"] == "Invalid timeout") {
00084 throw action::bad_data(response["Message"], action());
00085 }
00086 else if (response["Message"] == "No such channel") {
00087 throw action::channel_not_found(response["Message"], action());
00088 }
00089 }
00090 return response;
00091 }
00092
00103 message::response basic_action::operator()(connection& c) {
00104 return handle_response(c(*this));
00105 }
00106 }
00107 }
00108