Esempio n. 1
0
void KMessageJabber::slotGroupChatPresence(const XMPP::Jid& jid, const XMPP::Status& status)
{
  kDebug() << jid.full() << status.status();
  if (jid.full() == mPeerJid && !status.isAvailable())
  {
    emit connectionBroken();
  }
}
ArchiveDlg::ArchiveDlg(const XMPP::Jid &jid, PsiAccount *pa)
{
	max = 30;
	page_ = 0;
	setupUi(this);
	tw_log->setColumnCount(3);
	QStringList headers;
	headers << tr("Time") << tr("") << tr("Message");
	tw_log->setHeaderLabels(headers);
	setAttribute(Qt::WA_DeleteOnClose);
	setWindowTitle(tr("Archive for ") + jid.full());
#ifndef Q_WS_MAC
	setWindowIcon(IconsetFactory::icon("psi/history").icon());
#endif

	gct_ = NULL;

	pa_ = pa;
	jid_ = jid;

	last_ =  QDateTime::currentDateTime();

	connect(pb_close, SIGNAL(clicked()), this, SLOT(hide()));

	connect(calendar, SIGNAL(selectionChanged()), this, SLOT(dateSelected()));
	connect(calendar, SIGNAL(currentPageChanged(int, int)), this, SLOT(dateChanged(int, int)));

	connect(lw_conversations, SIGNAL(itemSelectionChanged()), this, SLOT(collectionSelected()));
	connect(lw_conversations, SIGNAL(customContextMenuRequested(const QPoint&)), this, SLOT(doCollectionContextMenu(const QPoint&)));
	lw_conversations->

	connect(tb_prevPage, SIGNAL(clicked()), this, SLOT(prevPage()));	connect(tb_nextPage, SIGNAL(clicked()), this, SLOT(nextPage()));

	gclt_ = new GetCollectionListTask(pa->client()->rootTask());
	connect(gclt_, SIGNAL(busy()), this, SLOT(busy()));
	connect(gclt_, SIGNAL(done()), this, SLOT(collectionListRetrieved()));
	connect(gclt_, SIGNAL(error()), this, SLOT(error()));

	gct_ = new GetCollectionTask(pa_->client()->rootTask());
	connect(gct_, SIGNAL(busy()), this, SLOT(busy()));
	connect(gct_, SIGNAL(done(int)), this, SLOT(collectionRetrieved(int)));
	connect(gct_, SIGNAL(msg(int, bool, const QString&)), this, SLOT(collectionMsg(int, bool, const QString&)));
	connect(gct_, SIGNAL(error()), this, SLOT(error()));
	
	QDate m(last_.date().year(), last_.date().month(), 1);
	gclt_->get(jid, m, 50);
//	X11WM_CLASS("history");
}
HistoryDlg::HistoryDlg(const XMPP::Jid& j, PsiAccount* pa)
: pa_(pa), jidFull_(j), from_(0), count_(30)
{
	setupUi(this);
	setModal(false);
	setAttribute(Qt::WA_DeleteOnClose);
	pa_->dialogRegister(this, jidFull_);
	setWindowTitle(tr("History for ") + j.full());
#ifndef Q_WS_MAC
	setWindowIcon(IconsetFactory::icon("psi/history").icon());
#endif


	DateTree->setHeaderLabel(tr("Date"));
	DateTree->setSortingEnabled(true);
	DateTree->setColumnHidden(1,true);
	connect(DateTree, SIGNAL(customContextMenuRequested(const QPoint &)), SLOT(doDateContextMenu(const QPoint &)));

	EventsTree->setColumnCount(4);
	QStringList headers;
	headers << tr("Type") << tr("Time") << tr("Origin") << tr("Text");
	EventsTree->setHeaderLabels(headers);
	EventsTree->sortItems(1,Qt::AscendingOrder);
	EventsTree->setSortingEnabled(true);
	EventsTree->setWordWrap(true);
	EventsTree->hideColumn(2);

	connect(EventsTree, SIGNAL(itemDoubleClicked(QTreeWidgetItem *, int)), SLOT(actionOpenEvent(QTreeWidgetItem *, int)));
	connect(EventsTree, SIGNAL(customContextMenuRequested(const QPoint &)), SLOT(doEventContextMenu(const QPoint &)));
	connect(tb_previousMonth, SIGNAL(clicked()), SLOT(doPrev()));
	connect(tb_latest, SIGNAL(clicked()), SLOT(doLatest()));
	connect(tb_nextMonth, SIGNAL(clicked()), SLOT(doNext()));
	connect(pb_find, SIGNAL(clicked()), SLOT(doFind()));
	connect(pb_export, SIGNAL(clicked()), SLOT(doExport()));
	connect(pb_close, SIGNAL(clicked()), SLOT(close()));

	jid_ = j.bare();
	doLatest();

	X11WM_CLASS("history");
}
Esempio n. 4
0
AddUserDlg::AddUserDlg(const XMPP::Jid &jid, const QString &nick, const QString &group, const QStringList &groups, PsiAccount *pa)
{
	init(groups, pa);

	le_jid->setText(jid.full());	// TODO: do we want to encourage adding jids with resource?
	le_nick->setText(nick);

	QStringList suggestedGroups = groups.filter(group, Qt::CaseInsensitive);
	if (suggestedGroups.size() > 0) {
		cb_group->lineEdit()->setText(suggestedGroups[0]);
	} else {
		cb_group->lineEdit()->setText(group);
	}

	QSize s(te_info->width(), w_serviceTranslation->sizeHint().height());
	w_serviceTranslation->hide();
	w_serviceTranslation->setEnabled(false);
	te_info->hide();

	resize(size() - s);
}
void JT_JingleRtp::request(const XMPP::Jid &to, const JingleRtpEnvelope &envelope)
{
    to_ = to;
    iq_ = createIQ(doc(), "set", to.full(), id());
    QDomElement query = doc()->createElement("jingle");
    query.setAttribute("xmlns", "urn:xmpp:jingle:1");
    query.setAttribute("action", envelope.action);
    if(!envelope.initiator.isEmpty())
        query.setAttribute("initiator", envelope.initiator);
    if(!envelope.responder.isEmpty())
        query.setAttribute("responder", envelope.responder);
    query.setAttribute("sid", envelope.sid);

    if(envelope.action == "session-terminate")
    {
        // for session terminate, there is no content list, just
        //   a reason for termination
        query.appendChild(reasonToElement(doc(), envelope.reason));
    }
    else
    {
        foreach(const JingleRtpContent &c, envelope.contentList)
        {
            QDomElement content = doc()->createElement("content");
            content.setAttribute("creator", c.creator);
            if(!c.disposition.isEmpty())
                content.setAttribute("disposition", c.disposition);
            content.setAttribute("name", c.name);
            if(!c.senders.isEmpty())
                content.setAttribute("senders", c.senders);

            if(!c.desc.media.isEmpty())
            {
                // TODO: ssrc, bitrate, crypto
                QDomElement description = doc()->createElement("description");
                description.setAttribute("xmlns", "urn:xmpp:jingle:apps:rtp:1");
                description.setAttribute("media", c.desc.media);
                foreach(const JingleRtpPayloadType &pt, c.desc.payloadTypes)
                {
                    QDomElement p = payloadTypeToElement(doc(), pt);
                    if(!p.isNull())
                        description.appendChild(p);
                }
                content.appendChild(description);
            }

            if(!c.trans.user.isEmpty())
            {
                QDomElement transport = doc()->createElement("transport");
                transport.setAttribute("xmlns", "urn:xmpp:jingle:transports:ice-udp:1");
                transport.setAttribute("ufrag", c.trans.user);
                transport.setAttribute("pwd", c.trans.pass);
                foreach(const XMPP::Ice176::Candidate &ic, c.trans.candidates)
                {
                    QDomElement e = candidateToElement(doc(), ic);
                    if(!e.isNull())
                        transport.appendChild(e);
                }
                content.appendChild(transport);
            }

            query.appendChild(content);
        }