handle,
(iksStreamHook *) (ldl_test_flag(handle, LDL_FLAG_COMPONENT) ? on_stream_component : on_stream));
- if (globals.debug) {
- iks_set_log_hook(handle->parser, (iksLogHook *) on_log);
- }
+
+ iks_set_log_hook(handle->parser, (iksLogHook *) on_log);
+
strncpy(tmp, jabber_id, sizeof(tmp)-1);
sl = strchr(tmp, '/');
}
+int ldl_global_debug(int on)
+{
+ if (on > -1) {
+ globals.debug = on ? 1 : 0;
+ }
+
+ return globals.debug ? 1 : 0;
+}
+
void ldl_global_set_logger(ldl_logger_t logger)
{
globals.logger = logger;
static switch_status_t dl_login(char *arg, switch_core_session_t *session, switch_stream_handle_t *stream);
static switch_status_t dl_logout(char *profile_name, switch_core_session_t *session, switch_stream_handle_t *stream);
static switch_status_t dl_pres(char *profile_name, switch_core_session_t *session, switch_stream_handle_t *stream);
+static switch_status_t dl_debug(char *profile_name, switch_core_session_t *session, switch_stream_handle_t *stream);
static switch_status_t channel_on_init(switch_core_session_t *session);
static switch_status_t channel_on_hangup(switch_core_session_t *session);
static switch_status_t channel_on_ring(switch_core_session_t *session);
};
+static switch_api_interface_t debug_api_interface = {
+ /*.interface_name */ "dl_debug",
+ /*.desc */ "DingaLing Presence",
+ /*.function */ dl_debug,
+ /*.syntax */ "dl_debug [true|false]",
+ /*.next */ NULL
+};
+
static switch_api_interface_t pres_api_interface = {
/*.interface_name */ "dl_pres",
/*.desc */ "DingaLing Presence",
/*.function */ dl_pres,
/*.syntax */ "dl_pres <profile_name>",
- /*.next */ NULL
+ /*.next */ &debug_api_interface
};
static switch_api_interface_t logout_api_interface = {
}
}
+static switch_status_t dl_debug(char *tf, switch_core_session_t *session, switch_stream_handle_t *stream)
+{
+ int on, cur;
+
+ if (session) {
+ return SWITCH_STATUS_FALSE;
+ }
+
+ if (tf) {
+ on = switch_true(tf);
+ cur = ldl_global_debug(on);
+ } else {
+ cur = ldl_global_debug(-1);
+ }
+
+
+ stream->write_function(stream, "DEBUG IS NOW %s\n", cur ? "ON" : "OFF");
+
+ return SWITCH_STATUS_SUCCESS;
+}
+
static switch_status_t dl_pres(char *profile_name, switch_core_session_t *session, switch_stream_handle_t *stream)
{
mdl_profile_t *profile;