indent pass 2

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@8689 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Anthony Minessale committed 2008-05-27 04:54:52 +00:00
1 parent 9bbcabbbdd
commit f930eaeec7
101 files changed
+31644 -31458

No files matched your search

+27 -24
View File
@@ -8,17 +8,17 @@ static STRLEN n_a;
using namespace PERL;
Session::Session() : CoreSession()
Session::Session():CoreSession()
{
init_me();
}
Session::Session(char *uuid) : CoreSession(uuid)
Session::Session(char *uuid):CoreSession(uuid)
{
init_me();
}
Session::Session(switch_core_session_t *new_session) : CoreSession(new_session)
Session::Session(switch_core_session_t *new_session):CoreSession(new_session)
{
init_me();
}
@@ -37,19 +37,19 @@ Session::~Session()
}
bool Session::begin_allow_threads()
bool Session::begin_allow_threads()
{
do_hangup_hook();
return true;
}
bool Session::end_allow_threads()
bool Session::end_allow_threads()
{
do_hangup_hook();
return true;
}
void Session::setPERL(PerlInterpreter *pi)
void Session::setPERL(PerlInterpreter * pi)
{
my_perl = pi;
}
@@ -57,30 +57,31 @@ void Session::setPERL(PerlInterpreter *pi)
PerlInterpreter *Session::getPERL()
{
if (!my_perl) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Doh!\n");
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Doh!\n");
}
return my_perl;
}
bool Session::ready() {
bool Session::ready()
{
bool r;
sanity_check(false);
sanity_check(false);
r = switch_channel_ready(channel) != 0;
do_hangup_hook();
return r;
}
void Session::check_hangup_hook()
void Session::check_hangup_hook()
{
if (hangup_func_str && (hook_state == CS_HANGUP || hook_state == CS_ROUTING)) {
hh++;
}
}
void Session::do_hangup_hook()
void Session::do_hangup_hook()
{
if (hh && !mark) {
const char *err = NULL;
@@ -101,7 +102,7 @@ void Session::do_hangup_hook()
}
}
static switch_status_t perl_hanguphook(switch_core_session_t *session_hungup)
static switch_status_t perl_hanguphook(switch_core_session_t *session_hungup)
{
switch_channel_t *channel = switch_core_session_get_channel(session_hungup);
CoreSession *coresession = NULL;
@@ -118,7 +119,8 @@ static switch_status_t perl_hanguphook(switch_core_session_t *session_hungup)
}
void Session::setHangupHook(char *func, char *arg) {
void Session::setHangupHook(char *func, char *arg)
{
sanity_check_noreturn;
@@ -135,7 +137,8 @@ void Session::setHangupHook(char *func, char *arg) {
}
}
void Session::setInputCallback(char *cbfunc, char *funcargs) {
void Session::setInputCallback(char *cbfunc, char *funcargs)
{
sanity_check_noreturn;
@@ -148,22 +151,22 @@ void Session::setInputCallback(char *cbfunc, char *funcargs) {
if (funcargs) {
cb_arg = strdup(funcargs);
}
args.buf = this;
switch_channel_set_private(channel, "CoreSession", this);
args.input_callback = dtmf_callback;
args.input_callback = dtmf_callback;
ap = &args;
}
switch_status_t Session::run_dtmf_callback(void *input, switch_input_type_t itype)
switch_status_t Session::run_dtmf_callback(void *input, switch_input_type_t itype)
{
if (!getPERL()) {
return SWITCH_STATUS_FALSE;;
}
switch (itype) {
case SWITCH_INPUT_TYPE_DTMF:
case SWITCH_INPUT_TYPE_DTMF:
{
switch_dtmf_t *dtmf = (switch_dtmf_t *) input;
char str[32] = "";
@@ -177,14 +180,14 @@ switch_status_t Session::run_dtmf_callback(void *input, switch_input_type_t ityp
}
str[0] = dtmf->digit;
this_sv = newSV(strlen(str)+1);
this_sv = newSV(strlen(str) + 1);
sv_setpv(this_sv, str);
hv_store(hash, "digit", 5, this_sv, 0);
switch_snprintf(str, sizeof(str), "%d", dtmf->duration);
this_sv = newSV(strlen(str)+1);
this_sv = newSV(strlen(str) + 1);
sv_setpv(this_sv, str);
hv_store(hash, "duration", 8, this_sv, 0);
hv_store(hash, "duration", 8, this_sv, 0);
code = switch_mprintf("$__RV = %s('dtmf', \\%%__dtmf, %s);", cb_function, switch_str_nil(cb_arg));
Perl_eval_pv(my_perl, code, FALSE);
@@ -193,18 +196,18 @@ switch_status_t Session::run_dtmf_callback(void *input, switch_input_type_t ityp
return process_callback_result(SvPV(get_sv("__RV", TRUE), n_a));
}
break;
case SWITCH_INPUT_TYPE_EVENT:
case SWITCH_INPUT_TYPE_EVENT:
{
switch_event_t *event = (switch_event_t *) input;
int arg_count = 2;
char *code;
mod_perl_conjure_event(my_perl, event, "__Input_Event__");
code = switch_mprintf("$__RV = %s('event', $__Input_Event__, %s);", cb_function, switch_str_nil(cb_arg));
Perl_eval_pv(my_perl, code, TRUE);
free(code);
return process_callback_result(SvPV(get_sv("__RV", TRUE), n_a));
}
break;