static gboolean parse_participant()

in chime/chime-call.c [346:402]


static gboolean parse_participant(ChimeConnection *cxn, ChimeCall *call, JsonNode *p,
				  ChimeCallParticipant **presenter)
{
	const gchar *participant_id, *full_name, *participant_type, *video_present;
	gboolean pots, speaker;
	ChimeCallParticipationStatus status;

	if (!parse_string(p, "participant_id", &participant_id) ||
	    !parse_string(p, "full_name", &full_name) ||
	    !parse_string(p, "participant_type", &participant_type) ||
	    !parse_call_participation_status(p, "status", &status) ||
	    !parse_boolean(p, "pots?", &pots) ||
	    !parse_boolean(p, "speaker?", &speaker) ||
	    !parse_string(p, "video_indicator", &video_present))
		return FALSE;

	const gchar *email = NULL;
	parse_string(p, "email", &email);

	ChimeCallSharedScreenStatus screen = CHIME_SHARED_SCREEN_NONE;
	parse_call_shared_screen_status(p, "shared_screen_indicator", &screen);

	ChimeCallParticipant *cp = g_hash_table_lookup(call->participants, (void *)participant_id);
	if (!cp) {
		cp = g_new0(ChimeCallParticipant, 1);
		cp->volume = -128;
		cp->participant_id = g_strdup(participant_id);
		cp->participant_type = g_strdup(participant_type);
		cp->full_name = g_strdup(full_name);
		if (email)
			cp->email = g_strdup(email);
		g_hash_table_insert(call->participants, (void *)cp->participant_id, cp);
	}
	cp->pots = pots;
	cp->speaker = speaker;
	cp->status = status;
	cp->shared_screen = screen;

	if(!strcmp(video_present, "none"))
		cp->video_present = FALSE;
	else
		cp->video_present = TRUE;

	if (screen == CHIME_SHARED_SCREEN_PRESENTING)
		*presenter = cp;

	if (!strcmp(participant_id, chime_connection_get_profile_id(cxn))) {
		JsonObject *obj = json_node_get_object(p);
		JsonNode *muter = json_object_get_member(obj, "muter");
		if (muter && json_node_get_node_type(muter) != JSON_NODE_NULL) {
			if (call->audio)
				chime_call_audio_local_mute(call->audio, TRUE);
		}
	}

	return TRUE;
}