diff options
| author | Felix Morgner <felix.morgner@gmail.com> | 2025-07-25 22:59:30 +0200 |
|---|---|---|
| committer | Felix Morgner <felix.morgner@gmail.com> | 2025-07-25 22:59:30 +0200 |
| commit | d734f1e7803a756822524e0580ec8e9c93b821c6 (patch) | |
| tree | 28daa14da0ec330adaa87f1316167cf18274cfe4 /lib/src/turns-participant.c | |
| parent | fb2fbeca028d7a854df1c4b23bd0395d11e1f724 (diff) | |
| download | turns-d734f1e7803a756822524e0580ec8e9c93b821c6.tar.xz turns-d734f1e7803a756822524e0580ec8e9c93b821c6.zip | |
lib: make Turns.Participant comparablemain
Diffstat (limited to 'lib/src/turns-participant.c')
| -rw-r--r-- | lib/src/turns-participant.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/lib/src/turns-participant.c b/lib/src/turns-participant.c index c18ae69..38ba0cd 100644 --- a/lib/src/turns-participant.c +++ b/lib/src/turns-participant.c @@ -163,6 +163,23 @@ TurnsParticipant * turns_participant_new_with(gchar const * name, gfloat priorit return TURNS_PARTICIPANT(g_object_new(TURNS_TYPE_PARTICIPANT, "name", name, "priority", priority, "disposition", disposition, nullptr)); } +gint turns_participant_compare(TurnsParticipant const * self, TurnsParticipant const * other) +{ + g_return_val_if_fail(TURNS_IS_PARTICIPANT((GObject *)self), 0); + g_return_val_if_fail(TURNS_IS_PARTICIPANT((GObject *)other), 0); + + if (self->priority < other->priority) + { + return -1; + } + else if (self->priority > other->priority) + { + return 1; + } + + return 0; +} + gboolean turns_participant_get_active(TurnsParticipant const * self) { g_return_val_if_fail(TURNS_IS_PARTICIPANT((TurnsParticipant *)self), false); |
