Revision 71a04f89 plugins/janus_textroom.c

View differences:

plugins/janus_textroom.c
165 165

  
166 166
/* Useful stuff */
167 167
static volatile gint initialized = 0, stopping = 0;
168
static gboolean notify_events = TRUE;
168 169
static janus_callbacks *gateway = NULL;
169 170
static GThread *handler_thread;
170 171
static GThread *watchdog;
......
377 378
		janus_config_item *key = janus_config_get_item_drilldown(config, "general", "admin_key");
378 379
		if(key != NULL && key->value != NULL)
379 380
			admin_key = g_strdup(key->value);
381
		janus_config_item *events = janus_config_get_item_drilldown(config, "general", "events");
382
		if(events != NULL && events->value != NULL)
383
			notify_events = janus_is_true(events->value);
384
		if(!notify_events && callback->events_is_enabled()) {
385
			JANUS_LOG(LOG_WARN, "Notification of events to handlers disabled for %s\n", JANUS_TEXTROOM_NAME);
386
		}
380 387
		/* Iterate on all rooms */
381 388
		GList *cl = janus_config_get_categories(config);
382 389
		while(cl != NULL) {
......
912 919
			g_free(reply_text);
913 920
		}
914 921
		/* Also notify event handlers */
915
		if(gateway->events_is_enabled()) {
922
		if(notify_events && gateway->events_is_enabled()) {
916 923
			json_t *info = json_object();
917 924
			json_object_set_new(info, "event", json_string("join"));
918 925
			json_object_set_new(info, "room", json_integer(room_id));
......
979 986
			g_free(event_text);
980 987
		}
981 988
		/* Also notify event handlers */
982
		if(gateway->events_is_enabled()) {
989
		if(notify_events && gateway->events_is_enabled()) {
983 990
			json_t *info = json_object();
984 991
			json_object_set_new(info, "event", json_string("leave"));
985 992
			json_object_set_new(info, "room", json_integer(room_id));
......
1177 1184
			g_free(reply_text);
1178 1185
		}
1179 1186
		/* Also notify event handlers */
1180
		if(gateway->events_is_enabled()) {
1187
		if(notify_events && gateway->events_is_enabled()) {
1181 1188
			json_t *info = json_object();
1182 1189
			json_object_set_new(info, "event", json_string("created"));
1183 1190
			json_object_set_new(info, "room", json_integer(room_id));
......
1297 1304
		/* We'll let the watchdog worry about freeing resources */
1298 1305
		old_rooms = g_list_append(old_rooms, textroom);
1299 1306
		/* Also notify event handlers */
1300
		if(gateway->events_is_enabled()) {
1307
		if(notify_events && gateway->events_is_enabled()) {
1301 1308
			json_t *info = json_object();
1302 1309
			json_object_set_new(info, "event", json_string("destroyed"));
1303 1310
			json_object_set_new(info, "room", json_integer(room_id));

Also available in: Unified diff