void MsgEdit::action(int type, bool bSaveEdit) { if (type == mnuMail){ pMain->sendMail(Uin); return; } if (sendEvent) return; if (Uin == 0) log(L_WARN, "Bad UIN for message create"); if ((type == mnuAction) || (type == mnuActionInt)){ if ((type == mnuAction) && canSend()) return; ICQUser *u = pClient->getUser(Uin); if (u && u->unreadMsgs.size()){ ICQMessage *msg = history()->getMessage(u->unreadMsgs.front()); if (msg){ setMessage(msg, true, true); setState(); return; } } if (u && (u->Type == USER_TYPE_EXT)){ PhoneBook::iterator it; for (it = u->Phones.begin(); it != u->Phones.end(); ++it){ PhoneInfo *info = static_cast<PhoneInfo*>(*it); if (info->Type() == SMS){ type = mnuSMS; break; } } if (type == mnuActionInt){ pMain->sendMail(u->Uin); return; } }else{ type = mnuMessage; } } ICQMessage *editMsg = NULL; switch (type){ case mnuMessage: editMsg = new ICQMsg; editMsg->Uin.push_back(Uin); break; case mnuURL: editMsg = new ICQUrl; editMsg->Uin.push_back(Uin); break; case mnuSMS: editMsg = new ICQSMS; editMsg->Uin.push_back(Uin); break; case mnuAuth: editMsg = new ICQAuthRequest; editMsg->Uin.push_back(Uin); break; case mnuContacts: editMsg = new ICQContacts; editMsg->Uin.push_back(Uin); break; case mnuFile: editMsg = new ICQFile; editMsg->Uin.push_back(Uin); break; case mnuChat: editMsg = new ICQChat; editMsg->Uin.push_back(Uin); break; default: log(L_WARN, "Unknown message type: %u", type); } setMessage(editMsg, false, false, bSaveEdit); setState(); }