本文整理汇总了C++中JID类的典型用法代码示例。如果您正苦于以下问题:C++ JID类的具体用法?C++ JID怎么用?C++ JID使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了JID类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getLastPresence
Presence::ref PresenceOracle::getLastPresence(const JID& jid) const {
PresencesMap::const_iterator i = entries_.find(jid.toBare());
if (i == entries_.end()) {
return Presence::ref();
}
PresenceMap presenceMap = i->second;
PresenceMap::const_iterator j = presenceMap.find(jid);
if (j != presenceMap.end()) {
return j->second;
}
else {
return Presence::ref();
}
}
示例2: handleSubscriptionRequest
virtual bool handleSubscriptionRequest( const JID& jid, const std::string& /*msg*/ ) //发生收到好友请求(添加联系人-1)
{
//ack {false, true} {拒绝联系人请求,同意联系人请求}
bool ack = true;
printf( "subscription: %s\n", jid.bare().c_str() );
StringList groups;
groups.push_back("Group-1");
JID id( jid );
//添加到了本地花名册
j->rosterManager()->subscribe( id, "", groups, "" );
return ack;
}
示例3: handleVCardReceived
void MainController::handleVCardReceived(const JID& jid, VCard::ref vCard) {
if (!jid.equals(jid_, JID::WithoutResource) || !vCard) {
return;
}
std::string hash;
if (!vCard->getPhoto().empty()) {
hash = Hexify::hexify(networkFactories_->getCryptoProvider()->getSHA1Hash(vCard->getPhoto()));
}
if (hash != vCardPhotoHash_) {
vCardPhotoHash_ = hash;
if (client_ && client_->isAvailable()) {
sendPresence(statusTracker_->getNextPresence());
}
}
}
示例4: remove
void RosterManager::remove( const JID& jid )
{
const std::string& id = m_parent->getID();
Tag *iq = new Tag( "iq" );
iq->addAttribute( "type", "set" );
iq->addAttribute( "id", id );
Tag *q = new Tag( iq, "query" );
q->addAttribute( "xmlns", XMLNS_ROSTER );
Tag *i = new Tag( q, "item" );
i->addAttribute( "jid", jid.bare() );
i->addAttribute( "subscription", "remove" );
m_parent->send( iq );
}
示例5: rejectInBandBytestream
void InBandBytestreamManager::rejectInBandBytestream( InBandBytestream *ibb,
const JID& from, const std::string& id )
{
delete ibb;
Tag *iq = new Tag( "iq" );
iq->addAttribute( "type", "error" );
iq->addAttribute( "to", from.full() );
iq->addAttribute( "id", id );
Tag *e = new Tag( iq, "error" );
e->addAttribute( "code", "501" );
e->addAttribute( "type", "cancel" );
Tag *f = new Tag( e, "feature-not-implemented" );
f->addAttribute( "xmlns", XMLNS_XMPP_STANZAS );
m_parent->send( iq );
}
示例6: field
void JAccountRegistrationPage::onSuccess()
{
ui->errorLabel->setText(QString());
m_registered = true;
if (m_jabberForm) {
DataForm::Ptr form = m_jabberForm->getDataForm();
DataFormField jidField = form->field(QLatin1String("username"));
QString server = field(QLatin1String("server")).toString();
JID jid = jidField.value() + QLatin1Char('@') + server;
setField(QLatin1String("jid"), jid.bare());
setField(QLatin1String("password"), QString());
setField(QLatin1String("savePassword"), false);
} else {
DataItem item = m_form->item();
DataItem jidItem = item.subitem(QString::number(Jreen::RegistrationData::UsernameField));
QString server = field(QLatin1String("server")).toString();
JID jid = jidItem.data().toString() + QLatin1Char('@') + server;
setField(QLatin1String("jid"), jid.bare());
setField(QLatin1String("password"), QString());
setField(QLatin1String("savePassword"), false);
}
emit completeChanged();
wizard()->next();
}
示例7: Tag
void SOCKS5BytestreamManager::rejectSOCKS5Bytestream( const JID& from, const std::string& id,
StanzaError reason )
{
Tag *iq = new Tag( "iq" );
iq->addAttribute( "type", "error" );
iq->addAttribute( "to", from.full() );
iq->addAttribute( "id", id );
Tag *e = new Tag( iq, "error" );
switch( reason )
{
case StanzaErrorForbidden:
{
new Tag( iq, "query", "xmlns", XMLNS_BYTESTREAMS );
e->addAttribute( "code", "403" );
e->addAttribute( "type", "auth" );
Tag *f = new Tag( e, "forbidden" );
f->addAttribute( "xmlns", XMLNS_XMPP_STANZAS );
break;
}
case StanzaErrorFeatureNotImplemented:
{
e->addAttribute( "code", "404" );
e->addAttribute( "type", "cancel" );
Tag *f = new Tag( e, "item-not-found" );
f->addAttribute( "xmlns", XMLNS_XMPP_STANZAS );
break;
}
case StanzaErrorNotAllowed:
{
new Tag( iq, "query", "xmlns", XMLNS_BYTESTREAMS );
e->addAttribute( "code", "405" );
e->addAttribute( "type", "cancel" );
Tag *f = new Tag( e, "not-allowed" );
f->addAttribute( "xmlns", XMLNS_XMPP_STANZAS );
break;
}
case StanzaErrorNotAcceptable:
default:
{
e->addAttribute( "code", "406" );
e->addAttribute( "type", "auth" );
Tag *f = new Tag( e, "not-acceptable" );
f->addAttribute( "xmlns", XMLNS_XMPP_STANZAS );
break;
}
}
m_parent->send( iq );
}
示例8: IBBResponder
IBBReceiveSession::IBBReceiveSession(
const std::string& id,
const JID& from,
const JID& to,
size_t size,
IQRouter* router) :
id(id),
from(from),
to(to),
size(size),
router(router),
active(false) {
assert(!id.empty());
assert(from.isValid());
responder = new IBBResponder(this, router);
}
示例9: fetchVCard
void VCardManager::fetchVCard( const JID& jid, VCardHandler* vch )
{
if( !m_parent || !vch )
return;
TrackMap::const_iterator it = m_trackMap.find( jid.bare() );
if( it != m_trackMap.end() )
return;
const std::string& id = m_parent->getID();
IQ iq ( IQ::Get, jid, id );
iq.addExtension( new VCard() );
m_trackMap[id] = vch;
m_parent->send( iq, this,VCardHandler::FetchVCard );
}
示例10: subscribe
void RosterManager::subscribe( const JID& jid, const std::string& name,
const StringList& groups, const std::string& msg )
{
if( !jid )
return;
add( jid, name, groups );
Tag *s = new Tag( "presence" );
s->addAttribute( "type", "subscribe" );
s->addAttribute( "to", jid.bare() );
s->addAttribute( "from", m_parent->jid().full() );
if( !msg.empty() )
new Tag( s, "status", msg );
m_parent->send( s );
}
示例11: id
IBBReceiveSession::IBBReceiveSession(
const std::string& id,
const JID& from,
const JID& to,
unsigned long long size,
std::shared_ptr<WriteBytestream> bytestream,
IQRouter* router) :
id(id),
from(from),
to(to),
size(size),
bytestream(bytestream),
router(router),
active(false) {
assert(!id.empty());
assert(from.isValid());
responder = new IBBResponder(this, router);
}
示例12: handleCapsChanged
void handleCapsChanged(JID jid) {
if (jid.toBare() == recipient) {
// create ReadBytestream from file
boost::shared_ptr<FileReadBytestream> fileStream = boost::make_shared<FileReadBytestream>(file);
outgoingFileTransfer = client->getFileTransferManager()->createOutgoingFileTransfer(recipient, file, "Some File!", fileStream);
if (outgoingFileTransfer) {
outgoingFileTransfer->onFinished.connect(boost::bind(&FileSender::handleFileTransferFinished, this, _1));
std::cout << "Starting file-transfer to " << recipient.toString() << "." << std::endl;
outgoingFileTransfer->start();
// TODO: getting notified about FT status and end
} else {
std::cout << recipient << " doesn't support any kind of file transfer!" << std::endl;
client->disconnect();
}
}
}
示例13: handleRoomsItemsResponse
static void handleRoomsItemsResponse(std::shared_ptr<DiscoItems> items, ErrorPayload::ref error) {
if (error) {
cout << "Error fetching list of rooms." << endl;
return;
}
int roomCount = 0;
cout << "List of rooms at " << mucJID.toString() << endl;
for (auto&& item : items->getItems()) {
roomCount++;
cout << "\t" << roomCount << ". " << item.getJID().getNode() << " - " << item.getName() << std::endl;
if (roomCount == 1) {
roomJID = item.getJID();
}
}
cout << endl;
joinMUC();
}
示例14: fetchSearchFields
void Search::fetchSearchFields( const JID& directory, SearchHandler *sh )
{
if( !m_parent || !directory || !sh )
return;
const std::string& id = m_parent->getID();
Tag *iq = new Tag( "iq" );
iq->addAttribute( "type", "get" );
iq->addAttribute( "id", id );
iq->addAttribute( "to", directory.full() );
Tag *q = new Tag( iq, "query" );
q->addAttribute( "xmlns", XMLNS_SEARCH );
m_track[id] = sh;
m_parent->trackID( this, id, FetchSearchFields );
m_parent->send( iq );
}
示例15: handleDiscoInfo
void TalkDiscoHandler::handleDiscoInfo(const JID& from, const Disco::Info& info, int context)
{
ServerDiscoWindow* discowindow = Bodies::Get_Bodies().get_main_window().get_disco_window();
if (NULL == discowindow)
return ;
const Disco::IdentityList& list = info.identities();
Disco::IdentityList::const_iterator iter = list.begin();
for (; iter != list.end(); ++iter) {
if ((*iter)->category() == "server") {
discowindow->setLabel(from.full(), (*iter)->name());
}
}
}