Revision
14296
Author
mrene
Date
2009-07-18 14:22:27 -0500 (Sat, 18 Jul 2009)

Log Message

MODENDP-230

Modified Paths

Diff

Modified: freeswitch/trunk/src/mod/endpoints/mod_dingaling/mod_dingaling.c (14295 => 14296)


--- freeswitch/trunk/src/mod/endpoints/mod_dingaling/mod_dingaling.c	2009-07-18 19:20:21 UTC (rev 14295)
+++ freeswitch/trunk/src/mod/endpoints/mod_dingaling/mod_dingaling.c	2009-07-18 19:22:27 UTC (rev 14296)
@@ -799,7 +799,7 @@
 	ldl_handle_run(handle);
 	switch_clear_flag(profile, TFLAG_IO);
 	globals.handles--;
-	ldl_handle_destroy(&handle);
+	ldl_handle_destroy(&profile->handle);
 	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Handle %s [%s] Destroyed\n", profile->name, profile->login);
 
 	return NULL;
@@ -2110,9 +2110,11 @@
 		return SWITCH_STATUS_SUCCESS;
 	}
 
-	if ((profile = switch_core_hash_find(globals.profile_hash, cmd))) {
+	if (((profile = switch_core_hash_find(globals.profile_hash, cmd))) && profile->handle) {
 		ldl_handle_stop(profile->handle);
 		stream->write_function(stream, "OK\n");
+	} else if (profile) {
+		stream->write_function(stream, "NOT LOGGED IN\n");
 	} else {
 		stream->write_function(stream, "NO SUCH PROFILE %s\n", cmd);
 	}
@@ -2149,9 +2151,9 @@
 			switch_hash_this(hi, NULL, NULL, &val);
 			profile = (mdl_profile_t *) val;
 			stream->write_function(stream, "%s	|	", profile->login);
-			if (ldl_handle_authorized(profile->handle)){
+			if (profile->handle && ldl_handle_authorized(profile->handle)){
 				stream->write_function(stream, "AUTHORIZED");
-			} else if (ldl_handle_connected(profile->handle)){
+			} else if (profile->handle && ldl_handle_connected(profile->handle)){
 				stream->write_function(stream, "CONNECTED");
 			} else {
 				stream->write_function(stream, "UNCONNECTED");