Пример #1
0
Socket *JabberClient::createSocket()
{
    m_bHTTP = getUseHTTP() && *getURL();
    if (m_bHTTP)
        return new JabberHttpPool(getURL());
    return NULL;
}
Пример #2
0
void WeatherPlugin::timeout()
{
    if (!getSocketFactory()->isActive() || m_fetch_id || (*getURL() == 0))
        return;
    time_t now;
    time(&now);
    if ((unsigned)now < getTime() + CHECK_INTERVAL)
        return;
    m_fetch_id = fetch(NULL, getURL());
}
Пример #3
0
    virtual wxFSFile* GetFile (const wxString &uri)
    {
        mmGUIFrame* frame = m_reportPanel->m_frame;
        wxString sData;
        if (uri.StartsWith("trxid:", &sData))
        {
            long transID = -1;
            if (sData.ToLong(&transID)) {
                const Model_Checking::Data* transaction = Model_Checking::instance().get(transID);
                if (transaction)
                {
                    const Model_Account::Data* account = Model_Account::instance().get(transaction->ACCOUNTID);
                    if (account) {
                        frame->setAccountNavTreeSection(account->ACCOUNTNAME);
                        frame->setGotoAccountID(transaction->ACCOUNTID, transID);
                        wxCommandEvent evt(wxEVT_COMMAND_MENU_SELECTED, MENU_GOTOACCOUNT);
                        frame->GetEventHandler()->AddPendingEvent(evt);
                    }
                }
            }
        }
        else if (uri.StartsWith("trx:", &sData))
        {
            long transID = -1;
            if (sData.ToLong(&transID)) {
                const Model_Checking::Data* transaction = Model_Checking::instance().get(transID);
                if (transaction)
                {
                    mmTransDialog dlg(nullptr, -1, transID);
                    if (dlg.ShowModal() == wxID_OK)
                    {
                        m_reportPanel->rb_->getHTMLText();
                    }
                    m_reportPanel->browser_->LoadURL(getURL(mmex::getReportIndex()));
                }
            }
        }
        if (uri.StartsWith("attachment:", &sData))
        {
            const wxString RefType = sData.BeforeFirst('|');
            const int RefId = wxAtoi(sData.AfterFirst('|'));

            if (Model_Attachment::instance().all_type().Index(RefType) != wxNOT_FOUND && RefId > 0)
            {
                mmAttachmentManage::OpenAttachmentFromPanelIcon(nullptr, RefType, RefId);
                m_reportPanel->browser_->LoadURL(getURL(mmex::getReportIndex()));
            }
        }

        return nullptr;
    }   
Пример #4
0
String getPlainText(IDataObject* dataObject, bool& success)
{
    STGMEDIUM store;
    String text;
    success = false;
    if (SUCCEEDED(dataObject->GetData(plainTextWFormat(), &store))) {
        //unicode text
        UChar* data = (UChar*)GlobalLock(store.hGlobal);
        text = String(data);
        GlobalUnlock(store.hGlobal);      
        ReleaseStgMedium(&store);
        success = true;
    } else if (SUCCEEDED(dataObject->GetData(plainTextFormat(), &store))) {
        //ascii text
        char* data = (char*)GlobalLock(store.hGlobal);
        text = String(data);
        GlobalUnlock(store.hGlobal);      
        ReleaseStgMedium(&store);
        success = true;
    } else {
        //If a file is dropped on the window, it does not provide either of the 
        //plain text formats, so here we try to forcibly get a url.
        text = getURL(dataObject, success);
        success = true;
    }
    return text;
}
String getPlainText(IDataObject* dataObject, bool& success)
{
    STGMEDIUM store;
    String text;
    success = false;
    if (SUCCEEDED(dataObject->GetData(plainTextWFormat(), &store))) {
        // Unicode text
        UChar* data = static_cast<UChar*>(GlobalLock(store.hGlobal));
        text = String(data);
        GlobalUnlock(store.hGlobal);
        ReleaseStgMedium(&store);
        success = true;
    } else if (SUCCEEDED(dataObject->GetData(plainTextFormat(), &store))) {
        // ASCII text
        char* data = static_cast<char*>(GlobalLock(store.hGlobal));
        text = String(data);
        GlobalUnlock(store.hGlobal);
        ReleaseStgMedium(&store);
        success = true;
    } else {
        // FIXME: Originally, we called getURL() here because dragging and dropping files doesn't
        // populate the drag with text data. Per https://bugs.webkit.org/show_bug.cgi?id=38826, this
        // is undesirable, so maybe this line can be removed.
        text = getURL(dataObject, DragData::DoNotConvertFilenames, success);
        success = true;
    }
    return text;
}
Пример #6
0
bool Document::remove()
{
   Variant var = comm.getData(getURL(true), "DELETE");
   Object  obj = boost::any_cast<Object>(*var);

   return boost::any_cast<bool>(*obj["ok"]);
}
Пример #7
0
int main(int argc, char **argv)
{
	URL_FILE *handle;
	char buffer[BUFSIZE];

	if(argc > 1)
		strcpy(BASE,argv[1]);
	else {
		fprintf(stderr, "Usage: %s BaseURL\n",argv[0]);
		exit(1);
	}
		
	handle = url_fopen(BASE, "r");
	if (!handle) {
		fprintf(stderr,"couldn't url_fopen() %s\n", BASE);
		return 2;
	}
	while(!url_feof(handle)) {
		url_fgets(buffer,sizeof(buffer),handle);
		strlower(buffer);
		fputs(buffer,stdout);
		char *cur, link[BUFSIZE], full_link[BUFSIZE];
		cur = buffer;
		while ((cur = nextURL(cur)) != NULL) {
			getURL(cur, link, BUFSIZE-1);
			normalise(link, full_link, BUFSIZE-1);
			printf("%s\n",full_link);
			cur += strlen(link);
		}
	}

	url_fclose(handle);
	return 0;
}
Пример #8
0
    //--------------------------------------------------------------
    void Media::loadFromXML( string XML ){
        cout << XML << endl;
        ofxXmlSettings xml;
        xml.loadFromBuffer(XML);
        xml.pushTag("rsp");{
            id = xml.getAttribute("photo", "id", "");
            farm = xml.getAttribute("photo", "farm", "");
            secret = xml.getAttribute("photo", "secret", "");
            server = xml.getAttribute("photo", "server", "");
            originalsecret = xml.getAttribute("photo", "originalsecret", "");
            originalformat = xml.getAttribute("photo", "originalformat", "");

            string t = xml.getAttribute("photo", "media", "");
            if ( t == "photo"){
                type = FLICKR_PHOTO;
            } else if ( t == "video"){
                type = FLICKR_VIDEO;
            } else {
                type = FLICKR_UNKNOWN;
            }
        } xml.popTag();

        cout << getURL() << endl;
        // to-do: other stuff
    }
Пример #9
0
/*
 * main()
 */
int main(int argc, char *argv[])
{
    pj_caching_pool cp;
    pj_status_t status;

    if (argc < 2 || argc > 3) {
	puts("Usage: httpdemo URL [output-filename]");
	return 1;
    }

    pj_log_set_level(5);

    pj_init();
    pj_caching_pool_init(&cp, NULL, 0);
    mem = &cp.factory;
    pjlib_util_init();

    if (argc > 2)
	f = fopen(argv[2], "wb");
    else
	f = stdout;

    status = getURL(argv[1]);
    if (status != PJ_SUCCESS) {
        PJ_PERROR(1, (THIS_FILE, status, "Error"));
    }

    if (f != stdout)
	fclose(f);

    pj_caching_pool_destroy(&cp);
    pj_shutdown();
    return 0;
}
Пример #10
0
bool HttpRequest::checkifAnswered()
{
	if (answered) {
		log.errorStream() << "Tried to answer an already answered HttpRequest: " << getURL();
	}
	return answered;
}
Пример #11
0
std::string Connection::getRequest(std::string options) {

	CURL *curl_handle;
	CURLcode res;

	struct MemoryStruct tmp;
	std::string userURL;
	std::string result;

	// Build user URL
	userURL = getURL() + "?" + options;

	std::cout << "Requesting: " << userURL << std::endl;

	// Temporary storage
	tmp.memory = (char *) malloc(1);
	tmp.size = 0;

	// Initialize curl
	curl_global_init (CURL_GLOBAL_ALL);

	// Init session
	curl_handle = curl_easy_init();

	// Set URL
	curl_easy_setopt(curl_handle, CURLOPT_URL, userURL.c_str());
	// Set callback
	curl_easy_setopt(curl_handle, CURLOPT_WRITEFUNCTION, WriteMemoryCallback);

	// Set data destination
	curl_easy_setopt(curl_handle, CURLOPT_WRITEDATA, (void *) &tmp);

	// Set user agent
	curl_easy_setopt(curl_handle, CURLOPT_USERAGENT, "libcurl-agent/1.0");

	// Perform http request
	res = curl_easy_perform(curl_handle);

	// Check for errors
	if (res != CURLE_OK) {
		std::cout << "Request status failed: " << curl_easy_strerror(res)
				<< std::endl;
	}
	// Save result
	else {
		result = tmp.memory;
	}

	// Cleanup curl handle
	curl_easy_cleanup(curl_handle);

	// Cleanup temp memory
	free(tmp.memory);

	// Cleanup libcurl
	curl_global_cleanup();

	return result;

}
Пример #12
0
void KEducaEditorStartDialog::accept() {
    if (((_choice == OpenDoc || _choice == OpenRecentDoc)
          && getURL().isEmpty())) {
        KMessageBox::sorry(this, i18n("You need to specify the file to open!"));
    }else
        KEducaEditorStartDialogBase::accept();
}
Пример #13
0
void LLNotification::init(const std::string& template_name, const LLSD& form_elements)
{
	mTemplatep = LLNotifications::instance().getTemplate(template_name);
	if (!mTemplatep) return;

	// add default substitutions
	// TODO: change this to read from the translatable strings file!
	mSubstitutions["SECOND_LIFE"] = "Second Life";
	mSubstitutions["_URL"] = getURL();
	mSubstitutions["_NAME"] = template_name;
	// TODO: something like this so that a missing alert is sensible:
	//mSubstitutions["_ARGS"] = get_all_arguments_as_text(mSubstitutions);

	mForm = LLNotificationFormPtr(new LLNotificationForm(*mTemplatep->mForm));
	mForm->append(form_elements);

	// apply substitution to form labels
	mForm->formatElements(mSubstitutions);

	LLDate rightnow = LLDate::now();
	if (mTemplatep->mExpireSeconds)
	{
		mExpiresAt = LLDate(rightnow.secondsSinceEpoch() + mTemplatep->mExpireSeconds);
	}

	if (mPriority == NOTIFICATION_PRIORITY_UNSPECIFIED)
	{
		mPriority = mTemplatep->mPriority;
	}
}
Пример #14
0
void CPage::checkForErrors(ConnectionPtr connection)
{
	Trace("checkForErrors", getURL().c_str(), getOverallResultCode());

	// only report an error if page failed and not a benchmark and IS a normal page
	if ((getOverallResultCode() != SC_HEADER_RESULT_SUCCESS) &&
		(getOverallResultCode() != SC_HEADER_RESULT_DUMMY_TRANSACTION) &&
		(getPageType() != SC_WEBPAGE_TYPE_COMP) && // this is not a benchmark competitor page type
		(getOverallResultCode() != SC_HEADER_RESULT_WE_ARE_DOWN)) // don't report our down errors
	{
		// increment the failed page counter
		incrementPagesInError();

		checkErrorsAlertable(connection);

		// decide if we need to send an alert...
		if (isErrorAlertable())
		{
			if ((getPageStatus() != SC_WEBPAGE_STATUS_NO_EMAIL) &&
				(getServiceType() != SC_SERVICE_BENCHMARK))
			{
				// an email is required
				sm_emailRequired = true;
			}
		}
	}
}
Пример #15
0
void WeatherPlugin::showBar()
{
    if (m_bar || (*getURL() == 0))
        return;
    QWidgetList  *list = QApplication::topLevelWidgets();
    QWidgetListIt it( *list );
    QWidget *w;
    while ((w=it.current()) != 0) {
        ++it;
        if (w->inherits("MainWindow"))
            break;
    }
    delete list;
    if (w == NULL)
        return;
    BarShow b;
    b.bar_id = BarWeather;
    b.parent = (QMainWindow*)w;
    Event e(EventShowBar, &b);
    m_bar = (QToolBar*)e.process();
    restoreToolbar(m_bar, data.bar);
    connect(m_bar, SIGNAL(destroyed()), this, SLOT(barDestroyed()));
    QTimer *timer = new QTimer(this);
    connect(timer, SIGNAL(timeout()), this, SLOT(timeout()));
    QTimer::singleShot(0, this, SLOT(timeout()));
    timer->start(120000);
    updateButton();
}
Пример #16
0
void Sound::downloadFinished(const QByteArray& data) {
    // replace our byte array with the downloaded data
    QByteArray rawAudioByteArray = QByteArray(data);
    QString fileName = getURL().fileName().toLower();

    static const QString WAV_EXTENSION = ".wav";
    static const QString RAW_EXTENSION = ".raw";
    if (fileName.endsWith(WAV_EXTENSION)) {

        QByteArray outputAudioByteArray;

        interpretAsWav(rawAudioByteArray, outputAudioByteArray);
        downSample(outputAudioByteArray);
    } else if (fileName.endsWith(RAW_EXTENSION)) {
        // check if this was a stereo raw file
        // since it's raw the only way for us to know that is if the file was called .stereo.raw
        if (fileName.toLower().endsWith("stereo.raw")) {
            _isStereo = true;
            qCDebug(audio) << "Processing sound of" << rawAudioByteArray.size() << "bytes from" << getURL() << "as stereo audio file.";
        }

        // Process as RAW file
        downSample(rawAudioByteArray);
    } else {
        qCDebug(audio) << "Unknown sound file type";
    }

    finishedLoading(true);

    _isReady = true;
    emit ready();
}
Пример #17
0
void Chess::setClick(bool isClick) {
    if (isClick) {
        this->initWithFile(getURL_hover().c_str());
    }
    else {
        this->initWithFile(getURL().c_str());
    }
}
Пример #18
0
Chess::Chess(int side, int name, int id_pos) {
	this->side = side;
	this->name = name;
	this->id_pos = id_pos;
	this->id_pos_init = id_pos;

	this->initWithFile(getURL().c_str());
}
Пример #19
0
 void logEvent(const String& eventName,
               int argc,
               const String* argv) override {
   Vector<WebString> webStringArgv;
   for (int i = 0; i < argc; i++)
     webStringArgv.append(argv[i]);
   m_domActivityLogger->logEvent(WebString(eventName), argc,
                                 webStringArgv.data(), getURL(), getTitle());
 }
QString ConservationPlotPrompter::composeRichDoc() {
    QString res = "";

     Actor* annProducer = qobject_cast<IntegralBusPort*>(target->getPort(IN_PORT_DESCR))->getProducer(ANNOT_SLOT_ID);

     QString unsetStr = "<font color='red'>"+tr("unset")+"</font>";
     QString annUrl = annProducer ? annProducer->getLabel() : unsetStr;

     QString file = getHyperlink(OUTPUT_FILE, getURL(OUTPUT_FILE));
     QString assembly = getHyperlink(ASSEMBLY_VER, getURL(ASSEMBLY_VER));

     res.append(tr("Uses annotations from <u>%1</u> as peak regions for conservation plot.").arg(annUrl));
     res.append(tr(" Conservations scores from <u>%1</u>.").arg(assembly));
     res.append(tr(" Outputs the result to <u>%1</u>").arg(file));
     res.append(".");

    return res;
}
Пример #21
0
void ItemDocument::fileSaveAs() {
	if (!getURL(m_fileExtensionInfo)) return;

	writeFile();

	// Our modified state may not have changed, but we emit this to force the
	// main window to update our caption.
	emit modifiedStateChanged();
}
Пример #22
0
void KfmView::copySelection()
{
	// clear the internal clipboard first.
    clipboard->clear();

    // Is there any text selected ?	
    if ( getActiveView()->isTextSelected() )
    {
        QString txt;
		getActiveView()->getSelectedText ( txt );		
        if (!txt.isEmpty())
		{			
            clipboard->append(txt);
			KApplication::clipboard()->setText( txt );
		}
	}
	// If not what about URL(s) ?	
	else
	{
		getActiveView()->getSelected( (*clipboard) );
		// if user clicked on the background w/o selecting anything else.	
		if (clipboard->isEmpty() && popupMenuEvent )
		{
			clipboard->append ( getURL() );
			KApplication::clipboard()->setText( getURL() );
        }
		else
        {
            if ( clipboard->count() == 1 )
    			KApplication::clipboard()->setText( clipboard->first() );
            else if ( clipboard->count() > 1  )
            {
                QString url = "";
                for ( const char *s = clipboard->first(); s != 0L; s = clipboard->next() )
                {
                    url += s;
                    url += "\n"; // add a line feed for separating multiple selections
                }
                if ( !url.isEmpty() )
                    KApplication::clipboard()->setText( url.data() );
            }
        }
    }
}
Пример #23
0
void mmHomePagePanel::fillData()
{
    for (const auto& entry : m_frames)
    {
        m_templateText.Replace(wxString::Format("<TMPL_VAR %s>", entry.first), entry.second);
    }
    Model_Report::outputReportFile(m_templateText);
    browser_->LoadURL(getURL(mmex::getReportIndex()));
    wxLogDebug("Loading file:%s", mmex::getReportIndex());
}
Пример #24
0
void mmReportsPanel::OnDateRangeChanged(wxCommandEvent& /*event*/)
{
    const mmDateRange* date_range = static_cast<mmDateRange*>(this->m_date_ranges->GetClientData(this->m_date_ranges->GetSelection()));
    this->m_start_date->SetValue(date_range->start_date());
    this->m_end_date->SetValue(date_range->end_date());
    wxString error;
    if (this->saveReportText(error, false))
        browser_->LoadURL(getURL(mmex::getReportIndex()));
    else
        browser_->SetPage(error, "");
}
Пример #25
0
/**
 * Retrieves the details for the specified location
 *
 * @param pczLocation The string containing the name/code of the location
 *
 * @return A pointer to a list of LocationInfo entries, possibly empty, 
 *         if no details were found. Caller is responsible for freeing the list.
 */
GList *
getLocationInfo(const gchar * pczLocation)
{
  gint iRetCode = 0;
  gint iDataSize = 0;

  GList * pList = NULL;

  gchar * pcEscapedLocation = convertToASCII(pczLocation); 

  gsize len = getWOEIDQueryLength(pcEscapedLocation);

  gchar * cQueryBuffer = g_malloc0(len);

  gint iRet = getWOEIDQuery(cQueryBuffer, pcEscapedLocation);

  g_free(pcEscapedLocation);

  LXW_LOG(LXW_DEBUG, "yahooutil::getLocationInfo(%s): query[%d]: %s",
          pczLocation, iRet, cQueryBuffer);

  gpointer pResponse = getURL(cQueryBuffer, &iRetCode, &iDataSize);

  if (!pResponse || iRetCode != HTTP_STATUS_OK)
    {
      LXW_LOG(LXW_ERROR, "yahooutil::getLocationInfo(%s): Failed with error code %d",
              pczLocation, iRetCode);
    }
  else
    {
      LXW_LOG(LXW_DEBUG, "yahooutil::getLocationInfo(%s): Response code: %d, size: %d",
              pczLocation, iRetCode, iDataSize);

      LXW_LOG(LXW_VERBOSE, "yahooutil::getLocation(%s): Contents: %s", 
              pczLocation, (const char *)pResponse);

      iRet = parseResponse(pResponse, &pList, NULL);
      
      LXW_LOG(LXW_DEBUG, "yahooutil::getLocation(%s): Response parsing returned %d",
              pczLocation, iRet);

      if (iRet)
        {
          // failure
          g_list_free_full(pList, freeLocation);
        }

    }

  g_free(cQueryBuffer);
  g_free(pResponse);

  return pList;
}
Пример #26
0
void KfmView::slotBookmarks()
{
    char *s;
    QStrList popupFiles = new QStrList();
    getActiveView()->getSelected ( popupFiles ); // get the selected URL(s)
    if ( popupFiles.isEmpty() && popupMenuEvent )
    {
       popupFiles.append ( getURL() );
    }
    for ( s = popupFiles.first(); s != 0L; s = popupFiles.next() )    
	gui->addBookmark( s, s );
}
Пример #27
0
int assertUrlTrue(char* (*getURL)(char* origindata), char* input ,char* answer)
{
				char buffer[BUFSIZ] = {'\0', };
			
				strcpy(buffer, input);

				if(getURL(buffer) != NULL)//getURL에 넣은 헤더를 분석한 값이 NULL이 아니면
				{
								if(strcmp(getURL(buffer), answer) == 0)//기대값과 비교하여 맞는지 확인
								{
												printf("getURL 함수, 기대 결과 %s, 아웃풋 %s\n", answer, getURL(buffer));
												return 1;
								}else
								{
												printf("getURL 함수, 기대 결과 %s, 아웃풋 %s\n", answer, getURL(buffer));
												return 0;
								}	
				}else
				{
								if(answer == NULL)//기대값도 NULL인이 확인
								{
												printf("getURL 함수, 기대 결과 %s, 아웃풋 %s\n", answer, getURL(buffer));
												return 1;
								}else
								{
												printf("getURL 함수, 기대 결과 %s, 아웃풋 %s\n", answer, getURL(buffer));
												return 0;
								}
				}
}
Пример #28
0
void KfmView::slotNewView()
{
	char *s;
    QStrList popupFiles = new QStrList();
    getActiveView()->getSelected ( popupFiles ); // get the selected URL(s)
    if ( popupFiles.isEmpty() && popupMenuEvent )
       popupFiles.append ( getURL() );
	for ( s = popupFiles.first(); s != 0L; s = popupFiles.next() )
	{
	KfmGui *m = new KfmGui( 0L, 0L, s );
	m->show();
    }
}
Пример #29
0
void SkyboxPropertyGroup::appendSubclassData(OctreePacketData* packetData, EncodeBitstreamParams& params, 
                                EntityTreeElementExtraEncodeDataPointer entityTreeElementExtraEncodeData,
                                EntityPropertyFlags& requestedProperties,
                                EntityPropertyFlags& propertyFlags,
                                EntityPropertyFlags& propertiesDidntFit,
                                int& propertyCount, 
                                OctreeElement::AppendState& appendState) const {

    bool successPropertyFits = true;

    APPEND_ENTITY_PROPERTY(PROP_SKYBOX_COLOR, getColor());
    APPEND_ENTITY_PROPERTY(PROP_SKYBOX_URL, getURL());
}
Пример #30
0
Variant Document::getData()
{
   Variant var = comm.getData(getURL(false));
   Object  obj = boost::any_cast<Object>(*var);

   if(obj.find("_id") == obj.end() && obj.find("_rev") == obj.end() &&
      obj.find("error") != obj.end() && obj.find("reason") != obj.end())
   {
      throw Exception("Document '" + getID() + "' not found: " + boost::any_cast<string>(*obj["reason"]));
   }

   return var;
}