int test(char *URL) { (void)URL; /* not used */ if(scopeid()) return 6; if(append()) return 5; if(set_url()) return 1; if(set_parts()) return 2; if(get_url()) return 3; if(get_parts()) return 4; printf("success\n"); return 0; }
PlaceModel::PlaceModel(int _index, QObject *parent) : UpdatingModel(parent), index(_index) { qDebug() << "creating area model"; settings_name = "places-"; settings_name.append (QString::number(index)); qDebug () << "settings_name "<< settings_name; if (index == 0) { if (!settings->contains(settings_name)) { settings->setValue(settings_name, "USA"); } } if (settings->contains(settings_name)) { places[index] = settings->value(settings_name).toString(); } else { places[index] = ""; } qDebug () << "index " << index << " places " << places[index]; // TODO memory leak? appendRow (new QStandardItem (places[index])); set_url (); }
void RceQueryRefuseReceiveWishItem::MergeFrom(const RceQueryRefuseReceiveWishItem& from) { GOOGLE_CHECK_NE(&from, this); if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) { if (from._has_bit(0)) { set_type(from.type()); } if (from._has_bit(1)) { set_name(from.name()); } if (from._has_bit(2)) { set_playerid(from.playerid()); } if (from._has_bit(3)) { set_id(from.id()); } if (from._has_bit(4)) { set_guid(from.guid()); } if (from._has_bit(5)) { set_planetid(from.planetid()); } if (from._has_bit(6)) { set_time(from.time()); } if (from._has_bit(7)) { set_msg(from.msg()); } } if (from._has_bits_[8 / 32] & (0xffu << (8 % 32))) { if (from._has_bit(8)) { set_url(from.url()); } } mutable_unknown_fields()->MergeFrom(from.unknown_fields()); }
void MDIShellBrowserChild::entry_selected(Entry* entry) { if (_left_hwnd) _shellBrowser->select_folder(entry, false); _shellBrowser->UpdateFolderView(entry->get_shell_folder()); // set size of new created shell view windows ClientRect rt(_hwnd); resize_children(rt.right, rt.bottom); // set new URL TCHAR path[MAX_PATH]; if (entry->get_path(path, COUNTOF(path))) { String url; if (path[0] == ':') url.printf(TEXT("shell://%s"), path); else url.printf(TEXT("file://%s"), path); set_url(url); } }
void PlaceModel::handle_parent_text_changed (QString text) { qDebug () << "index " << index << " handle_parent_text_changed " << text; places[index] = ""; settings->setValue(settings_name, places[index]); set_url (); emit value_changed (""); }
void curl(const std::string& uri, const std::string& method = "GET", const std::string& content="", bool auth=false) { set_url(uri); if (auth) { cout << __LINE__ << ":" << uri << endl; add_header("Accept: application/json"); add_header("Accept-Language: en_US"); /* string userpass = m_client_id + ":" + m_client_secret; curl_easy_setopt(m_curl, CURLOPT_HTTPAUTH, (long)CURLAUTH_BASIC); curl_easy_setopt(m_curl, CURLOPT_USERPWD, userpass.c_str()); curl_easy_setopt(m_curl, CURLOPT_SSH_KNOWNHOSTS, "/root/.ssh/known_hosts"); */ curl_easy_setopt(m_curl, CURLOPT_WRITEFUNCTION, auth_request_callback); //curl_easy_setopt(m_curl, CURLOPT_POSTFIELDSIZE_LARGE, (curl_off_t)29); //curl_easy_setopt(m_curl, CURLOPT_MAXREDIRS, 50L); ////////////////////////////////////////////////////////////////////////// curl_easy_setopt(m_curl, CURLOPT_URL, "https://api.sandbox.paypal.com/v1/oauth2/token"); curl_easy_setopt(m_curl, CURLOPT_NOPROGRESS, 1L); curl_easy_setopt(m_curl, CURLOPT_USERPWD, "AQHK3B-gB3sdb1ierWaMMap-6dKJtC-NGIRPeCa6GsZHVioiso-peMOyDgdCpThLv2rz39BTzqk6ajWy:EOiC6EF3aXo9X4whY5l51QPlQ9vzDsbcM2ihIyUqqNDUQ2NrMpvpjUZqeJ6AJ7bmzXXXyV4BOYsmq-Lo"); curl_easy_setopt(m_curl, CURLOPT_POSTFIELDS, "grant_type=client_credentials"); curl_easy_setopt(m_curl, CURLOPT_POSTFIELDSIZE_LARGE, (curl_off_t)29); curl_easy_setopt(m_curl, CURLOPT_USERAGENT, "curl/7.29.0"); curl_easy_setopt(m_curl, CURLOPT_MAXREDIRS, 50L); curl_easy_setopt(m_curl, CURLOPT_SSH_KNOWNHOSTS, "/root/.ssh/known_hosts"); curl_easy_setopt(m_curl, CURLOPT_CUSTOMREQUEST, "POST"); curl_easy_setopt(m_curl, CURLOPT_TCP_KEEPALIVE, 1L); } else { cout << __LINE__ << ":" << uri << endl; add_header("Content-Type:application/json"); add_header("Authorization:"+m_token_type+" "+ m_access_token); } #ifdef DEBUG curl_easy_setopt(m_curl, CURLOPT_HEADER, 1); #endif /*curl_easy_setopt(m_curl, CURLOPT_TCP_KEEPALIVE, 1L); curl_easy_setopt(m_curl, CURLOPT_POSTFIELDS, content.c_str()); curl_easy_setopt(m_curl, CURLOPT_HTTPHEADER, m_headerlist); curl_easy_setopt(m_curl, CURLOPT_CUSTOMREQUEST, method.c_str());*/ on_request(); curl_slist_free_all(m_headerlist); m_headerlist = NULL; }
const bool SM_Net::create ( const std::string &new_url ) { if( ! check_url( new_url ) ) { SM_Util::msg_err( "Error: could not identify URL." ); show_error( "URL Check", "Could not identify URL." , false ); return false; } int find_return = new_url.find( "http://" ); /* http */ if( find_return == 0 ) sm_protocol = 0; else { find_return = new_url.find( "ftp://" ); /* ftp */ if( find_return == 0 ) sm_protocol = 1; else { SM_Util::msg_err( "Error: network protocol not supported." ); show_error( "URL Check", "Network protocol\nnot supported." , false ); sm_protocol = 2; return false; } } if ( ! set_url( new_url ) ) { SM_Util::msg_err( "Error: could not define url." ); show_error( "URL Check", "Could not define url." , false ); return false; } if ( ! set_port( new_url ) ) { SM_Util::msg_err( "Error: could not define port." ); show_error( "Port Check", "Could not define port." , false ); return false; } if ( ! set_address( new_url ) ) { SM_Util::msg_err( "Error: could not define address." ); show_error( "Address Check", "Could not define address." , false ); return false; } if ( ! set_fileName( new_url ) ) { SM_Util::msg_err( "Error: could not define file name." ); show_error( "URL File Check", "Could not define\nfile name." , false ); return false; } return true; }
/* webclient_closed(): * * Callback function. Called from the webclient when the HTTP * connection is connected. */ void webclient_connected(void) { start_loading(); clear_page(); show_statustext("Request sent..."); set_url(webclient_hostname(), webclient_port(), webclient_filename()); #if WWW_CONF_RENDERSTATE renderstate = HTMLPARSER_RENDERSTATE_NONE; #endif /* WWW_CONF_RENDERSTATE */ htmlparser_init(); }
http_header::http_header(const char* url, dbuf_guard* dbuf /* = NULL */) { if (dbuf != NULL) { dbuf_ = dbuf; dbuf_internal_ = NULL; } else { dbuf_internal_ = new dbuf_guard; dbuf_ = dbuf_internal_; } init(); if (url && *url) set_url(url); }
void MsgNeighbor::MergeFrom(const MsgNeighbor& from) { GOOGLE_CHECK_NE(&from, this); neighbor_.MergeFrom(from.neighbor_); if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) { if (from._has_bit(0)) { set_platform(from.platform()); } if (from._has_bit(1)) { set_accountid(from.accountid()); } if (from._has_bit(2)) { set_score(from.score()); } if (from._has_bit(3)) { set_xp(from.xp()); } if (from._has_bit(4)) { set_extid(from.extid()); } if (from._has_bit(5)) { set_url(from.url()); } if (from._has_bit(6)) { set_name(from.name()); } if (from._has_bit(7)) { set_isneighbor(from.isneighbor()); } } if (from._has_bits_[8 / 32] & (0xffu << (8 % 32))) { if (from._has_bit(8)) { set_levelbasedonscore(from.levelbasedonscore()); } if (from._has_bit(9)) { set_wishlist(from.wishlist()); } if (from._has_bit(10)) { set_damageprotectiontimeleft(from.damageprotectiontimeleft()); } if (from._has_bit(11)) { set_tutorialcompleted(from.tutorialcompleted()); } } mutable_unknown_fields()->MergeFrom(from.unknown_fields()); }
void FileChildWindow::set_curdir(Entry* entry) { CONTEXT("FileChildWindow::set_curdir()"); _path[0] = TEXT('\0'); _left->_cur = entry; _right->_root = entry&&entry->_down? entry->_down: entry; _right->_cur = entry; if (entry) { WaitCursor wait; if (!entry->_scanned) scan_entry(entry); else { HiddenWindow hide(_right_hwnd); ListBox_ResetContent(_right_hwnd); _right->insert_entries(entry->_down); _right->calc_widths(false); ///@todo make configurable (This call takes really _very_ long compared to all other processing!) _right->set_header(); } entry->get_path(_path, COUNTOF(_path)); } if (_hwnd) // only change window title if the window already exists SetWindowText(_hwnd, _path); if (_path[0]) { if (SetCurrentDirectory(_path)) set_url(_path); //set_url(FmtString(TEXT("file://%s"), _path)); else _path[0] = TEXT('\0'); } }
void curl(const std::string& uri, const std::string& method = "GET", const std::string& param = "", const std::string& content = "") { set_url(m_url + uri + "?" + param); //cout << __LINE__ << ":" << uri << endl; #ifdef DEBUG curl_easy_setopt(m_curl, CURLOPT_HEADER, 1); #endif curl_easy_setopt(m_curl, CURLOPT_WRITEFUNCTION, request_callback); curl_easy_setopt(m_curl, CURLOPT_MAXREDIRS, 50L); curl_easy_setopt(m_curl, CURLOPT_TCP_KEEPALIVE, 1L); curl_easy_setopt(m_curl, CURLOPT_CUSTOMREQUEST, method.c_str()); //curl_easy_setopt(m_curl, CURLOPT_NOPROGRESS,0L); curl_easy_setopt(m_curl, CURLOPT_CLOSESOCKETFUNCTION, close_socket_callback); curl_easy_setopt(m_curl, CURLOPT_CLOSESOCKETDATA, this); curl_easy_setopt(m_curl, CURLOPT_POSTFIELDS, content.c_str()); curl_easy_setopt(m_curl, CURLOPT_POSTFIELDSIZE_LARGE, (curl_off_t)content.length()); on_request(); }
void PlaceModel::handle_text_changed (QString text) { qDebug () << "index " << index << " handle_text_changed " << text; //username_timer->stop(); places[index] = text; settings->setValue(settings_name, places[index]); // add this new place into the list associated with our current parent set_url (); /* // what is this doing? if (url2list_cache->contains(url)) { QList<QString> *item_list = url2list_cache->value(url); // yuck QListIterator<QString> i (*item_list); bool found = false; while (i.hasNext() && !found) { if (i.next() == text) { found = true; } } if (!found) { place_list->append(text); sort (0); } } */ emit value_changed (text); }
TITANIUM_PROPERTY_SETTER(WebView, url) { TITANIUM_ASSERT(argument.IsString()); set_url(static_cast<std::string>(argument)); return true; }
http_header::http_header(const char* url) { init(); if (url && *url) set_url(url); }