Ticket #34210: patch-main.diff

File patch-main.diff, 1.2 KB (added by aguynamedryan+macports@…, 12 years ago)

Patch to main as part of fix

  • src/main.c

    old new  
    7777        WaitressReturn_t wRet;
    7878        PianoRequestDataLogin_t reqData;
    7979        bool ret;
     80        WaitressHandle_t waithSync;
     81        char *syncTime;
     82        unsigned long int syncTimeInt;
     83
     84        /* skip sync step by fetching time from somewhere else */
     85        WaitressInit (&waithSync);
     86        WaitressSetUrl (&waithSync, "http://ridetheclown.com/s2/synctime.php");
     87        if (app->settings.proxy != NULL && strlen (app->settings.proxy) > 0) {
     88                WaitressSetProxy (&waithSync, app->settings.proxy);
     89        }
     90        wRet = WaitressFetchBuf (&waithSync, &syncTime);
     91        WaitressFree (&waithSync);
     92        if (wRet != WAITRESS_RET_OK) {
     93                BarUiMsg (&app->settings, MSG_ERR, "Unable to sync: %s\n",
     94                                WaitressErrorToStr (wRet));
     95                return false;
     96        }
     97
     98        syncTimeInt = strtoul (syncTime, NULL, 0);
     99        app->ph.timeOffset = time (NULL) - syncTimeInt;
     100        free (syncTime);
    80101
    81102        reqData.user = app->settings.username;
    82103        reqData.password = app->settings.password;
    83         reqData.step = 0;
     104        reqData.step = 1;
    84105
    85106        BarUiMsg (&app->settings, MSG_INFO, "Login... ");
    86107        ret = BarUiPianoCall (app, PIANO_REQUEST_LOGIN, &reqData, &pRet, &wRet);