Exemplo n.º 1
0
QString WizCommonApiEntry::groupUsersUrl(const QString& strToken, const QString& strBizGUID, const QString& strkbGUID)
{
    QUrl url(syncUrl());
    QString strExt = QString("?token=%1&biz_guid=%2&kb_guid=%3&t=%4")
            .arg(strToken)
            .arg(strBizGUID)
            .arg(strkbGUID)
            .arg(qrand());

    return url.scheme() + "://" + url.host() + "/wizas/a/biz/user_aliases" + strExt;
}
Exemplo n.º 2
0
Status
syncRepo(const std::string &syncDir, const std::string &syncKey, bool &dirty)
{
    AutoSyncLock lock(gSyncMutex);

    AutoFree<git_repository, git_repository_free> repo;
    ABC_CHECK_GIT(git_repository_open(&repo.get(), syncDir.c_str()));

    std::string url;

    ABC_CHECK(syncUrl(url, syncKey));

    for (int i = 0; i < syncServers.size(); i++)
    {
        ABC_CHECK(syncUrl(url, syncKey, true));
        if (sync_fetch(repo, url.c_str()) >= 0)
        {
            ABC_DebugLog("Syncing to: %s", url.c_str());
            break;
        }
        else
        {
            ABC_DebugLog("FAIlED Syncing to: %s", url.c_str());
        }
    }

    int files_changed, need_push;
    ABC_CHECK_GIT(sync_master(repo, &files_changed, &need_push));

    if (need_push)
        ABC_CHECK_GIT(sync_push(repo, url.c_str()));

    // If this fails, the app has been shut down, leaving us for dead.
    // We will crash anyhow, but this at least makes it official:
    assert(gContext);

    dirty = !!files_changed;
    return Status();
}