CUserProfile::CUserProfile(UserProfile & userProfile, CWengoPhone & cWengoPhone) : _userProfile(userProfile), _cWengoPhone(cWengoPhone), _cContactList(userProfile.getContactList(), cWengoPhone), _cWenboxPlugin(*userProfile.getWenboxPlugin(), cWengoPhone), _cChatHandler(userProfile.getChatHandler(), *this) { _cHistory = NULL; _cPhoneLine = NULL; _cSms = NULL; _cSoftUpdate = NULL; _cWsCallForward = NULL; _cWsContactProfile = NULL; //VOXOX - JRT - 2009.08.03 _pUserProfile = PFactory::getFactory().createPresentationUserProfile(*this); //JRT-XXX _userProfile.userProfileInitializedEvent += boost::bind(&CUserProfile::userProfileInitializedEventHandler, this, _1); _userProfile.phoneLineCreatedEvent += boost::bind(&CUserProfile::phoneLineCreatedEventHandler, this, _1, _2); _userProfile.wsSmsCreatedEvent += boost::bind(&CUserProfile::wsSmsCreatedEventHandler, this, _1, _2); _userProfile.wsSoftUpdateCreatedEvent += boost::bind(&CUserProfile::wsSoftUpdateCreatedEventHandler, this, _1, _2, _3); //VOXOX - JRT - 2009.10.27 _userProfile.wsCallForwardCreatedEvent += boost::bind(&CUserProfile::wsCallForwardCreatedEventHandler, this, _1, _2); _userProfile.loginStateChangedEvent += boost::bind(&CUserProfile::loginStateChangedEventHandler, this, _1, _2); _userProfile.networkDiscoveryStateChangedEvent += boost::bind(&CUserProfile::networkDiscoveryStateChangedEventHandler, this, _1, _2); _userProfile.getHistory().historyLoadedEvent += boost::bind(&CUserProfile::historyLoadedEventHandler, this, _1); _userProfile.getPresenceHandler().authorizationRequestEvent += boost::bind(&CUserProfile::authorizationRequestEventHandler, this, _1, _2, _3); _userProfile.getPresenceHandler().incomingSubscribeEvent += boost::bind(&CUserProfile::incomingSubscribeEventHandler, this, _1, _2, _3, _4, _5); //Check if a PhoneLine already exist if (_userProfile.getActivePhoneLine()) { phoneLineCreatedEventHandler(_userProfile, *_userProfile.getActivePhoneLine()); } historyLoadedEventHandler(_userProfile.getHistory()); /*if (_userProfile.getWsSms()) { wsSmsCreatedEventHandler(_userProfile, *_userProfile.getWsSms()); }*/ checkForSoftUpdate( false ); //Automatic - //VOXOX - JRT - 2009.10.27 createWsContactProfile(); //Call now in case event already fired. //VOXOXCHANGE CJC //VOXOX - JRT - 2009.05.24 TODO: find supporting files and remove from project. //Don't need call transfer functionality /*if (_userProfile.getWsCallForward()) { wsCallForwardCreatedEventHandler(_userProfile, *_userProfile.getWsCallForward()); }*/ }
bool ConfigImporter::importContactsFromV1toV3(const string & fromDir, UserProfile & userProfile) { File mDir(fromDir); StringList fileList = mDir.getFileList(); ContactList & contactList = userProfile.getContactList(); ContactGroup contactGroup( "Classic", EnumGroupType::GroupType_User); //JRT-GRPS contactList.addContactGroup( contactGroup ); ///VOXOX - JRT - 2009.05.07 - JRT-GRPS IMAccountList imAccountList = userProfile.getIMAccountManager().getIMAccountsOfProtocol(EnumIMProtocol::IMProtocolWengo); if (!imAccountList.size()) { return false; } for (unsigned i = 0; i < fileList.size(); i++) { File mFile(fromDir + fileList[i]); string Id = fileList[i].substr(0, fileList[i].find("_", 0)); vcard_t mVcard; initVcard(&mVcard); if (!mFile.getExtension().compare("vcf")) { if (classicVcardParser(fromDir + fileList[i], &mVcard) == false) { continue; } int extPos = fileList[i].find_last_of('.'); string fileWoExt = fileList[i].substr(0, extPos + 1); classicXMLParser(fromDir + fileWoExt + "xml", &mVcard); // IMContact imContact(*imAccountList.begin(), mVcard.id); //VOXOX - JRT - 2009.04.09 IMContact imContact(imAccountList.begin()->second, mVcard.id); //VOXOX - JRT - 2009.04.26 // Contact & contact = contactList.createContact(); // contact.setGroupId(contactList.getContactGroupIdFromName("Classic")); // addContactDetails(contact, &mVcard); // contact.addIMContact(imContact); Contact* contact = contactList.createContact(); // contact->setGroupId(contactList.getContactGroupIdFromName("Classic")); contact->addToGroup(contactList.getContactGroupIdFromName("Classic"), EnumGroupType::GroupType_User); //VOXOX - JRT - 2009.05.06 JRT-GRPS addContactDetails(*contact, &mVcard); contact->addIMContact(imContact); contactList.addContact( contact ); //ContactList will delete contact //End Voxox } } return true; }