本文整理汇总了C++中Contact::contactInfo方法的典型用法代码示例。如果您正苦于以下问题:C++ Contact::contactInfo方法的具体用法?C++ Contact::contactInfo怎么用?C++ Contact::contactInfo使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Contact
的用法示例。
在下文中一共展示了Contact::contactInfo方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getContacts
const char *UserWnd::getIcon()
{
Contact *contact = getContacts()->contact(m_id);
unsigned long status = STATUS_UNKNOWN;
unsigned style;
const char *statusIcon = NULL;
void *data;
Client *client = m_edit->client(data, false, true, id());
if (client){
client->contactInfo(data, status, style, statusIcon);
}else{
contact->contactInfo(style, statusIcon);
}
return statusIcon;
}
示例2: init
void FloatyWnd::init()
{
m_style = 0;
m_icons = "";
m_unread = 0;
Contact *contact = getContacts()->contact(m_id);
if (contact == NULL)
return;
m_text = contact->getName();
m_status = contact->contactInfo(m_style, m_statusIcon, &m_icons);
QPainter p(this);
unsigned blink = m_blink;
m_blink = 1;
setFont(&p);
m_blink = blink;
QRect br = qApp->desktop()->rect();
br = p.boundingRect(br, Qt::AlignLeft | Qt::AlignVCenter, m_text);
p.end();
unsigned h = br.height();
unsigned w = br.width() + 5;
const QPixmap &pict = Pict(m_statusIcon).pixmap();
w += pict.width() + 2;
if ((unsigned)(pict.height()) > h)
h = pict.height();
string icons = m_icons;
while (icons.length()){
string icon = getToken(icons, ',');
const QPixmap &pict = Pict(icon.c_str()).pixmap();
w += pict.width() + 2;
if ((unsigned)(pict.height()) > h)
h = pict.height();
}
w += 8;
h += 6;
resize(w, h);
for (list<msg_id>::iterator it = m_plugin->core->unread.begin(); it != m_plugin->core->unread.end(); ++it){
if ((*it).contact != m_id)
continue;
m_unread = (*it).type;
m_plugin->startBlink();
break;
}
}
示例3: init
void FloatyWnd::init()
{
m_style = 0;
m_icons = "";
m_unread = 0;
Contact *contact = getContacts()->contact(m_id);
if (contact == NULL)
return;
m_text = contact->getName();
m_status = contact->contactInfo(m_style, m_statusIcon, &m_icons);
QRect br = fontMetrics().boundingRect(m_text);
unsigned h = br.height();
unsigned w = br.width() + 5;
const QPixmap &pict = Pict(m_statusIcon);
w += pict.width() + 2;
if ((unsigned)(pict.height()) > h)
h = pict.height();
string icons = m_icons;
while (icons.length()){
string icon = getToken(icons, ',');
const QPixmap &pict = Pict(icon.c_str());
w += pict.width() + 2;
if ((unsigned)(pict.height()) > h)
h = pict.height();
}
w += 8;
h += 6;
resize(w, h);
for (list<msg_id>::iterator it = m_plugin->core->unread.begin(); it != m_plugin->core->unread.end(); ++it){
if ((*it).contact != m_id)
continue;
m_unread = (*it).type;
m_plugin->startBlink();
break;
}
}
示例4: switch
void *OSDPlugin::processEvent(Event *e)
{
OSDRequest osd;
Contact *contact;
Message *msg;
OSDUserData *data;
switch (e->type()){
case EventContactOnline:
contact = (Contact*)(e->param());
if (contact->getIgnore()) break;
osd.contact = contact->id();
osd.type = OSD_ALERT;
queue.push_back(osd);
processQueue();
break;
case EventMessageReceived:
msg = (Message*)(e->param());
if (msg->type() == MessageStatus)
break;
osd.contact = msg->contact();
osd.type = msg->baseType();
osd.msg_id = msg->id();
osd.client = msg->client();
queue.push_back(osd);
processQueue();
break;
case EventContactStatus:
contact = (Contact*)(e->param());
if (contact->getIgnore()) break;
data = (OSDUserData*)(contact->getUserData(user_data_id));
if (data){
unsigned style = 0;
string wrkIcons;
const char *statusIcon = NULL;
contact->contactInfo(style, statusIcon, &wrkIcons);
bool bTyping = false;
while (!wrkIcons.empty()){
if (getToken(wrkIcons, ',') == "typing"){
bTyping = true;
break;
}
}
if (bTyping){
list<unsigned>::iterator it;
for (it = typing.begin(); it != typing.end(); ++it)
if ((*it) == contact->id())
break;
if (it == typing.end()){
typing.push_back(contact->id());
osd.contact = contact->id();
osd.type = OSD_TYPING;
queue.push_back(osd);
processQueue();
}
}else{
list<unsigned>::iterator it;
for (it = typing.begin(); it != typing.end(); ++it)
if ((*it) == contact->id())
break;
if (it != typing.end())
typing.erase(it);
}
}
break;
}
return NULL;
}
示例5: eExec
void *Container::processEvent(Event *e)
{
UserWnd *userWnd;
Contact *contact;
CommandDef *cmd;
Message *msg;
switch (e->type()){
case EventMessageReceived:
msg = (Message*)(e->param());
if (msg->type() == MessageStatus){
contact = getContacts()->contact(msg->contact());
if (contact)
contactChanged(contact);
return NULL;
}
if (CorePlugin::m_plugin->getContainerMode()){
if (isActiveWindow()){
userWnd = m_tabBar->currentWnd();
if (userWnd && (userWnd->id() == msg->contact()))
userWnd->markAsRead();
}
#ifdef WIN32
if (!isActiveWindow()){
msg = (Message*)(e->param());
userWnd = wnd(msg->contact());
if (userWnd){
if (!initFlash){
HINSTANCE hLib = GetModuleHandleA("user32");
if (hLib != NULL)
(DWORD&)FlashWindowEx = (DWORD)GetProcAddress(hLib,"FlashWindowEx");
initFlash = true;
}
if (FlashWindowEx){
FLASHWINFO fInfo;
fInfo.cbSize = sizeof(fInfo);
fInfo.dwFlags = 0x0E;
fInfo.hwnd = winId();
fInfo.uCount = 0;
FlashWindowEx(&fInfo);
}
}
}
#endif
}
case EventMessageRead:
msg = (Message*)(e->param());
userWnd = wnd(msg->contact());
if (userWnd){
bool bBold = false;
for (list<msg_id>::iterator it = CorePlugin::m_plugin->unread.begin(); it != CorePlugin::m_plugin->unread.end(); ++it){
if ((*it).contact != msg->contact())
continue;
bBold = true;
break;
}
m_tabBar->setBold(msg->contact(), bBold);
}
break;
case EventActiveContact:
if (!isActiveWindow())
return NULL;
userWnd = m_tabBar->currentWnd();
if (userWnd)
return (void*)(userWnd->id());
break;
case EventContactDeleted:
contact = (Contact*)(e->param());
userWnd = wnd(contact->id());
if (userWnd)
removeUserWnd(userWnd);
break;
case EventContactChanged:
contact = (Contact*)(e->param());
userWnd = wnd(contact->id());
if (userWnd){
if (contact->getIgnore()){
removeUserWnd(userWnd);
break;
}
m_tabBar->changeTab(contact->id());
contactChanged(contact);
}
case EventClientsChanged:
setupAccel();
break;
case EventContactStatus:
contact = (Contact*)(e->param());
userWnd = m_tabBar->wnd(contact->id());
if (userWnd){
unsigned style = 0;
string wrkIcons;
const char *statusIcon = NULL;
contact->contactInfo(style, statusIcon, &wrkIcons);
bool bTyping = false;
while (!wrkIcons.empty()){
if (getToken(wrkIcons, ',') == "typing"){
bTyping = true;
break;
}
}
//.........这里部分代码省略.........
示例6: processQueue
void OSDPlugin::processQueue()
{
if (m_timer->isActive())
return;
while (queue.size()){
m_request = queue.front();
queue.erase(queue.begin());
Contact *contact = getContacts()->contact(m_request.contact);
if ((contact == NULL) || contact->getIgnore()){
continue;
}
QString text;
OSDUserData *data = NULL;
data = (OSDUserData*)contact->getUserData(user_data_id);
switch (m_request.type){
case OSD_ALERT:
if (data->EnableAlert.bValue){
unsigned style = 0;
const char *statusIcon = NULL;
if (contact->contactInfo(style, statusIcon) >= STATUS_ONLINE)
text = g_i18n("%1 is online", contact) .arg(contact->getName());
}
break;
case OSD_TYPING:
if (data->EnableTyping.bValue){
unsigned style = 0;
string wrkIcons;
const char *statusIcon = NULL;
contact->contactInfo(style, statusIcon, &wrkIcons);
bool bTyping = false;
while (!wrkIcons.empty()){
if (getToken(wrkIcons, ',') == "typing"){
bTyping = true;
break;
}
}
if (bTyping)
text = g_i18n("%1 is typing", contact) .arg(contact->getName());
}
break;
case OSD_MESSAGE:
if (data->EnableMessage.bValue && core){
list<msg_id>::iterator it;
TYPE_MAP types;
TYPE_MAP::iterator itc;
QString msg_text;
for (it = core->unread.begin(); it != core->unread.end(); ++it){
if ((*it).contact != m_request.contact)
continue;
unsigned type = (*it).type;
itc = types.find(type);
if (itc == types.end()){
types.insert(TYPE_MAP::value_type(type, 1));
}else{
(*itc).second++;
}
if (!data->EnableMessageShowContent.bValue)
continue;
MessageID id;
id.id = (*it).id;
id.contact = (*it).contact;
id.client = (*it).client.c_str();
Event e(EventLoadMessage, &id);
Message *msg = (Message*)(e.process());
if (msg == NULL)
continue;
QString msgText = msg->getPlainText().stripWhiteSpace();
if (msgText.isEmpty())
continue;
if (!msg_text.isEmpty())
msg_text += "\n";
msg_text += msgText;
}
if (types.empty())
break;
for (itc = types.begin(); itc != types.end(); ++itc){
CommandDef *def = core->messageTypes.find((*itc).first);
if (def == NULL)
continue;
MessageDef *mdef = (MessageDef*)(def->param);
QString msg = i18n(mdef->singular, mdef->plural, (*itc).second);
if ((*itc).second == 1){
int pos = msg.find("1 ");
if (pos > 0){
msg = msg.left(pos);
}else if (pos == 0){
msg = msg.mid(2);
}
msg = msg.left(1).upper() + msg.mid(1);
}
if (!text.isEmpty())
text += ", ";
text += msg;
}
text = i18n("%1 from %2") .arg(text) .arg(contact->getName());
if (msg_text.isEmpty())
break;
text += ":\n";
text += msg_text;
}
//.........这里部分代码省略.........
示例7: switch
void *OSDPlugin::processEvent(Event *e)
{
OSDRequest osd;
Contact *contact;
Message *msg;
OSDUserData *data;
switch (e->type()){
case EventContactOnline:
contact = (Contact*)(e->param());
if (contact->getIgnore()) break;
osd.contact = contact->id();
osd.type = OSD_ALERTONLINE;
queue.push_back(osd);
processQueue();
break;
case EventMessageDeleted:
case EventMessageRead:
case EventMessageReceived:
msg = (Message*)(e->param());
contact = getContacts()->contact(msg->contact());
if (contact == NULL)
break;
data = (OSDUserData*)(contact->getUserData(user_data_id));
if (data == NULL)
break;
osd.contact = msg->contact();
if (msg->type() == MessageStatus) {
StatusMessage *smsg = (StatusMessage*)msg;
switch (smsg->getStatus()) {
case STATUS_AWAY:
osd.type = OSD_ALERTAWAY;
break;
case STATUS_NA:
osd.type = OSD_ALERTNA;
break;
case STATUS_DND:
osd.type = OSD_ALERTDND;
break;
case 100: /* STATUS_OCCUPIED, but defined in icqclient.h ! */
osd.type = OSD_ALERTOCCUPIED;
break;
case STATUS_FFC:
osd.type = OSD_ALERTFFC;
break;
case STATUS_OFFLINE:
osd.type = OSD_ALERTOFFLINE;
break;
case STATUS_ONLINE:
osd.type = OSD_NONE;
return NULL;
default:
log(L_DEBUG,"OSD: Unknown status %ld",smsg->getStatus());
osd.type = OSD_NONE;
return NULL;
}
queue.push_back(osd);
processQueue();
}else{
osd.type = OSD_MESSAGE;
if ((m_request.type == OSD_MESSAGE) && (m_request.contact == msg->contact())){
queue.push_front(osd);
m_timer->stop();
m_timer->start(100);
}else{
queue.push_back(osd);
processQueue();
}
}
break;
case EventContactStatus:
contact = (Contact*)(e->param());
if (contact->getIgnore()) break;
data = (OSDUserData*)(contact->getUserData(user_data_id));
if (data){
unsigned style = 0;
string wrkIcons;
const char *statusIcon = NULL;
contact->contactInfo(style, statusIcon, &wrkIcons);
bool bTyping = false;
while (!wrkIcons.empty()){
if (getToken(wrkIcons, ',') == "typing"){
bTyping = true;
break;
}
}
if (bTyping){
list<unsigned>::iterator it;
for (it = typing.begin(); it != typing.end(); ++it)
if ((*it) == contact->id())
break;
if (it == typing.end()){
typing.push_back(contact->id());
osd.contact = contact->id();
osd.type = OSD_TYPING;
queue.push_back(osd);
processQueue();
}
}else{
list<unsigned>::iterator it;
for (it = typing.begin(); it != typing.end(); ++it)
//.........这里部分代码省略.........
示例8: processEvent
bool OSDPlugin::processEvent(Event *e)
{
OSDRequest osd;
switch (e->type()){
case eEventContact: {
EventContact *ec = static_cast<EventContact*>(e);
Contact *contact = ec->contact();
if (contact->getIgnore())
break;
switch(ec->action()) {
case EventContact::eOnline: {
osd.contact = contact->id();
osd.type = OSD_ALERTONLINE;
m_queue.push_back(osd);
processQueue();
break;
}
case EventContact::eStatus:
{
SIM::PropertyHubPtr data = contact->getUserData("OSD");
if(!data.isNull()) {
unsigned style = 0;
QSet<QString> wrkIcons;
QString statusIcon;
contact->contactInfo(style, statusIcon, &wrkIcons);
if (wrkIcons.contains("typing")){
if (!m_typing.contains(contact->id())) {
m_typing += contact->id();
osd.contact = contact->id();
osd.type = OSD_TYPING;
m_queue.push_back(osd);
processQueue();
}
}else{
m_typing.remove(contact->id());
if ((m_request.type == OSD_TYPING) && (m_request.contact == contact->id())){
m_timer->stop(); bTimerActive=false;
m_timer->start(100); bTimerActive=true;
}
}
}
break;
}
default:
break;
}
break;
}
case eEventMessageReceived:
{
EventMessage *em = static_cast<EventMessage*>(e);
Message *msg = em->msg();
Contact *contact = getContacts()->contact(msg->contact());
if (contact == NULL)
break;
SIM::PropertyHubPtr data = contact->getUserData("OSD");
if(data.isNull())
break;
osd.contact = msg->contact();
CorePlugin* core = GET_CorePlugin();
if (!core->unread.empty())
bHaveUnreadMessages=true;
if (msg->type() == MessageStatus) {
StatusMessage *smsg = (StatusMessage*)msg;
switch (smsg->getStatus()) {
case STATUS_AWAY:
osd.type = OSD_ALERTAWAY;
break;
case STATUS_NA:
osd.type = OSD_ALERTNA;
break;
case STATUS_DND:
osd.type = OSD_ALERTDND;
break;
case STATUS_OCCUPIED: /* STATUS_OCCUPIED, took over from contacts.h! */
osd.type = OSD_ALERTOCCUPIED;
break;
case STATUS_FFC:
osd.type = OSD_ALERTFFC;
break;
case STATUS_OFFLINE:
osd.type = OSD_ALERTOFFLINE;
break;
case STATUS_ONLINE:
osd.type = OSD_NONE;
return false;
default:
log(L_DEBUG,"OSD: Unknown status %ld",smsg->getStatus());
osd.type = OSD_NONE;
return false;
}
m_queue.push_back(osd);
processQueue();
}else{
osd.type = OSD_MESSAGE;
if ((m_request.type == OSD_MESSAGE) && (m_request.contact == msg->contact())){
m_queue.push_front(osd);
m_timer->stop(); bTimerActive=false;
m_timer->start(100);bTimerActive=true;
}else{
//.........这里部分代码省略.........
示例9: processEvent
bool OSDPlugin::processEvent(Event *e)
{
OSDRequest osd;
switch (e->type()){
case eEventContact: {
EventContact *ec = static_cast<EventContact*>(e);
Contact *contact = ec->contact();
if (contact->getIgnore())
break;
switch(ec->action()) {
case EventContact::eOnline: {
osd.contact = contact->id();
osd.type = OSD_ALERTONLINE;
queue.push_back(osd);
processQueue();
break;
}
case EventContact::eStatus: {
OSDUserData *data = (OSDUserData*)(contact->getUserData(user_data_id));
if (data){
unsigned style = 0;
QString wrkIcons;
QString statusIcon;
contact->contactInfo(style, statusIcon, &wrkIcons);
bool bTyping = false;
while (!wrkIcons.isEmpty()){
if (getToken(wrkIcons, ',') == "typing"){
bTyping = true;
break;
}
}
if (bTyping){
list<unsigned>::iterator it;
for (it = typing.begin(); it != typing.end(); ++it)
if ((*it) == contact->id())
break;
if (it == typing.end()){
typing.push_back(contact->id());
osd.contact = contact->id();
osd.type = OSD_TYPING;
queue.push_back(osd);
processQueue();
}
}else{
list<unsigned>::iterator it;
for (it = typing.begin(); it != typing.end(); ++it)
if ((*it) == contact->id())
break;
if (it != typing.end())
typing.erase(it);
if ((m_request.type == OSD_TYPING) && (m_request.contact == contact->id())){
m_timer->stop();
m_timer->start(100);
}
}
}
break;
}
default:
break;
}
break;
}
case eEventMessageReceived: {
EventMessage *em = static_cast<EventMessage*>(e);
Message *msg = em->msg();
Contact *contact = getContacts()->contact(msg->contact());
if (contact == NULL)
break;
OSDUserData *data = (OSDUserData*)(contact->getUserData(user_data_id));
if (data == NULL)
break;
osd.contact = msg->contact();
if (! core->unread.empty())
bHaveUnreadMessages=true;
if (msg->type() == MessageStatus) {
StatusMessage *smsg = (StatusMessage*)msg;
switch (smsg->getStatus()) {
case STATUS_AWAY:
osd.type = OSD_ALERTAWAY;
break;
case STATUS_NA:
osd.type = OSD_ALERTNA;
break;
case STATUS_DND:
osd.type = OSD_ALERTDND;
break;
case STATUS_OCCUPIED: /* STATUS_OCCUPIED, took over from contacts.h! */
osd.type = OSD_ALERTOCCUPIED;
break;
case STATUS_FFC:
osd.type = OSD_ALERTFFC;
break;
case STATUS_OFFLINE:
osd.type = OSD_ALERTOFFLINE;
break;
case STATUS_ONLINE:
osd.type = OSD_NONE;
return false;
default:
//.........这里部分代码省略.........
示例10: processQueue
void OSDPlugin::processQueue()
{
if (m_timer->isActive())
return;
while (queue.size()){
m_request = queue.front();
queue.erase(queue.begin());
Contact *contact = getContacts()->contact(m_request.contact);
if ((contact == NULL) || contact->getIgnore()){
continue;
}
QString text;
OSDUserData *data = NULL;
data = (OSDUserData*)contact->getUserData(user_data_id);
uint ms=core->getManualStatus();
switch (m_request.type){
case OSD_ALERTONLINE:
if (data->EnableAlert.toBool() && data->EnableAlertOnline.toBool()){
unsigned style = 0;
QString statusIcon;
if (contact->contactInfo(style, statusIcon) == STATUS_ONLINE)
text = g_i18n("%1 is online", contact) .arg(contact->getName());
}
break;
case OSD_ALERTAWAY:
if (data->EnableAlert.toBool() && data->EnableAlertAway.toBool()){
text = g_i18n("%1 is away", contact) .arg(contact->getName());
}
break;
case OSD_ALERTNA:
if (data->EnableAlert.toBool() && data->EnableAlertNA.toBool()){
text = g_i18n("%1 is not available", contact) .arg(contact->getName());
}
break;
case OSD_ALERTDND:
if (data->EnableAlert.toBool() && data->EnableAlertDND.toBool()){
text = g_i18n("%1 doesn't want to be disturbed", contact) .arg(contact->getName());
}
break;
case OSD_ALERTOCCUPIED:
if (data->EnableAlert.toBool() && data->EnableAlertOccupied.toBool()){
text = g_i18n("%1 is occupied", contact) .arg(contact->getName());
}
break;
case OSD_ALERTFFC:
if (data->EnableAlert.toBool() && data->EnableAlertFFC.toBool()){
text = g_i18n("%1 is free for chat", contact) .arg(contact->getName());
}
break;
case OSD_ALERTOFFLINE:
if (data->EnableAlert.toBool() && data->EnableAlertOffline.toBool() && (ms-1) ){
text = g_i18n("%1 is offline", contact) .arg(contact->getName());
}
break;
case OSD_TYPING:
if (data->EnableTyping.toBool()){
unsigned style = 0;
QString wrkIcons;
QString statusIcon;
contact->contactInfo(style, statusIcon, &wrkIcons);
bool bTyping = false;
while (!wrkIcons.isEmpty()){
if (getToken(wrkIcons, ',') == "typing"){
bTyping = true;
break;
}
}
if (bTyping)
text = g_i18n("%1 is typing", contact) .arg(contact->getName());
}
break;
case OSD_MESSAGE:
if (data->EnableMessage.toBool() && core){
list<msg_id>::iterator it;
TYPE_MAP types;
TYPE_MAP::iterator itc;
QString msg_text;
for (it = core->unread.begin(); it != core->unread.end(); ++it){
if ((*it).contact != m_request.contact)
continue;
unsigned type = (*it).type;
itc = types.find(type);
if (itc == types.end()){
types.insert(TYPE_MAP::value_type(type, 1));
}else{
(*itc).second++;
}
if (!data->EnableMessageShowContent.toBool())
continue;
EventLoadMessage e((*it).id, (*it).client, (*it).contact);
e.process();
Message *msg = e.message();
if (msg == NULL)
continue;
QString msgText = msg->getPlainText().stripWhiteSpace();
if (msgText.isEmpty())
continue;
if (!msg_text.isEmpty())
msg_text += "\n";
msg_text += msgText;
//.........这里部分代码省略.........
示例11: processEvent
bool Container::processEvent(Event *e)
{
if (m_tabBar == NULL)
return false;
switch (e->type()){
case eEventMessageReceived: {
EventMessage *em = static_cast<EventMessage*>(e);
Message *msg = em->msg();
if (msg->type() == MessageStatus){
Contact *contact = getContacts()->contact(msg->contact());
if (contact)
contactChanged(contact);
return false;
}
if (msg->getFlags() & MESSAGE_NOVIEW)
return false;
if (CorePlugin::m_plugin->getContainerMode()){
if (isActiveWindow() && !isMinimized()){
UserWnd *userWnd = m_tabBar->currentWnd();
if (userWnd && (userWnd->id() == msg->contact()))
userWnd->markAsRead();
}else{
UserWnd *userWnd = wnd(msg->contact());
if (userWnd)
QTimer::singleShot(0, this, SLOT(flash()));
}
}
// no break here - otherwise we have to duplicate the code below...
}
case eEventMessageRead: {
EventMessage *em = static_cast<EventMessage*>(e);
Message *msg = em->msg();
UserWnd *userWnd = wnd(msg->contact());
if (userWnd){
bool bBold = false;
for (list<msg_id>::iterator it = CorePlugin::m_plugin->unread.begin(); it != CorePlugin::m_plugin->unread.end(); ++it){
if ((*it).contact != msg->contact())
continue;
bBold = true;
break;
}
m_tabBar->setBold(msg->contact(), bBold);
}
break;
}
case eEventActiveContact: {
EventActiveContact *eac = static_cast<EventActiveContact*>(e);
if (!isActiveWindow())
return false;
UserWnd *userWnd = m_tabBar->currentWnd();
if (userWnd) {
eac->setContactID(userWnd->id());
return true;
}
break;
}
case eEventContact: {
EventContact *ec = static_cast<EventContact*>(e);
Contact *contact = ec->contact();
UserWnd *userWnd = wnd(contact->id());
if(!userWnd)
break;
switch(ec->action()) {
case EventContact::eDeleted: {
removeUserWnd(userWnd);
break;
}
case EventContact::eChanged: {
if (contact->getIgnore()){
removeUserWnd(userWnd);
break;
}
m_tabBar->changeTab(contact->id());
contactChanged(contact);
break;
}
case EventContact::eStatus: {
unsigned style = 0;
QString wrkIcons;
QString statusIcon;
contact->contactInfo(style, statusIcon, &wrkIcons);
bool bTyping = false;
while (!wrkIcons.isEmpty()){
if (getToken(wrkIcons, ',') == "typing"){
bTyping = true;
break;
}
}
if (userWnd->m_bTyping != bTyping){
userWnd->m_bTyping = bTyping;
if (bTyping){
userWnd->setStatus(g_i18n("%1 is typing", contact) .arg(contact->getName()));
}else{
userWnd->setStatus("");
}
userWnd = m_tabBar->currentWnd();
if (userWnd && (contact->id() == userWnd->id()))
m_status->message(userWnd->status());
}
}
//.........这里部分代码省略.........