这篇教程C++ CONFIG_STRING函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中CONFIG_STRING函数的典型用法代码示例。如果您正苦于以下问题:C++ CONFIG_STRING函数的具体用法?C++ CONFIG_STRING怎么用?C++ CONFIG_STRING使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了CONFIG_STRING函数的29个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: gui_completion_nickncmpintgui_completion_nickncmp (const char *base_word, const char *nick, int max){ char *base_word2, *nick2; int case_sensitive, return_cmp; case_sensitive = CONFIG_BOOLEAN(config_completion_nick_case_sensitive); if (!CONFIG_STRING(config_completion_nick_ignore_chars) || !CONFIG_STRING(config_completion_nick_ignore_chars)[0] || !base_word[0] || !nick[0] || gui_completion_nick_has_ignored_chars (base_word)) { return (case_sensitive) ? strncmp (base_word, nick, max) : string_strncasecmp (base_word, nick, max); } base_word2 = gui_completion_nick_strdup_ignore_chars (base_word); nick2 = gui_completion_nick_strdup_ignore_chars (nick); return_cmp = (case_sensitive) ? strncmp (base_word2, nick2, utf8_strlen (base_word2)) : string_strncasecmp (base_word2, nick2, utf8_strlen (base_word2)); free (base_word2); free (nick2); return return_cmp;}
开发者ID:weechat,项目名称:weechat,代码行数:30,
示例2: get_http_varvoid Server::authorize(struct mg_connection *conn, struct http_message *hm) { Server::session *session; std::string user = get_http_var(hm, "user"); std::string password = get_http_var(hm, "password"); std::string host; mg_str *host_hdr = mg_get_http_header(hm, "Host"); if (host_hdr) { if (!CONFIG_STRING(m_config, "service.cert").empty()) { host += "https://"; } else { host += "http://"; } host += std::string(host_hdr->p, host_hdr->len); } if (check_password(user, password) && (session = new_session(user)) != NULL) { std::cout << "User authorized/n"; mg_printf(conn, "HTTP/1.1 302 Found/r/n" "Set-Cookie: session=%s; max-age=3600; http-only/r/n" // Session ID "Set-Cookie: user=%s/r/n" // Set user, needed by Javascript code "Set-Cookie: admin=%s/r/n" // Set user, needed by Javascript code "Set-Cookie: base_location=%s/r/n" // Set user, needed by Javascript code "Set-Cookie: original_url=/; max-age=0/r/n" // Delete original_url "Location: %s%sinstances/r/n/r/n", session->session_id, session->user, session->admin ? "1" : "0", CONFIG_STRING(m_config, "service.base_location").c_str(), host.c_str(), CONFIG_STRING(m_config, "service.base_location").c_str()); } else { // Authentication failure, redirect to login. redirect_to(conn, hm, "/login"); }}
开发者ID:lactide,项目名称:spectrum2,代码行数:32,
示例3: proxy_add_to_infolistintproxy_add_to_infolist (struct t_infolist *infolist, struct t_proxy *proxy){ struct t_infolist_item *ptr_item; if (!infolist || !proxy) return 0; ptr_item = infolist_new_item (infolist); if (!ptr_item) return 0; if (!infolist_new_var_string (ptr_item, "name", proxy->name)) return 0; if (!infolist_new_var_integer (ptr_item, "type", CONFIG_INTEGER(proxy->options[PROXY_OPTION_TYPE]))) return 0; if (!infolist_new_var_string (ptr_item, "type_string", proxy_type_string[CONFIG_INTEGER(proxy->options[PROXY_OPTION_TYPE])])) return 0; if (!infolist_new_var_integer (ptr_item, "ipv6", CONFIG_INTEGER(proxy->options[PROXY_OPTION_IPV6]))) return 0; if (!infolist_new_var_string (ptr_item, "address", CONFIG_STRING(proxy->options[PROXY_OPTION_ADDRESS]))) return 0; if (!infolist_new_var_integer (ptr_item, "port", CONFIG_INTEGER(proxy->options[PROXY_OPTION_PORT]))) return 0; if (!infolist_new_var_string (ptr_item, "username", CONFIG_STRING(proxy->options[PROXY_OPTION_USERNAME]))) return 0; if (!infolist_new_var_string (ptr_item, "password", CONFIG_STRING(proxy->options[PROXY_OPTION_PASSWORD]))) return 0; return 1;}
开发者ID:FauxFaux,项目名称:weechat_old,代码行数:31,
示例4: gui_line_get_prefix_for_displayvoidgui_line_get_prefix_for_display (struct t_gui_line *line, char **prefix, int *length, char **color, int *prefix_is_nick){ const char *tag_prefix_nick; if (CONFIG_STRING(config_look_prefix_same_nick) && CONFIG_STRING(config_look_prefix_same_nick)[0] && gui_line_prefix_is_same_nick_as_previous (line)) { /* same nick: return empty prefix or value from option */ if (strcmp (CONFIG_STRING(config_look_prefix_same_nick), " ") == 0) { /* return empty prefix */ if (prefix) *prefix = gui_chat_prefix_empty; if (length) *length = 0; if (color) *color = NULL; } else { /* return prefix from option "weechat.look.prefix_same_nick" */ if (prefix) *prefix = CONFIG_STRING(config_look_prefix_same_nick); if (length) *length = config_length_prefix_same_nick; if (color) { tag_prefix_nick = gui_line_search_tag_starting_with (line, "prefix_nick_"); *color = (tag_prefix_nick) ? (char *)(tag_prefix_nick + 12) : NULL; } } if (prefix_is_nick) *prefix_is_nick = 0; } else { /* not same nick: return prefix from line */ if (prefix) *prefix = line->data->prefix; if (length) *length = line->data->prefix_length; if (color) *color = NULL; if (prefix_is_nick) *prefix_is_nick = gui_line_search_tag_starting_with (line, "prefix_nick_") ? 1 : 0; }}
开发者ID:FauxFaux,项目名称:weechat_old,代码行数:52,
示例5: mbuf_resizevoid Server::event_handler(struct mg_connection *conn, int ev, void *p) { struct http_message *hm = (struct http_message *) p; if (ev == MG_EV_SSI_CALL) { mbuf_resize(&conn->send_mbuf, conn->send_mbuf.size * 2); std::string resp(conn->send_mbuf.buf, conn->send_mbuf.len); boost::replace_all(resp, "href=/"/", std::string("href=/"") + CONFIG_STRING(m_config, "service.base_location")); boost::replace_all(resp, "src=/"/", std::string("src=/"") + CONFIG_STRING(m_config, "service.base_location")); boost::replace_all(resp, "action=/"/", std::string("action=/"") + CONFIG_STRING(m_config, "service.base_location")); strcpy(conn->send_mbuf.buf, resp.c_str()); mbuf_trim(&conn->send_mbuf); return; } if (ev != MG_EV_HTTP_REQUEST) { return; } hm->uri.p += CONFIG_STRING(m_config, "service.base_location").size() - 1; hm->uri.len -= CONFIG_STRING(m_config, "service.base_location").size() - 1; if (!is_authorized(conn, hm)) { redirect_to(conn, hm, "/login"); } else if (mg_vcmp(&hm->uri, "/authorize") == 0) { authorize(conn, hm); } else if (mg_vcmp(&hm->uri, "/logout") == 0) { serve_logout(conn, hm);// } else if (mg_vcmp(&hm->uri, "/users") == 0) {// serve_users(conn, hm);// } else if (mg_vcmp(&hm->uri, "/users/add") == 0) {// serve_users_add(conn, hm);// } else if (mg_vcmp(&hm->uri, "/users/remove") == 0) {// serve_users_remove(conn, hm); } else if (has_prefix(&hm->uri, "/oauth2")) { serve_oauth2(conn, hm); } else if (has_prefix(&hm->uri, "/api/v1/")) { m_apiServer->handleRequest(this, get_session(hm), conn, hm); } else { if (hm->uri.p[hm->uri.len - 1] != '/') { std::string url(hm->uri.p, hm->uri.len); if (url.find(".") == std::string::npos) { url += "/"; redirect_to(conn, hm, url.c_str()); conn->flags |= MG_F_SEND_AND_CLOSE; return; } } mg_serve_http(conn, hm, s_http_server_opts); } conn->flags |= MG_F_SEND_AND_CLOSE;}
开发者ID:lactide,项目名称:spectrum2,代码行数:52,
示例6: CONFIG_STRINGDiscoInfoResponder::DiscoInfoResponder(Swift::IQRouter *router, Config *config) : Swift::GetResponder<DiscoInfo>(router) { m_config = config; m_config->onBackendConfigUpdated.connect(boost::bind(&DiscoInfoResponder::updateFeatures, this)); m_buddyInfo = NULL; m_transportInfo.addIdentity(DiscoInfo::Identity(CONFIG_STRING(m_config, "identity.name"), CONFIG_STRING(m_config, "identity.category"), CONFIG_STRING(m_config, "identity.type")));#if HAVE_SWIFTEN_3 crypto = boost::shared_ptr<CryptoProvider>(PlatformCryptoProvider::create());#endif updateFeatures();}
开发者ID:lactide,项目名称:spectrum2,代码行数:13,
示例7: gui_chat_hsignal_quote_line_cbintgui_chat_hsignal_quote_line_cb (void *data, const char *signal, struct t_hashtable *hashtable){ const char *time, *prefix, *message; int length_time, length_prefix, length_message, length; char *str; /* make C compiler happy */ (void) data; if (!gui_current_window->buffer->input) return WEECHAT_RC_OK; time = (strstr (signal, "time")) ? hashtable_get (hashtable, "_chat_line_time") : NULL; prefix = (strstr (signal, "prefix")) ? hashtable_get (hashtable, "_chat_line_prefix") : NULL; message = hashtable_get (hashtable, "_chat_line_message"); if (!message) return WEECHAT_RC_OK; length_time = (time) ? strlen (time) : 0; length_prefix = (prefix) ? strlen (prefix) : 0; length_message = strlen (message); length = length_time + 1 + length_prefix + 1 + strlen (CONFIG_STRING(config_look_prefix_suffix)) + 1 + length_message + 1 + 1; str = malloc (length); if (str) { snprintf (str, length, "%s%s%s%s%s%s%s ", (time) ? time : "", (time) ? " " : "", (prefix) ? prefix : "", (prefix) ? " " : "", (time || prefix) ? CONFIG_STRING(config_look_prefix_suffix) : "", ((time || prefix) && CONFIG_STRING(config_look_prefix_suffix) && CONFIG_STRING(config_look_prefix_suffix)[0]) ? " " : "", message); gui_input_insert_string (gui_current_window->buffer, str, -1); gui_input_text_changed_modifier_and_signal (gui_current_window->buffer, 1, /* save undo */ 1); /* stop completion */ free (str); } return WEECHAT_RC_OK;}
开发者ID:FauxFaux,项目名称:weechat_old,代码行数:51,
示例8: gui_chat_prefix_buildvoidgui_chat_prefix_build (){ const char *ptr_prefix; char prefix[512], *pos_color; int prefix_color[GUI_CHAT_NUM_PREFIXES] = { GUI_COLOR_CHAT_PREFIX_ERROR, GUI_COLOR_CHAT_PREFIX_NETWORK, GUI_COLOR_CHAT_PREFIX_ACTION, GUI_COLOR_CHAT_PREFIX_JOIN, GUI_COLOR_CHAT_PREFIX_QUIT }; int i; for (i = 0; i < GUI_CHAT_NUM_PREFIXES; i++) { if (gui_chat_prefix[i]) { free (gui_chat_prefix[i]); gui_chat_prefix[i] = NULL; } ptr_prefix = CONFIG_STRING(config_look_prefix[i]); pos_color = strstr (ptr_prefix, "${"); snprintf(prefix, sizeof (prefix), "%s%s/t", (ptr_prefix[0] && (!pos_color || (pos_color > ptr_prefix))) ? GUI_COLOR(prefix_color[i]) : "", ptr_prefix); if (pos_color) gui_chat_prefix[i] = eval_expression (prefix, NULL, NULL, NULL); else gui_chat_prefix[i] = strdup (prefix); }}
开发者ID:Evalle,项目名称:weechat,代码行数:32,
示例9: gui_completion_list_addvoidgui_completion_list_add (struct t_gui_completion *completion, const char *word, int nick_completion, const char *where){ char buffer[512]; if (!word || !word[0]) return; if (!completion->base_word || !completion->base_word[0] || (nick_completion && (gui_completion_nickncmp (completion->base_word, word, utf8_strlen (completion->base_word)) == 0)) || (!nick_completion && (string_strncasecmp (completion->base_word, word, utf8_strlen (completion->base_word)) == 0))) { if (nick_completion && (completion->base_word_pos == 0)) { snprintf (buffer, sizeof (buffer), "%s%s", word, CONFIG_STRING(config_completion_nick_completer)); weelist_add (completion->completion_list, buffer, where, (nick_completion) ? (void *)1 : (void *)0); } else { weelist_add (completion->completion_list, word, where, (nick_completion) ? (void *)1 : (void *)0); } }}
开发者ID:FauxFaux,项目名称:weechat_old,代码行数:29,
示例10: plugin_config_create_optionintplugin_config_create_option (const void *pointer, void *data, struct t_config_file *config_file, struct t_config_section *section, const char *option_name, const char *value){ struct t_config_option *ptr_option_desc, *ptr_option; /* make C compiler happy */ (void) pointer; (void) data; ptr_option_desc = config_file_search_option (config_file, plugin_config_section_desc, option_name); ptr_option = config_file_new_option ( config_file, section, option_name, "string", (ptr_option_desc) ? CONFIG_STRING(ptr_option_desc) : NULL, NULL, 0, 0, "", value, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); return (ptr_option) ? WEECHAT_CONFIG_OPTION_SET_OK_SAME_VALUE : WEECHAT_CONFIG_OPTION_SET_ERROR;}
开发者ID:Evalle,项目名称:weechat,代码行数:26,
示例11: CONFIG_VECTORvoid UserRegistry::isValidUserPassword(const Swift::JID& user, Swift::ServerFromClientSession *session, const Swift::SafeByteArray& password) { std::vector<std::string> const &x = CONFIG_VECTOR(config,"service.admin_jid"); if (std::find(x.begin(), x.end(), user.toBare().toString()) != x.end()) { if (Swift::safeByteArrayToString(password) == CONFIG_STRING(config, "service.admin_password")) { session->handlePasswordValid(); } else { session->handlePasswordInvalid(); } return; } std::string key = user.toBare().toString(); // Users try to connect twice if (users.find(key) != users.end()) { // Kill the first session LOG4CXX_INFO(logger, key << ": Removing previous session and making this one active"); Swift::ServerFromClientSession *tmp = users[key].session; users[key].session = session; tmp->handlePasswordInvalid(); } LOG4CXX_INFO(logger, key << ": Connecting this user to find if password is valid"); users[key].password = Swift::safeByteArrayToString(password); users[key].session = session; onConnectUser(user); return;}
开发者ID:Ghabry,项目名称:libtransport,代码行数:30,
示例12: QTcpSocketIRCNetworkPlugin::IRCNetworkPlugin(Config *config, Swift::QtEventLoop *loop, const std::string &host, int port) { m_config = config; m_currentServer = 0; m_firstPing = true; m_socket = new QTcpSocket(); m_socket->connectToHost(FROM_UTF8(host), port); connect(m_socket, SIGNAL(readyRead()), this, SLOT(readData())); std::string server = CONFIG_STRING_DEFAULTED(m_config, "service.irc_server", ""); if (!server.empty()) { m_servers.push_back(server); } else { std::list<std::string> list; list = CONFIG_LIST_DEFAULTED(m_config, "service.irc_server", list); m_servers.insert(m_servers.begin(), list.begin(), list.end()); } if (CONFIG_HAS_KEY(m_config, "service.irc_identify")) { m_identify = CONFIG_STRING(m_config, "service.irc_identify"); } else { m_identify = "NickServ identify $name $password"; }}
开发者ID:stv0g,项目名称:spectrum2,代码行数:26,
示例13: gui_completion_nick_strdup_ignore_charschar *gui_completion_nick_strdup_ignore_chars (const char *string){ int char_size; char *result, *pos, utf_char[16]; result = malloc (strlen (string) + 1); pos = result; while (string[0]) { char_size = utf8_char_size (string); memcpy (utf_char, string, char_size); utf_char[char_size] = '/0'; if (!strstr (CONFIG_STRING(config_completion_nick_ignore_chars), utf_char)) { memcpy (pos, utf_char, char_size); pos += char_size; } string += char_size; } pos[0] = '/0'; return result;}
开发者ID:weechat,项目名称:weechat,代码行数:26,
示例14: network_pass_socks4proxyintnetwork_pass_socks4proxy (struct t_proxy *proxy, int sock, const char *address, int port){ /* socks4 protocol is explained here: http://en.wikipedia.org/wiki/SOCKS */ struct t_network_socks4 socks4; unsigned char buffer[24]; char ip_addr[NI_MAXHOST]; int length; socks4.version = 4; socks4.method = 1; socks4.port = htons (port); network_resolve (address, ip_addr, NULL); socks4.address = inet_addr (ip_addr); strncpy (socks4.user, CONFIG_STRING(proxy->options[PROXY_OPTION_USERNAME]), sizeof (socks4.user) - 1); length = 8 + strlen (socks4.user) + 1; if (network_send_with_retry (sock, (char *) &socks4, length, 0) != length) return 0; if (network_recv_with_retry (sock, buffer, sizeof (buffer), 0) < 2) return 0; /* connection ok */ if ((buffer[0] == 0) && (buffer[1] == 90)) return 1; /* connection failed */ return 0;}
开发者ID:jameslord,项目名称:weechat,代码行数:33,
示例15: CONFIG_STRINGDiscoInfoResponder::DiscoInfoResponder(Swift::IQRouter *router, Config *config) : Swift::GetResponder<DiscoInfo>(router) { m_config = config; m_config->onBackendConfigUpdated.connect(boost::bind(&DiscoInfoResponder::updateBuddyFeatures, this)); m_buddyInfo = NULL; m_transportInfo.addIdentity(DiscoInfo::Identity(CONFIG_STRING(m_config, "identity.name"), CONFIG_STRING(m_config, "identity.category"), CONFIG_STRING(m_config, "identity.type"))); std::list<std::string> features; features.push_back("jabber:iq:register"); features.push_back("jabber:iq:gateway"); features.push_back("jabber:iq:private"); features.push_back("http://jabber.org/protocol/disco#info"); features.push_back("http://jabber.org/protocol/commands"); setTransportFeatures(features); updateBuddyFeatures();}
开发者ID:Serethi,项目名称:libtransport,代码行数:18,
示例16: mg_get_http_headervoid Server::redirect_to(struct mg_connection *conn, struct http_message *hm, const char *where) { std::string host; mg_str *host_hdr = mg_get_http_header(hm, "Host"); if (host_hdr) { if (!CONFIG_STRING(m_config, "service.cert").empty()) { host += "https://"; } else { host += "http://"; } host += std::string(host_hdr->p, host_hdr->len); } where = where + 1; mg_printf(conn, "HTTP/1.1 302 Found/r/n" "Set-Cookie: original_url=//r/n" "Location: %s%s%s/r/n/r/n", host.c_str(), CONFIG_STRING(m_config, "service.base_location").c_str(), where);}
开发者ID:lactide,项目名称:spectrum2,代码行数:19,
示例17: LOG4CXX_INFOvoid Component::start() { if (m_component && !m_component->isAvailable()) { LOG4CXX_INFO(logger, "Connecting XMPP server " << CONFIG_STRING(m_config, "service.server") << " port " << CONFIG_INT(m_config, "service.port")); m_reconnectCount++; m_component->connect(CONFIG_STRING(m_config, "service.server"), CONFIG_INT(m_config, "service.port")); m_reconnectTimer->stop(); } else if (m_server) { LOG4CXX_INFO(logger, "Starting component in server mode on port " << CONFIG_INT(m_config, "service.port")); m_server->start(); //Type casting to BoostConnectionServer since onStopped signal is not defined in ConnectionServer //Ideally, onStopped must be defined in ConnectionServer boost::dynamic_pointer_cast<Swift::BoostConnectionServer>(m_server->getConnectionServer())->onStopped.connect(boost::bind(&Component::handleServerStopped, this, _1)); // We're connected right here, because we're in server mode... handleConnected(); }}
开发者ID:sarangbh,项目名称:libtransport,代码行数:19,
示例18: weeurl_set_proxyvoidweeurl_set_proxy (CURL *curl, struct t_proxy *proxy){ if (!proxy) return; /* set proxy type */ switch (CONFIG_INTEGER(proxy->options[PROXY_OPTION_TYPE])) { case PROXY_TYPE_HTTP: curl_easy_setopt (curl, CURLOPT_PROXYTYPE, CURLPROXY_HTTP); break; case PROXY_TYPE_SOCKS4:#if LIBCURL_VERSION_NUM < 0x070A00 /* 7.10.0 */ /* proxy socks4 not supported in Curl < 7.10 */ return;#endif /* LIBCURL_VERSION_NUM < 0x070A00 */ curl_easy_setopt (curl, CURLOPT_PROXYTYPE, CURLPROXY_SOCKS4); break; case PROXY_TYPE_SOCKS5:#if LIBCURL_VERSION_NUM < 0x070A00 /* 7.10.0 */ /* proxy socks5 not supported in Curl < 7.10 */ return;#endif /* LIBCURL_VERSION_NUM < 0x070A00 */#if LIBCURL_VERSION_NUM >= 0x071200 /* 7.18.0 */ curl_easy_setopt (curl, CURLOPT_PROXYTYPE, CURLPROXY_SOCKS5_HOSTNAME);#else curl_easy_setopt (curl, CURLOPT_PROXYTYPE, CURLPROXY_SOCKS5);#endif /* LIBCURL_VERSION_NUM >= 0x071200 */ break; } /* set proxy address */ curl_easy_setopt (curl, CURLOPT_PROXY, CONFIG_STRING(proxy->options[PROXY_OPTION_ADDRESS])); /* set proxy port */ curl_easy_setopt (curl, CURLOPT_PROXYPORT, CONFIG_INTEGER(proxy->options[PROXY_OPTION_PORT])); /* set username/password */#if LIBCURL_VERSION_NUM >= 0x071301 /* 7.19.1 */ if (CONFIG_STRING(proxy->options[PROXY_OPTION_USERNAME]) && CONFIG_STRING(proxy->options[PROXY_OPTION_USERNAME])[0]) { curl_easy_setopt (curl, CURLOPT_PROXYUSERNAME, CONFIG_STRING(proxy->options[PROXY_OPTION_USERNAME])); } if (CONFIG_STRING(proxy->options[PROXY_OPTION_PASSWORD]) && CONFIG_STRING(proxy->options[PROXY_OPTION_PASSWORD])[0]) { curl_easy_setopt (curl, CURLOPT_PROXYPASSWORD, CONFIG_STRING(proxy->options[PROXY_OPTION_PASSWORD])); }#endif /* LIBCURL_VERSION_NUM >= 0x071301 */}
开发者ID:aadiarbakerli,项目名称:weechat,代码行数:57,
示例19: network_pass_httpproxyintnetwork_pass_httpproxy (struct t_proxy *proxy, int sock, const char *address, int port){ char buffer[256], authbuf[128], authbuf_base64[512]; int length; if (CONFIG_STRING(proxy->options[PROXY_OPTION_USERNAME]) && CONFIG_STRING(proxy->options[PROXY_OPTION_USERNAME])[0]) { /* authentification */ snprintf (authbuf, sizeof (authbuf), "%s:%s", CONFIG_STRING(proxy->options[PROXY_OPTION_USERNAME]), (CONFIG_STRING(proxy->options[PROXY_OPTION_PASSWORD])) ? CONFIG_STRING(proxy->options[PROXY_OPTION_PASSWORD]) : ""); string_encode_base64 (authbuf, strlen (authbuf), authbuf_base64); length = snprintf (buffer, sizeof (buffer), "CONNECT %s:%d HTTP/1.0/r/nProxy-Authorization: " "Basic %s/r/n/r/n", address, port, authbuf_base64); } else { /* no authentification */ length = snprintf (buffer, sizeof (buffer), "CONNECT %s:%d HTTP/1.0/r/n/r/n", address, port); } if (network_send_with_retry (sock, buffer, length, 0) != length) return 0; /* success result must be like: "HTTP/1.0 200 OK" */ if (network_recv_with_retry (sock, buffer, sizeof (buffer), 0) < 12) return 0; if (memcmp (buffer, "HTTP/", 5) || memcmp (buffer + 9, "200", 3)) return 0; /* connection ok */ return 1;}
开发者ID:jameslord,项目名称:weechat,代码行数:41,
示例20: gui_chat_prefix_buildvoidgui_chat_prefix_build (){ char prefix[128]; int i; for (i = 0; i < GUI_CHAT_NUM_PREFIXES; i++) { if (gui_chat_prefix[i]) { free (gui_chat_prefix[i]); gui_chat_prefix[i] = NULL; } } snprintf (prefix, sizeof (prefix), "%s%s/t", GUI_COLOR(GUI_COLOR_CHAT_PREFIX_ERROR), CONFIG_STRING(config_look_prefix[GUI_CHAT_PREFIX_ERROR])); gui_chat_prefix[GUI_CHAT_PREFIX_ERROR] = strdup (prefix); snprintf (prefix, sizeof (prefix), "%s%s/t", GUI_COLOR(GUI_COLOR_CHAT_PREFIX_NETWORK), CONFIG_STRING(config_look_prefix[GUI_CHAT_PREFIX_NETWORK])); gui_chat_prefix[GUI_CHAT_PREFIX_NETWORK] = strdup (prefix); snprintf (prefix, sizeof (prefix), "%s%s/t", GUI_COLOR(GUI_COLOR_CHAT_PREFIX_ACTION), CONFIG_STRING(config_look_prefix[GUI_CHAT_PREFIX_ACTION])); gui_chat_prefix[GUI_CHAT_PREFIX_ACTION] = strdup (prefix); snprintf (prefix, sizeof (prefix), "%s%s/t", GUI_COLOR(GUI_COLOR_CHAT_PREFIX_JOIN), CONFIG_STRING(config_look_prefix[GUI_CHAT_PREFIX_JOIN])); gui_chat_prefix[GUI_CHAT_PREFIX_JOIN] = strdup (prefix); snprintf (prefix, sizeof (prefix), "%s%s/t", GUI_COLOR(GUI_COLOR_CHAT_PREFIX_QUIT), CONFIG_STRING(config_look_prefix[GUI_CHAT_PREFIX_QUIT])); gui_chat_prefix[GUI_CHAT_PREFIX_QUIT] = strdup (prefix);}
开发者ID:matsuu,项目名称:weechat,代码行数:40,
示例21: LOG4CXX_INFObool SQLite3Backend::connect() { LOG4CXX_INFO(logger, "Opening database " << CONFIG_STRING(m_config, "database.database")); if (sqlite3_open(CONFIG_STRING(m_config, "database.database").c_str(), &m_db)) { sqlite3_close(m_db); return false; } sqlite3_busy_timeout(m_db, 1500); if (createDatabase() == false) return false; PREP_STMT(m_setUser, "INSERT OR REPLACE INTO " + m_prefix + "users (jid, uin, password, language, encoding, last_login, vip) VALUES (?, ?, ?, ?, ?, DATETIME('NOW'), ?)"); PREP_STMT(m_getUser, "SELECT id, jid, uin, password, encoding, language, vip FROM " + m_prefix + "users WHERE jid=?"); PREP_STMT(m_removeUser, "DELETE FROM " + m_prefix + "users WHERE id=?"); PREP_STMT(m_removeUserBuddies, "DELETE FROM " + m_prefix + "buddies WHERE user_id=?"); PREP_STMT(m_removeUserSettings, "DELETE FROM " + m_prefix + "users_settings WHERE user_id=?"); PREP_STMT(m_removeUserBuddiesSettings, "DELETE FROM " + m_prefix + "buddies_settings WHERE user_id=?"); PREP_STMT(m_removeBuddy, "DELETE FROM " + m_prefix + "buddies WHERE id=?"); PREP_STMT(m_removeBuddySettings, "DELETE FROM " + m_prefix + "buddies_settings WHERE buddy_id=?"); PREP_STMT(m_addBuddy, "INSERT INTO " + m_prefix + "buddies (user_id, uin, subscription, groups, nickname, flags) VALUES (?, ?, ?, ?, ?, ?)"); PREP_STMT(m_updateBuddy, "UPDATE " + m_prefix + "buddies SET groups=?, nickname=?, flags=?, subscription=? WHERE user_id=? AND uin=?"); PREP_STMT(m_getBuddies, "SELECT id, uin, subscription, nickname, groups, flags FROM " + m_prefix + "buddies WHERE user_id=? ORDER BY id ASC"); PREP_STMT(m_getBuddiesSettings, "SELECT buddy_id, type, var, value FROM " + m_prefix + "buddies_settings WHERE user_id=? ORDER BY buddy_id ASC"); PREP_STMT(m_updateBuddySetting, "INSERT OR REPLACE INTO " + m_prefix + "buddies_settings (user_id, buddy_id, var, type, value) VALUES (?, ?, ?, ?, ?)"); PREP_STMT(m_getBuddySetting, "SELECT type, value FROM " + m_prefix + "buddies_settings WHERE user_id=? AND buddy_id=? AND var=?"); PREP_STMT(m_getUserSetting, "SELECT type, value FROM " + m_prefix + "users_settings WHERE user_id=? AND var=?"); PREP_STMT(m_setUserSetting, "INSERT INTO " + m_prefix + "users_settings (user_id, var, type, value) VALUES (?,?,?,?)"); PREP_STMT(m_updateUserSetting, "UPDATE " + m_prefix + "users_settings SET value=? WHERE user_id=? AND var=?"); PREP_STMT(m_setUserOnline, "UPDATE " + m_prefix + "users SET online=?, last_login=DATETIME('NOW') WHERE id=?"); PREP_STMT(m_getOnlineUsers, "SELECT jid FROM " + m_prefix + "users WHERE online=1"); PREP_STMT(m_getAllUsers, "SELECT jid FROM " + m_prefix + "users"); return true;}
开发者ID:mesu-im,项目名称:libtransport,代码行数:40,
示例22: gui_completion_list_addvoidgui_completion_list_add (struct t_gui_completion *completion, const char *word, int nick_completion, const char *where){ struct t_gui_completion_word *completion_word; char buffer[512]; int index; if (!word || !word[0]) return; if (!completion->base_word || !completion->base_word[0] || (nick_completion && (gui_completion_nickncmp (completion->base_word, word, utf8_strlen (completion->base_word)) == 0)) || (!nick_completion && (string_strncasecmp (completion->base_word, word, utf8_strlen (completion->base_word)) == 0))) { completion_word = malloc (sizeof (*completion_word)); if (completion_word) { completion_word->nick_completion = nick_completion; completion_word->count = 0; index = -1; if (strcmp (where, WEECHAT_LIST_POS_BEGINNING) == 0) { completion->list->sorted = 0; index = 0; } else if (strcmp (where, WEECHAT_LIST_POS_END) == 0) { completion->list->sorted = 0; index = -1; } if (nick_completion && (completion->base_word_pos == 0)) { snprintf (buffer, sizeof (buffer), "%s%s", word, CONFIG_STRING(config_completion_nick_completer)); completion_word->word = strdup (buffer); arraylist_insert (completion->list, index, completion_word); completion->add_space = 0; } else { completion_word->word = strdup (word); arraylist_insert (completion->list, index, completion_word); } } }}
开发者ID:weechat,项目名称:weechat,代码行数:52,
示例23: LOG4CXX_INFOvoid XMPPFrontend::connectToServer() { if (m_component && !m_component->isAvailable()) { LOG4CXX_INFO(logger, "Connecting XMPP server " << CONFIG_STRING(m_config, "service.server") << " port " << CONFIG_INT(m_config, "service.port")); if (CONFIG_INT(m_config, "service.port") == 5222) { LOG4CXX_WARN(logger, "Port 5222 is usually used for client connections, not for component connections! Are you sure you are using right port?"); } m_component->connect(CONFIG_STRING(m_config, "service.server"), CONFIG_INT(m_config, "service.port")); } else if (m_server) { LOG4CXX_INFO(logger, "Starting XMPPFrontend in server mode on port " << CONFIG_INT(m_config, "service.port")); m_server->start(); //Type casting to BoostConnectionServer since onStopped signal is not defined in ConnectionServer //Ideally, onStopped must be defined in ConnectionServer if (boost::dynamic_pointer_cast<Swift::BoostConnectionServer>(m_server->getConnectionServer())) { boost::dynamic_pointer_cast<Swift::BoostConnectionServer>(m_server->getConnectionServer())->onStopped.connect(boost::bind(&XMPPFrontend::handleServerStopped, this, _1)); } // We're connected right here, because we're in server mode... handleConnected(); }}
开发者ID:mdabbagh88,项目名称:spectrum2,代码行数:22,
示例24: CONFIG_STRINGSingleIRCNetworkPlugin::SingleIRCNetworkPlugin(Config *config, Swift::QtEventLoop *loop, const std::string &host, int port) { this->config = config; if (CONFIG_HAS_KEY(config, "service.irc_server")) { m_server = CONFIG_STRING(config, "service.irc_server"); } else { LOG4CXX_ERROR(logger, "No [service] irc_server defined, exiting..."); exit(-1); } m_socket = new QTcpSocket(); m_socket->connectToHost(FROM_UTF8(host), port); connect(m_socket, SIGNAL(readyRead()), this, SLOT(readData())); if (CONFIG_HAS_KEY(config, "service.irc_identify")) { m_identify = CONFIG_STRING(config, "service.irc_identify"); } else { m_identify = "NickServ identify $name $password"; } LOG4CXX_INFO(logger, "SingleIRCNetworkPlugin for server " << m_server << " initialized.");}
开发者ID:arnt,项目名称:libtransport,代码行数:22,
示例25: proxy_print_logvoidproxy_print_log (){ struct t_proxy *ptr_proxy; for (ptr_proxy = weechat_proxies; ptr_proxy; ptr_proxy = ptr_proxy->next_proxy) { log_printf (""); log_printf ("[proxy (addr:0x%lx)]", ptr_proxy); log_printf (" name . . . . . . . . . : '%s'", ptr_proxy->name); log_printf (" type . . . . . . . . . : %d (%s)", CONFIG_INTEGER(ptr_proxy->options[PROXY_OPTION_TYPE]), proxy_type_string[CONFIG_INTEGER(ptr_proxy->options[PROXY_OPTION_TYPE])]); log_printf (" ipv6 . . . . . . . . . : %d", CONFIG_INTEGER(ptr_proxy->options[PROXY_OPTION_IPV6])); log_printf (" address. . . . . . . . : '%s'", CONFIG_STRING(ptr_proxy->options[PROXY_OPTION_ADDRESS])); log_printf (" port . . . . . . . . . : %d", CONFIG_INTEGER(ptr_proxy->options[PROXY_OPTION_PORT])); log_printf (" username . . . . . . . : '%s'", CONFIG_STRING(ptr_proxy->options[PROXY_OPTION_USERNAME])); log_printf (" password . . . . . . . : '%s'", CONFIG_STRING(ptr_proxy->options[PROXY_OPTION_PASSWORD])); log_printf (" prev_proxy . . . . . . : 0x%lx", ptr_proxy->prev_proxy); log_printf (" next_proxy . . . . . . : 0x%lx", ptr_proxy->next_proxy); }}
开发者ID:FauxFaux,项目名称:weechat_old,代码行数:23,
示例26: gui_completion_nickncmpintgui_completion_nickncmp (const char *base_word, const char *nick, int max){ char *base_word2, *nick2; int return_cmp; if (!CONFIG_STRING(config_completion_nick_ignore_chars) || !CONFIG_STRING(config_completion_nick_ignore_chars)[0] || !base_word || !nick || !base_word[0] || !nick[0] || gui_completion_nick_has_ignored_chars (base_word)) return string_strncasecmp (base_word, nick, max); base_word2 = gui_completion_nick_strdup_ignore_chars (base_word); nick2 = gui_completion_nick_strdup_ignore_chars (nick); return_cmp = string_strncasecmp (base_word2, nick2, utf8_strlen (base_word2)); free (base_word2); free (nick2); return return_cmp;}
开发者ID:Evalle,项目名称:weechat,代码行数:23,
示例27: gui_chat_get_time_lengthintgui_chat_get_time_length (){ time_t date; char *text_time; int length; if (!CONFIG_STRING(config_look_buffer_time_format) || !CONFIG_STRING(config_look_buffer_time_format)[0]) return 0; length = 0; date = time (NULL); text_time = gui_chat_get_time_string (date); if (text_time) { length = gui_chat_strlen_screen (text_time); free (text_time); } return length;}
开发者ID:Evalle,项目名称:weechat,代码行数:23,
示例28: gui_input_scroll_unreadvoidgui_input_scroll_unread (){ if (gui_current_window->buffer->text_search == GUI_TEXT_SEARCH_DISABLED) { if (CONFIG_STRING(config_look_read_marker) && CONFIG_STRING(config_look_read_marker)[0] && (gui_current_window->buffer->type == GUI_BUFFER_TYPE_FORMATTED) && (gui_current_window->buffer->lines->first_line_not_read || (gui_current_window->buffer->lines->last_read_line && gui_current_window->buffer->lines->last_read_line != gui_current_window->buffer->lines->last_line))) { if (gui_current_window->buffer->lines->first_line_not_read) gui_current_window->start_line = gui_current_window->buffer->lines->first_line; else gui_current_window->start_line = gui_current_window->buffer->lines->last_read_line->next_line; gui_current_window->start_line_pos = 0; gui_current_window->first_line_displayed = (gui_current_window->start_line == gui_line_get_first_displayed (gui_current_window->buffer)); gui_buffer_ask_chat_refresh (gui_current_window->buffer, 2); } }}
开发者ID:matsuu,项目名称:weechat,代码行数:23,
示例29: setBuddyFeaturesvoid DiscoInfoResponder::setBuddyFeatures(std::list<std::string> &f) { delete m_buddyInfo; m_buddyInfo = new Swift::DiscoInfo; m_buddyInfo->addIdentity(DiscoInfo::Identity(CONFIG_STRING(m_config, "identity.name"), "client", "pc")); for (std::list<std::string>::iterator it = f.begin(); it != f.end(); it++) { if (!m_buddyInfo->hasFeature(*it)) { m_buddyInfo->addFeature(*it); } } CapsInfoGenerator caps("spectrum"); m_capsInfo = caps.generateCapsInfo(*m_buddyInfo); onBuddyCapsInfoChanged(m_capsInfo);}
开发者ID:Serethi,项目名称:libtransport,代码行数:15,
注:本文中的CONFIG_STRING函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ CONPRINTF函数代码示例 C++ CONFIG函数代码示例 |