亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? maincpp.cpp

?? funambol windows mobile plugin source code, the source code is taken from the funambol site
?? CPP
?? 第 1 頁 / 共 2 頁
字號:
/*
 * Copyright (C) 2003-2007 Funambol, Inc
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 as
 * published by the Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY, TITLE, NONINFRINGEMENT or FITNESS FOR A PARTICULAR
 * PURPOSE.  See the GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
 * 02111-1307  USA
 */
#include "Winbase.h"
#include <windows.h>
#include <oleauto.h>
#include "initguid.h"
#include "pimstore.h"
#include <stdio.h>

#include "base/startcmd.h"
#include "pim/maincpp.h"
#include "pim/Utils.h"
#include "pim/SettingFunctions.h"
#include "client/SyncClient.h"
#include "pim/ContactSyncSource.h"
#include "pim/CalendarSyncSource.h"
#include "pim/NoteSyncSource.h"
#include "pim/TaskSyncSource.h"
#include "pim/BriefcaseSyncSource.h"

#include "pim/mail/MailSyncSource.h"
#include "client/MailSourceManagementNode.h"
#include "client/DMTClientConfig.h"
#include "filter/SourceFilter.h"
#include "filter/ClauseUtil.h"

#include "spdm/DMTree.h"
#include "spdm/DMTreeFactory.h"
#include "syncml/formatter/Formatter.h"
#include "spds/spdsutils.h"
#include "Notify.h"
#include "notify/timed_msgbox.h"
#include "pim/account.h"
#include "OutOfMemoryException.h"

#include "pim/difftime.h"

#include "events/SyncItemListenerClient.h"
#include "events/SyncListenerClient.h"
#include "events/SyncSourceListenerClient.h"
#include "events/SyncStatusListenerClient.h"
#include "events/TransportListenerClient.h"
#include "event/SetListener.h"

#include "HwndFunctions.h"
#include "customization.h"

#include "pim/CustomSyncClient.h"
#include <new.h>
#include <algorithm>
#include <string>

using namespace std;

//
// USE the pim/ClientSettings.h. THis must be shared with the same ClientSettings of the
// FunambolClient
//
#include "pim/ClientSettings.h"

#define OL_MAIL 610

static SyncSourceListenerClient* syncSourceListener ;

// it could be a string. it is a vector because better should be divide the sources
// and not get a string
// TODO: do we need this as a global???
//static vector<wstring> sourceNameForSlow;

/** Prototypes for local functions */
static wstring getMailUnsent(MailSyncSource& mailSource);
static wchar_t* completeMailId(const wchar_t* path, const wchar_t* partialID);
static wchar_t* findMailIdInFile(const wchar_t* fileName, const wchar_t* partialID);
//static int checkRefreshFromServer(int type);

static TCHAR* getMailMaxMsgSize();

/**
 * List of the sources to sync when no subset is specified,
 * in the default order. The list must be NULL terminated.
 */
const static wchar_t *defaultSources[] = {
        MAILS_NAME,
        CONTACTS_NAME,
        APPOINTMENTS_NAME,
        TASKS_NAME,
        NOTES_NAME,
        FAVORITES_NAME,
        FILES_NAME,
        NULL
};


/**
 * Function to handle the memory failure. It is set to be called at new failure
 * using the _set_new_handler() call in the main of the calling program.
 *
 * @param size the size of the memory required
 *
 * @throws an OutOfMemoryException with error code -1
 */
int operatorNewHandler(size_t size)
{
    throw OutOfMemoryException(size, -1);
}


/*
 * Return the sources to sync from the current config.
 */
static vector<const wchar_t*> getActiveSources(ClientSettings &cs,
                                               const wchar_t **sources)
{
    vector<const wchar_t*> ret;
    bool foundFirstSource = false;

    for (int j=0; defaultSources[j]; j++) {
        for (int i=0; sources[i]; i++){
            if (wcscmp(defaultSources[j], sources[i]) == 0) {

                char *name = toMultibyte(sources[i]);               //XXX
                SyncSourceConfig *sc = cs.getSyncSourceConfig(name);

                if (!sc) {
                    LOG.error("No config for source: %s", name);
                }
                else if(strcmp(sc->getSync(), "none") != 0) {
                    ret.push_back(sources[i]);

                    if (!foundFirstSource) {
                        HWND hwnd = HwndFunctions::getWindowHandle();
                        if (hwnd) {
                             int idSpecifiedSource = sourceNameToId(name);
                             SendMessage(hwnd, (WM_APP+4), (WPARAM) 1, (LPARAM) idSpecifiedSource );
                        }
                        foundFirstSource = true;
                    }
                }
                delete [] name;                                     //XXX
                break;
            }
        }
    }

    return ret;
}

/* Perform the synchronization */
static DWORD WINAPI performSync(ClientSettings& config,
                                const wchar_t* path,
                                vector<const wchar_t*> &sources,
                                const wchar_t** ids,
                                const char* mode)
{

    if (sources.empty()) {
        LOG.debug("No sources to sync");
        return 0;
    }

    int ret = 0;
    int mailSourceIndex = -1, result = 0;
    int days = 0, attachSize = 0;
    BOOL blockedByUser = FALSE;

    TCHAR* msxmessagesize = getMailMaxMsgSize();
    long maxMailMessageSize = (wcstol(msxmessagesize, NULL, 10) - 16384) / 1024;
    wchar_t* downloadAge = NULL;
    SourceFilter* filter = NULL;

    ArrayList syncSources;
    char* value = NULL;

    ManagementNode* node = NULL;

    LOG.setLevel(getLOGLevel());

    /*
    * To understand if the briefcase and note directory exist. If no and there are
    * no other source to sync the message is specific
    */
    BOOL briefcaseDirExists = TRUE;
    BOOL noteDirExists = TRUE;

    //
    // Mail configuration read now because it has to have a scope until the end
    //
    MailSourceManagementNode m = MailSourceManagementNode(SOURCES_CONTEXT, "mails");
    MailSyncSourceConfig sc;
    sc = m.getMailSourceConfig(true);
    MailSyncSource mailSource = MailSyncSource (TEXT("mail"), &sc);

    for (int i=0, l=sources.size(); i<l; i++) {
        if (wcscmp(sources[i], CONTACTS_NAME) == 0) {

            ContactSyncSource s(CONTACTS_NAME, OL_CONTACTS, config.getSyncSourceConfig(CONTACTS_NAME_A));
            s.setPath(path);
            s.setMimeType(config.getSyncSourceConfig(CONTACTS_NAME_A)->getType());
            if (mode) {
                s.setSyncMode(syncModeCode(mode));
            }
            syncSources.add(s);
        }
        else if (wcscmp(sources[i], APPOINTMENTS_NAME) == 0) {

            CalendarSyncSource s(APPOINTMENTS_NAME, OL_CALENDAR,
                                 config.getSyncSourceConfig(APPOINTMENTS_NAME_A));
            s.setPath(path);
            s.setMimeType(config.getSyncSourceConfig(APPOINTMENTS_NAME_A)->getType());
            if (mode) {
                s.setSyncMode(syncModeCode(mode));
            }
            syncSources.add(s);
        }
        else if (wcscmp(sources[i], TASKS_NAME)        == 0) {

            TaskSyncSource  s(TASKS_NAME, OL_TASK, config.getSyncSourceConfig(TASKS_NAME_A));
            s.setPath(path);
            s.setMimeType(config.getSyncSourceConfig(TASKS_NAME_A)->getType());
            if (mode) {
                s.setSyncMode(syncModeCode(mode));
            }
            syncSources.add(s); //XXX
        }
        else if (wcscmp(sources[i], FAVORITES_NAME)    == 0) {
/*
            FavoritesSyncSource s(FAVORITES_NAME, OL_FAVORITES);
            s.setPath(path);
            syncSources.add(s);
*/
        }
        else if (wcscmp(sources[i], FILES_NAME)        == 0) {
            //config.readConfigSources(FILES_NAME_A);
            BriefcaseSyncSource  s(FILES_NAME, OL_BRIEFCASE, config.getSyncSourceConfig(FILES_NAME_A));
            s.setPath(path);
            if (mode) {
                s.setSyncMode(syncModeCode(mode));
            }
            wchar_t* dir = toWideChar((config.getWinSyncSourceConfig(FILES_NAME_A))->getSyncDir().c_str());
            if (existsDirectory(dir)) {
                s.setDir(dir);
                syncSources.add(s);

            } else {
                LOG.info("Briefcase dir %S doesn't exists!", dir);
                briefcaseDirExists = FALSE;
            }
            if (dir) { delete [] dir; dir = NULL; }
        }
        else if (wcscmp(sources[i], NOTES_NAME) == 0) {
            //config.readConfigSources(NOTES_NAME_A);
            NoteSyncSource s(NOTES_NAME, OL_NOTES, config.getSyncSourceConfig(NOTES_NAME_A));
            s.setPath(path);
            if (mode) {
                s.setSyncMode(syncModeCode(mode));
            }
            wchar_t* dir = toWideChar((config.getWinSyncSourceConfig(NOTES_NAME_A))->getSyncDir().c_str());
            if (existsDirectory(dir)) {
                s.setDir(dir);
                syncSources.add(s);
            } else {
                LOG.info("Note dir %S doesn't exists!", dir);
                noteDirExists = FALSE;
            }
            if (dir) { delete [] dir; dir = NULL; }
        }
        else if (wcscmp(sources[i], MAILS_NAME) == 0 && doesFunambolAccountExist()) {

            if (mode) {
                mailSource.setSyncMode(syncModeCode(mode));
            }
            wchar_t t[12];
            getFolderToSync(sc, t);

            attachSize = sc.getAttachSize();

            // we want to disable the message size filter for the inclusive items
            // but we need to use the default as for donwload all message
            if (ids)
                attachSize = -1;

            if (attachSize == -1) {
                //reserved value for the remain part of syncml msg
                // 1024 because the filter multiply for 1024
                attachSize = maxMailMessageSize;
            }
            //
            // Set the size from the filter.
            //
            sc.setAttachSize(attachSize*1024);

            mailSource.setMaxMailMessageSize(maxMailMessageSize*1024);
            //
            // the ids is an array of mail id
            //
            if (ids) {
                //
                mailSource.setIsSyncInclusive(true);
                mailSource.setSyncMode(SYNC_ONE_WAY_FROM_SERVER);
                wchar_t* idComplete = completeMailId(path, ids[0]);
                if (idComplete) {
                    char* ss = toMultibyte(idComplete);
                    filter = ClauseUtil::createSourceFilterInclusive(ss, attachSize);
                    delete [] ss;
                    delete [] idComplete;
                }
            } else {
                mailSource.setIsSyncInclusive(false);
                days = sc.getDownloadAge();
                downloadAge = getDayBefore(days);

                filter =
                    ClauseUtil::createSourceFilter(downloadAge, sc.getBodySize(), attachSize);
            }

            mailSource.setPath(path);
            mailSource.setFolderToSync(t);
            mailSource.setFilter(filter);

            syncSources.add(mailSource);
        }
    }

    if (syncSources.size() == 0) {
            LOG.debug("The source array to sync is empty");
        if (blockedByUser) {
            LOG.debug("%s", "No sources to sync: blockedByUser");
            ret = -20;
        } else if (briefcaseDirExists == FALSE) {
            LOG.debug("%s", "No sources to sync: briefcaseDirExists false");
            ret = -25;
        } else if (noteDirExists == FALSE) {
            LOG.debug("%s", "No sources to sync: noteDirExists false");
            ret = -26;
        } else {
            LOG.debug("%s", "No sources to sync");
            ret = -10;
        }

    } else {
        //
        // Now we can create the Sync4jClient object and kick off the sync
        //
        // FIXME: adjust CustomSyncClient to make the hard work
        // the main should be as light as possible.
        CustomSyncClient syncClient;

        if (ids) {
            syncClient.isMailInclusive = TRUE;
        }
        else {
            syncClient.isMailInclusive = FALSE;
        }

        syncSourceListener->sc = &syncClient;

        int i=0;
        int l = syncSources.size();

        const int ml = 10;
        SyncSource* s_array[ml];
        for (i=0; (i<l) && (i<ml-1); ++i) {
            const wchar_t *name = ((SyncSource*)syncSources[i])->getName();
            if (wcscmp(name, TEXT("mail")) == 0) {
                s_array[i] = &mailSource;
            } else {
                s_array[i] = (SyncSource*)syncSources[i];
            }
            syncClient.namesOfSources.push_back(name); //XXX
        }
        s_array[i] = NULL;

        ret = syncClient.sync(config, s_array);

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
97se狠狠狠综合亚洲狠狠| 欧美成人乱码一区二区三区| 欧美精品在线视频| 国产精品美女久久久久久久久久久| 亚洲老司机在线| 国产久卡久卡久卡久卡视频精品| 欧美视频在线不卡| 国产日本亚洲高清| 麻豆国产欧美日韩综合精品二区 | 日本一区中文字幕| 99在线视频精品| 久久综合狠狠综合久久激情| 天堂蜜桃91精品| 欧洲精品中文字幕| 日韩毛片一二三区| 成人少妇影院yyyy| 久久久久久亚洲综合影院红桃| 午夜精品久久久久久久| 91国偷自产一区二区开放时间| 国产欧美精品一区二区三区四区| 免费在线观看精品| 欧美福利电影网| 亚洲午夜激情网页| 欧美日韩久久一区二区| 亚洲午夜影视影院在线观看| 一本色道综合亚洲| 亚洲欧美偷拍另类a∨色屁股| 成人av综合在线| 国产精品久久久久久亚洲伦 | 精品婷婷伊人一区三区三| 一区二区三区四区国产精品| 99久久99久久久精品齐齐 | 国产调教视频一区| 国产精品影视在线| 国产欧美日韩亚州综合| 成人免费高清在线观看| 国产精品久久午夜夜伦鲁鲁| 99这里只有久久精品视频| 亚洲人精品午夜| 色哟哟一区二区| 亚洲二区在线观看| 日韩欧美色综合网站| 激情成人综合网| 中文一区在线播放| 色悠悠久久综合| 亚洲图片欧美色图| 欧美一区二区三区电影| 激情久久久久久久久久久久久久久久| 久久综合久久综合九色| 99久久综合精品| 亚洲一区二区三区影院| 欧美疯狂性受xxxxx喷水图片| 老司机免费视频一区二区三区| 久久亚洲二区三区| 99re热视频精品| 日一区二区三区| 欧美不卡一区二区| 99精品一区二区| 日本成人超碰在线观看| 中文在线资源观看网站视频免费不卡| 色婷婷久久综合| 日韩极品在线观看| 国产精品国产三级国产aⅴ入口 | 成人免费观看视频| 亚洲成人福利片| 久久精品一区二区三区不卡| 91色视频在线| 日韩不卡手机在线v区| 欧美激情自拍偷拍| 欧美日韩综合不卡| 国产99久久久国产精品潘金| 亚洲综合另类小说| 国产农村妇女毛片精品久久麻豆 | 亚洲综合一区在线| 精品国产百合女同互慰| 色哟哟一区二区在线观看| 久久精品免费观看| 亚洲成人自拍一区| 欧美国产激情二区三区| 91精品国产91热久久久做人人| 99久久99久久久精品齐齐| 蓝色福利精品导航| 午夜精品一区二区三区三上悠亚| 国产女人aaa级久久久级| 欧美一级理论片| 日本韩国欧美一区| 成人黄色国产精品网站大全在线免费观看| 肉丝袜脚交视频一区二区| 亚洲欧美日本韩国| 国产精品系列在线| 久久午夜老司机| 欧美成人综合网站| 欧美三级中文字幕| 日本韩国欧美国产| 99在线视频精品| jiyouzz国产精品久久| 国产老妇另类xxxxx| 蜜桃av一区二区| 五月婷婷综合激情| 亚洲第一在线综合网站| 亚洲美女免费视频| 亚洲图片另类小说| 亚洲视频一二三| 亚洲人妖av一区二区| 国产精品毛片久久久久久 | 欧美精品一区二区三区四区 | 欧美日韩一卡二卡三卡| 91视频免费观看| 一本一本久久a久久精品综合麻豆| 国产大片一区二区| 懂色av中文一区二区三区| 国产麻豆一精品一av一免费| 激情成人午夜视频| 国产剧情一区在线| 丁香婷婷综合五月| 成人黄色av网站在线| 99久久婷婷国产综合精品| 成人av第一页| 色偷偷久久一区二区三区| 欧美亚洲愉拍一区二区| 欧美日韩一区二区三区四区 | 日本不卡123| 久久激情综合网| 激情六月婷婷综合| 成人午夜看片网址| 99久久久国产精品免费蜜臀| 日本高清视频一区二区| 欧美日韩亚洲综合| 欧美一卡2卡3卡4卡| 久久久蜜桃精品| 国产精品国产三级国产三级人妇| 亚洲美女淫视频| 青草国产精品久久久久久| 国产曰批免费观看久久久| 高清成人在线观看| 欧美自拍丝袜亚洲| 日韩精品自拍偷拍| 国产精品乱码妇女bbbb| 一区二区三区日韩精品视频| 日韩精品亚洲一区二区三区免费| 日本欧美在线观看| 国产999精品久久| 色成年激情久久综合| 欧美一区二区精品在线| 欧美激情一区二区在线| 亚洲一区二区偷拍精品| 国产麻豆精品在线观看| 在线观看免费亚洲| 久久综合久久久久88| 亚洲永久免费av| 黄页视频在线91| 在线观看日韩av先锋影音电影院| 欧美xxxxx裸体时装秀| 综合久久给合久久狠狠狠97色| 日韩制服丝袜先锋影音| 国产99久久久国产精品免费看| 欧美日韩黄色一区二区| 国产欧美精品一区| 亚洲国产成人av| 99在线精品免费| 欧美大片日本大片免费观看| 亚洲男人电影天堂| 国产自产2019最新不卡| 欧美日韩1区2区| 亚洲图片激情小说| 国产自产v一区二区三区c| 欧美精品色综合| 亚洲欧美在线高清| 国产一区二区美女诱惑| 欧美精品一二三区| 亚洲综合一区二区三区| 高清不卡在线观看av| 欧美不卡一区二区| 日本少妇一区二区| 欧美私人免费视频| 亚洲同性同志一二三专区| 国产精品99久久久久久久女警| 91精品在线麻豆| 亚洲一区二区av电影| 94色蜜桃网一区二区三区| 久久九九久久九九| 国产一区二区三区最好精华液| 91精品欧美一区二区三区综合在| 亚洲一区二三区| 欧美中文字幕亚洲一区二区va在线| 国产精品日日摸夜夜摸av| 国产大陆亚洲精品国产| 久久综合中文字幕| 国内偷窥港台综合视频在线播放| 91精品国产手机| 日韩专区一卡二卡| 欧美一区二区三区人| 日韩电影在线观看网站| 欧美日产在线观看| 日本午夜精品一区二区三区电影 | 欧美午夜在线一二页| 又紧又大又爽精品一区二区| 成人免费黄色大片| 亚洲天堂2016| 欧美在线不卡视频|