void PerformAction (T action, F fallback, ICLEntry *entry, const QString& text) { auto nicks = ParseNicks (entry, text); if (nicks.isEmpty ()) { if (entry->GetEntryType () == ICLEntry::EntryType::MUC) return; else nicks << entry->GetHumanReadableID (); } const auto& participants = GetParticipants (qobject_cast<IMUCEntry*> (entry->GetQObject ())); for (const auto& name : nicks) { const auto target = ResolveEntry (name.trimmed (), participants, entry->GetParentAccount (), entry); if (!target) { fallback (name); continue; } action (target, name); } }
QStringList GetMucParticipants (const QString& entryId) { const auto entry = qobject_cast<IMUCEntry*> (Core::Instance ().GetEntry (entryId)); if (!entry) { qWarning () << Q_FUNC_INFO << entry << "doesn't implement IMUCEntry"; return {}; } QStringList participantsList; for (const auto item : entry->GetParticipants ()) { const auto part = qobject_cast<ICLEntry*> (item); if (!part) { qWarning () << Q_FUNC_INFO << "unable to cast item to ICLEntry" << item; continue; } participantsList << part->GetEntryName (); } return participantsList; }
/* Called everytime we click the refresh button. This will request all participants and update the UI. */ void SelectorGUI::update(){ int x = 40; int y = 10; int dy = 20; int i = 0; int len = 0; swindow->clear(); swindow->redraw(); swindow->begin(); len = GetParticipants(pList); for(i; i < len; i ++){ ssrcList[i] = (char*)pList[i].ssrc; Fl_Check_Button* b = new Fl_Check_Button(x, y, 300, 30, pList[i].name); b->callback(static_selectCB, (void*) pList[i].ssrc); b->type(102); y = y + dy; } swindow->end(); swindow->redraw(); }
CConversation::CConversation(unsigned int oid, SERootObject* rootobj) : Conversation(oid, rootobj) { GetParticipants(m_participants, ALL); fetch(m_participants); }
void CConversation::OnParticipantListChange() { GetParticipants(m_participants, ALL); fetch(m_participants); }