Esempio n. 1
0
void P2pContext::setPeerInfo(uint8_t protocolVersion, PeerIdType id, uint16_t port) {
  version = protocolVersion;
  peerId = id;
  if (isIncoming()) {
    peerPort = port;
  }
}
Esempio n. 2
0
void
SIPCall::refuse()
{
    if (!isIncoming() or getConnectionState() == ConnectionState::CONNECTED or !inv)
        return;

    stopAllMedia();

    // Notify the peer
    terminateSipSession(PJSIP_SC_DECLINE);

    setState(Call::ConnectionState::DISCONNECTED, ECONNABORTED);
    removeCall();
}
Esempio n. 3
0
MessageUnitData Message::unitData() const
{
    QObject *source = 0;
    QString id = property("senderId", QString());
    QString title = property("senderName", QString());
    QString avatar = property("senderAvatar", QString());
    if (!title.isEmpty()) {
        if (avatar.isEmpty()) {
            if (!id.isEmpty())
                source = chatUnit()->account()->getUnit(id, false);
            if (source)
                avatar = source->property("avatar").toString();
        }
        return MessageUnitData(id, title, avatar);
	}
	if (!source && chatUnit()) {
		if (!isIncoming()) {
			const Conference *conf = qobject_cast<const Conference*>(chatUnit());
			if (conf && conf->me())
				source = conf->me();
			else
				source = chatUnit()->account();
		} else {
			source = chatUnit();
		}
	}
    if (!source)
        return MessageUnitData(id, title, avatar);
    if (avatar.isEmpty())
        avatar = source->property("avatar").toString();
	if (ChatUnit *unit = qobject_cast<ChatUnit*>(source)) {
        id = unit->id();
        title = unit->title();
	} else if (Account *account = qobject_cast<Account*>(source)) {
        id = account->id();
        title = account->name();
    }
    return MessageUnitData(id, title, avatar);
}