コード例 #1
0
ファイル: server_events.c プロジェクト: dotoole/profanity
void
handle_room_roster_complete(const char * const room)
{
    if (muc_room_is_autojoin(room)) {
        ui_room_join(room, FALSE);
    } else {
        ui_room_join(room, TRUE);
    }
    muc_remove_invite(room);
    muc_set_roster_received(room);
    GList *roster = muc_get_roster(room);
    ui_room_roster(room, roster, NULL);

    char *subject = muc_get_subject(room);
    if (subject != NULL) {
        ui_room_subject(room, subject);
    }

    GList *pending_broadcasts = muc_get_pending_broadcasts(room);
    if (pending_broadcasts != NULL) {
        GList *curr = pending_broadcasts;
        while (curr != NULL) {
            ui_room_broadcast(room, curr->data);
            curr = g_list_next(curr);
        }
    }
}
コード例 #2
0
void
handle_room_broadcast(const char *const room_jid,
    const char * const message)
{
    ui_room_broadcast(room_jid, message);
    ui_current_page_off();
}
コード例 #3
0
ファイル: server_events.c プロジェクト: PMaynard/profanity
void
sv_ev_room_broadcast(const char *const room_jid,
    const char * const message)
{
    if (muc_roster_complete(room_jid)) {
        ui_room_broadcast(room_jid, message);
    } else {
        muc_pending_broadcasts_add(room_jid, message);
    }
}
コード例 #4
0
ファイル: server_events.c プロジェクト: dotoole/profanity
void
handle_room_broadcast(const char *const room_jid,
    const char * const message)
{
    if (muc_get_roster_received(room_jid)) {
        ui_room_broadcast(room_jid, message);
    } else {
        muc_add_pending_broadcast(room_jid, message);
    }
}
コード例 #5
0
ファイル: server_events.c プロジェクト: PMaynard/profanity
void
sv_ev_muc_self_online(const char * const room, const char * const nick, gboolean config_required,
    const char * const role, const char * const affiliation, const char * const actor, const char * const reason,
    const char * const jid, const char * const show, const char * const status)
{
    muc_roster_add(room, nick, jid, role, affiliation, show, status);
    char *old_role = muc_role_str(room);
    char *old_affiliation = muc_affiliation_str(room);
    muc_set_role(room, role);
    muc_set_affiliation(room, affiliation);

    // handle self nick change
    if (muc_nick_change_pending(room)) {
        muc_nick_change_complete(room, nick);
        ui_room_nick_change(room, nick);

    // handle roster complete
    } else if (!muc_roster_complete(room)) {
        if (muc_autojoin(room)) {
            ui_room_join(room, FALSE);
        } else {
            ui_room_join(room, TRUE);
        }

        iq_room_info_request(room, FALSE);

        muc_invites_remove(room);
        muc_roster_set_complete(room);

        // show roster if occupants list disabled by default
        if (!prefs_get_boolean(PREF_OCCUPANTS)) {
            GList *occupants = muc_roster(room);
            ui_room_roster(room, occupants, NULL);
            g_list_free(occupants);
        }

        char *subject = muc_subject(room);
        if (subject) {
            ui_room_subject(room, NULL, subject);
        }

        GList *pending_broadcasts = muc_pending_broadcasts(room);
        if (pending_broadcasts) {
            GList *curr = pending_broadcasts;
            while (curr) {
                ui_room_broadcast(room, curr->data);
                curr = g_list_next(curr);
            }
        }

        // room configuration required
        if (config_required) {
            muc_set_requires_config(room, TRUE);
            ui_room_requires_config(room);
        }

    // check for change in role/affiliation
    } else {
        if (prefs_get_boolean(PREF_MUC_PRIVILEGES)) {
            // both changed
            if ((g_strcmp0(role, old_role) != 0) && (g_strcmp0(affiliation, old_affiliation) != 0)) {
                ui_room_role_and_affiliation_change(room, role, affiliation, actor, reason);

            // role changed
            } else if (g_strcmp0(role, old_role) != 0) {
                ui_room_role_change(room, role, actor, reason);

            // affiliation changed
            } else if (g_strcmp0(affiliation, old_affiliation) != 0) {
                ui_room_affiliation_change(room, affiliation, actor, reason);
            }
        }
    }

    occupantswin_occupants(room);
}