bool ICQClient::load(istream &s, string &nextPart) { ICQUser::load(s, nextPart); for (;;){ if (!strcmp(nextPart.c_str(), "[ContactList]")){ contacts.load(s, nextPart); continue; } if (!strcmp(nextPart.c_str(), "[Group]")){ ICQGroup *grp = new ICQGroup; if (grp->load(s, nextPart)){ contacts.groups.push_back(grp); }else{ delete grp; } continue; } if (!strcmp(nextPart.c_str(), "[User]")){ ICQUser *u = new ICQUser; if (u->load(s, nextPart) && u->Uin() && (u->Uin() != Uin())){ contacts.users.push_back(u); }else{ delete u; } continue; } break; } if (*EncryptedPassword.c_str() == 0) storePassword(DecryptedPassword.c_str()); setupProxy(); ICQEvent e(EVENT_INFO_CHANGED); process_event(&e); return true; }
void UserInfo::saveInfo() { ICQUser *u = pClient->getUser(m_nUin, m_nUin == 0); if (u == NULL) return; if (m_nUin == 0) m_nUin = u->Uin(); inSave = true; emit saveInfo(u); inSave = false; ICQEvent e(EVENT_INFO_CHANGED, m_nUin); processEvent(&e); }
bool MoveUserEvent::process(ICQClient *icq, unsigned short result) { if (result == 0x0E){ log(L_DEBUG, "Need auth"); ICQUser *u = icq->getUser(m_nUin); ICQGroup *g = icq->getGroup(grp_id); if ((u == NULL) || (g == NULL)) return false; if (u->WaitAuth()){ log(L_WARN, "Move user failed (permission)"); return false; } u->WaitAuth = true; icq->moveUser(u, g); ICQEvent e(EVENT_AUTH_REQUIRED, m_nUin); icq->process_event(&e); return false; } if (result != 0){ log(L_WARN, "Move user failed %04X", result); return false; } ICQUser *u = icq->getUser(m_nUin); if (u == NULL) return false; ICQGroup *g = icq->getGroup(grp_id); if (g == NULL) return false; if (u->Uin() < UIN_SPECIAL){ icq->sendRosterGrp(g->Name, g->Id, u->Id); icq->snac(ICQ_SNACxFAM_LISTS, ICQ_SNACxLISTS_SAVE); icq->sendPacket(); if (u->GrpId){ ICQGroup *g = icq->getGroup(u->GrpId); if (g){ icq->snac(ICQ_SNACxFAM_LISTS, ICQ_SNACxLISTS_EDIT); icq->sendPacket(); MoveUserDummyEvent *e = new MoveUserDummyEvent; icq->sendRoster(e, ICQ_SNACxLISTS_DELETE, u->Uin, g->Id(), u->Id(), 0, u->Alias.c_str(), u->WaitAuth()); icq->sendRosterGrp(g->Name.c_str(), g->Id(), 0); icq->snac(ICQ_SNACxFAM_LISTS, ICQ_SNACxLISTS_SAVE); icq->sendPacket(); } } } u->GrpId = grp_id; return true; }
void ICQClient::processListQueue() { for (;;){ if (listQueue.size() == 0) return; list_req lr = *listQueue.begin(); ICQUser *u = getUser(lr.uin); if (u == NULL){ listQueue.remove(lr); continue; } unsigned short userId = contacts.getUserId(u); ICQSetListEvent *e = new ICQSetListEvent(u->Uin(), lr.list_type, lr.bSet); sendRoster(e, lr.bSet ? ICQ_SNACxLISTS_CREATE : ICQ_SNACxLISTS_DELETE, u->Uin, 0, userId, lr.list_type); return; } }