本文整理汇总了C++中ContactRef::getUIN方法的典型用法代码示例。如果您正苦于以下问题:C++ ContactRef::getUIN方法的具体用法?C++ ContactRef::getUIN怎么用?C++ ContactRef::getUIN使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ContactRef
的用法示例。
在下文中一共展示了ContactRef::getUIN方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: add
ContactRef ContactList::add(ContactRef ct) {
m_cmap.insert( std::make_pair(ct->getUIN(), ct) );
// fire off signal
UserAddedEvent uev( ct );
// contactlist_signal.emit( &uev );
contactlist_signal_cb(client, signal_type,&uev );
return ct;
}
示例2: add
ContactRef ContactList::add(ContactRef ct) {
m_cmap.insert( std::make_pair(ct->getUIN(), ct) );
// fire off signal
ContactTree::Group *gp = new ContactTree::Group();
UserAddedEvent uev( ct, *gp );
contactlist_signal.emit( &uev );
delete gp;
return ct;
}
示例3: SignalSearchResultEvent
/* search_result */
void WPclient::SignalSearchResultEvent(SearchResultEvent *ev) {
meta_gen meta;
if (search_ev == ev) {
UIN_t uin;
if (sesja->pend_search == NULL) {
log_alert(ZONE,"No search at session");
search_ev = NULL;
return;
}
if (!ev->isExpired()) {
// ContactList& cl = ev->getContactList();
ContactRef c = ev->getLastContactAdded();
if (c.get() != NULL) {
uin = c->getUIN();
meta.nick = (char*)c->getAlias().c_str();
meta.first = (char*)c->getFirstName().c_str();
meta.last = (char*)c->getLastName().c_str();
meta.email = (char*)c->getEmail().c_str();
if (c->getAuthReq()) {
meta.auth = 1;
} else {
meta.auth = 0;
}
switch (c->getStatus())
{
case STATUS_OFFLINE:
meta.status = ICQ_STATUS_OFFLINE;
break;
case STATUS_AWAY:
meta.status = ICQ_STATUS_AWAY;
break;
case STATUS_DND:
meta.status = ICQ_STATUS_DND;
break;
case STATUS_NA:
meta.status = ICQ_STATUS_NA;
break;
case STATUS_OCCUPIED:
meta.status = ICQ_STATUS_NA;
break;
case STATUS_FREEFORCHAT:
meta.status = ICQ_STATUS_FREE_CHAT;
break;
default:
meta.status = ICQ_STATUS_ONLINE;
break;
}
log_debug(ZONE,"Search enter part");
(*(meta_search_cb)sesja->pend_search->cb)
(sesja,uin,&meta,sesja->pend_search->arg);
}
}
else {
log_alert(ZONE,"search timedout");
uin = 0;
}
if (ev->isFinished()) {
log_debug(ZONE,"Search send");
(*(meta_search_cb)sesja->pend_search->cb)
(sesja,uin,NULL,sesja->pend_search->arg);
search_ev = NULL;
sesja->pend_search = NULL;
}
}
else {
log_alert(ZONE,"Not our search event search_ev= %p",search_ev);
}
}
示例4: SignalMessageAck
void WPclient::SignalMessageAck(MessageEvent *ev) {
if(!ev->isFinished()) return;
unsigned int uin = 0;
ContactRef c = ev->getContact();
if (c->isVirtualContact())
uin = 0;
else
uin = c->getUIN();
if (ev->getType() == ICQ2000::MessageEvent::AwayMessage){
AwayMessageEvent *aev = static_cast<AwayMessageEvent*>(ev);
log_debug(ZONE,"Away message received");
sendContactPresence(uin,aev->getAwayMessage());
return;
}
if(!ev->isDelivered()) {
jid id;
xmlnode msg;
switch(ev->getDeliveryFailureReason()) {
case MessageEvent::Failed_Denied:
msg = xmlnode_new_tag("message");
xmlnode_insert_cdata(xmlnode_insert_tag(msg,"body"),
it_convert_windows2utf8(xmlnode_pool(msg),LNG_M_ACK_IGNORE),
(unsigned int) -1);
break;
case MessageEvent::Failed_Occupied:
msg = xmlnode_new_tag("message");
xmlnode_insert_cdata(xmlnode_insert_tag(msg,"body"),
it_convert_windows2utf8(xmlnode_pool(msg),LNG_M_ACK_BUSY),
(unsigned int) -1);
break;
case MessageEvent::Failed_DND:
msg = xmlnode_new_tag("message");
xmlnode_insert_cdata(xmlnode_insert_tag(msg,"body"),
it_convert_windows2utf8(xmlnode_pool(msg),LNG_M_ACK_DND),
(unsigned int) -1);
break;
case MessageEvent::Failed_NotConnected:
return;
msg = xmlnode_new_tag("message");
xmlnode_insert_cdata(xmlnode_insert_tag(msg,"body"),
it_convert_windows2utf8(xmlnode_pool(msg),LNG_M_ACK_NC),
(unsigned int) -1);
break;
case MessageEvent::Failed:
default:
msg = xmlnode_new_tag("message");
xmlnode_insert_cdata(xmlnode_insert_tag(msg,"body"),
it_convert_windows2utf8(xmlnode_pool(msg),LNG_M_ACK_FAIL),
(unsigned int) -1);
}
xmlnode_put_attrib(msg,"to",jid_full(sesja->id));
id = it_uin2jid(xmlnode_pool(msg),uin,sesja->from->server);
xmlnode_put_attrib(msg,"from",jid_full(id));
it_deliver(sesja->ti,msg);
return;
}
/* Parsing away messages included in message acks would be nice
* but does not work with ICQ Lite and some other clients which
* either put in a "not supported" here or echo the last message
* sent to them.
ICQMessageEvent *cev = dynamic_cast<ICQMessageEvent*>(ev);
if (cev && (cev->getAwayMessage().size())) {
log_debug(ZONE,"Away message received with message ack");
sendContactPresence(uin,cev->getAwayMessage());
} */
}
示例5: SignalMessaged
void WPclient::SignalMessaged(MessageEvent *ev) {
jid id;
xmlnode msg;
unsigned int uin = 0;
ContactRef c = ev->getContact();
if (c->isVirtualContact())
uin = 0;
else
uin = c->getUIN();
switch(ev->getType()){
case MessageEvent::Normal: {
NormalMessageEvent* nm=static_cast<NormalMessageEvent*>(ev);
msg = xmlnode_new_tag("message");
contact sc;
bool type_chat;
sc = it_contact_get(sesja,uin);
if (sc)
type_chat = sc->use_chat_msg_type;
else
if (sesja->ti->msg_chat)
type_chat = true;
else
type_chat = false;
if(type_chat)
xmlnode_put_attrib(msg,"type","chat");
log_debug(ZONE,"Message: len->%i encoding->%i text->%s",int((nm->getMessage()).length()),
int(nm->getTextEncoding()),(nm->getMessage()).c_str());
if (nm->getTextEncoding()==2) // UCS2BE
xmlnode_insert_cdata(xmlnode_insert_tag(msg,"body"),
it_convert_ucs2utf8(xmlnode_pool(msg),
(nm->getMessage()).length(),
(nm->getMessage()).c_str()),
(unsigned int)-1);
else if (nm->getTextEncoding()==8) // UTF-8
xmlnode_insert_cdata( xmlnode_insert_tag(msg,"body") ,
(nm->getMessage()).c_str() ,
(unsigned int)-1);
else // 0==ASCII and 3==locale_encoded will go here.
xmlnode_insert_cdata(xmlnode_insert_tag(msg,"body"),
it_convert_windows2utf8(xmlnode_pool(msg),
(nm->getMessage()).c_str()),
(unsigned int)-1);
if ((ev->getTime()!=0) && ((ev->getTime()+120)<time(NULL))) {
// if the message travels more than 2 minutes it is not online anyway. Stamp it.
xmlnode x;
char timestamp[24];
const time_t time=ev->getTime();
struct tm *t=gmtime(&time);
snprintf(timestamp,24,"%04i%02i%02iT%02i:%02i:%02i",t->tm_year+1900,t->tm_mon+1,t->tm_mday,t->tm_hour,t->tm_min,t->tm_sec);
x=xmlnode_insert_tag(msg,"x");
xmlnode_put_attrib(x,"xmlns","jabber:x:delay");
xmlnode_put_attrib(x,"stamp",timestamp);
}
break;
}
case MessageEvent::URL: {
URLMessageEvent* urlm=static_cast<URLMessageEvent*>(ev);
msg = xmlnode_new_tag("message");
xmlnode_insert_cdata(xmlnode_insert_tag(msg,"subject"),
"ICQ URL Message",(unsigned int)-1);
/* add a message body that most clients can understand */
xmlnode_insert_cdata(xmlnode_insert_tag(msg,"body"),
it_convert_windows2utf8(xmlnode_pool(msg),
("URL: "+(urlm->getURL())+"\nDescription:\n"+
(urlm->getMessage())).c_str()),
(unsigned int)-1);
xmlnode x = xmlnode_insert_tag(msg,"x");
xmlnode_put_attrib(x,"xmlns",NS_XOOB);
xmlnode_insert_cdata(xmlnode_insert_tag(x,"desc"),
it_convert_windows2utf8(xmlnode_pool(msg),
(urlm->getMessage()).c_str()),
(unsigned int)-1);
xmlnode_insert_cdata(xmlnode_insert_tag(x,"url"),
it_convert_windows2utf8(xmlnode_pool(msg),
(urlm->getURL()).c_str()),
(unsigned int)-1);
break;
}
case MessageEvent::AuthReq: {
contact cc;
AuthReqEvent *autr = static_cast<AuthReqEvent*>(ev);
log_debug(ZONE,"Authorization request received");
msg = xmlnode_new_tag("presence");
xmlnode_insert_cdata(xmlnode_insert_tag(msg,"status"),
it_convert_windows2utf8(xmlnode_pool(msg),
autr->getMessage().c_str()),
(unsigned int)-1);
//.........这里部分代码省略.........