本文整理汇总了C++中purple_strequal函数的典型用法代码示例。如果您正苦于以下问题:C++ purple_strequal函数的具体用法?C++ purple_strequal怎么用?C++ purple_strequal使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了purple_strequal函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: purple_xmlnode_remove_attrib_with_namespace
void
purple_xmlnode_remove_attrib_with_namespace(PurpleXmlNode *node, const char *attr, const char *xmlns)
{
PurpleXmlNode *attr_node, *sibling = NULL;
g_return_if_fail(node != NULL);
g_return_if_fail(attr != NULL);
for(attr_node = node->child; attr_node; attr_node = attr_node->next)
{
if(attr_node->type == PURPLE_XMLNODE_TYPE_ATTRIB &&
purple_strequal(attr, attr_node->name) &&
purple_strequal(xmlns, attr_node->xmlns))
{
if(sibling == NULL) {
node->child = attr_node->next;
} else {
sibling->next = attr_node->next;
}
if (node->lastchild == attr_node) {
node->lastchild = sibling;
}
purple_xmlnode_free(attr_node);
return;
}
sibling = attr_node;
}
}
开发者ID:N8Fear,项目名称:purple-facebook,代码行数:28,代码来源:xmlnode.c
示例2: purple_xmlnode_get_child_with_namespace
PurpleXmlNode *
purple_xmlnode_get_child_with_namespace(const PurpleXmlNode *parent, const char *name, const char *ns)
{
PurpleXmlNode *x, *ret = NULL;
char **names;
char *parent_name, *child_name;
g_return_val_if_fail(parent != NULL, NULL);
g_return_val_if_fail(name != NULL, NULL);
names = g_strsplit(name, "/", 2);
parent_name = names[0];
child_name = names[1];
for(x = parent->child; x; x = x->next) {
/* XXX: Is it correct to ignore the namespace for the match if none was specified? */
const char *xmlns = NULL;
if(ns)
xmlns = purple_xmlnode_get_namespace(x);
if(x->type == PURPLE_XMLNODE_TYPE_TAG && purple_strequal(parent_name, x->name)
&& purple_strequal(ns, xmlns)) {
ret = x;
break;
}
}
if(child_name && ret)
ret = purple_xmlnode_get_child(ret, child_name);
g_strfreev(names);
return ret;
}
开发者ID:N8Fear,项目名称:purple-facebook,代码行数:33,代码来源:xmlnode.c
示例3: bonjour_si_xfer_find
static PurpleXfer*
bonjour_si_xfer_find(BonjourData *bd, const char *sid, const char *from)
{
GSList *xfers;
PurpleXfer *xfer;
XepXfer *xf;
if(!sid || !from || !bd)
return NULL;
purple_debug_info("bonjour", "Look for sid=%s from=%s xferlists.\n",
sid, from);
for(xfers = bd->xfer_lists; xfers; xfers = xfers->next) {
xfer = xfers->data;
if(xfer == NULL)
break;
xf = xfer->data;
if(xf == NULL)
break;
if(purple_strequal(xf->sid, sid) &&
purple_strequal(xfer->who, from))
return xfer;
}
purple_debug_info("bonjour", "Look for xfer list fail\n");
return NULL;
}
开发者ID:dylex,项目名称:pidgin,代码行数:29,代码来源:bonjour_ft.c
示例4: does_reply_from_match_request_to
/**
* Verify that the 'from' attribute of an IQ reply is a valid match for
* a given IQ request. The expected behavior is outlined in section
* 8.1.2.1 of the XMPP CORE spec (RFC 6120). We consider the reply to
* be a valid match if any of the following is true:
* - Request 'to' matches reply 'from' (including the case where
* neither are set).
* - Request 'to' was my JID (bare or full) and reply 'from' is empty.
* - Request 'to' was empty and reply 'from' is my JID. The spec says
* we should only allow bare JID, but we also allow full JID for
* compatibility with some servers.
* - Request 'to' was empty and reply 'from' is server JID. Not allowed by
* any spec, but for compatibility with some servers.
*
* These rules should allow valid IQ replies while preventing spoofed
* ones.
*
* For more discussion see the "Spoofing of iq ids and misbehaving
* servers" email thread from January 2014 on the jdev and security
* mailing lists. Also see https://developer.pidgin.im/ticket/15879
*
* @return TRUE if this reply is valid for the given request.
*/
static gboolean does_reply_from_match_request_to(JabberStream *js, JabberID *to, JabberID *from)
{
if (jabber_id_equal(to, from)) {
/* Request 'to' matches reply 'from' */
return TRUE;
}
if (!from && purple_strequal(to->node, js->user->node)
&& purple_strequal(to->domain, js->user->domain)) {
/* Request 'to' was my JID (bare or full) and reply 'from' is empty */
return TRUE;
}
if (!to && purple_strequal(from->domain, js->user->domain)) {
/* Request 'to' is empty and reply 'from' domain matches our domain */
if (!from->node && !from->resource) {
/* Reply 'from' is server bare JID */
return TRUE;
}
if (purple_strequal(from->node, js->user->node)
&& (!from->resource || purple_strequal(from->resource, js->user->resource))) {
/* Reply 'from' is my full or bare JID */
return TRUE;
}
}
return FALSE;
}
开发者ID:ArmoredPidgin,项目名称:pidgin-hardened,代码行数:53,代码来源:iq.c
示例5: pb_process_frame
static void
pb_process_frame(PushBulletAccount *pba, const gchar *frame)
{
JsonParser *parser = json_parser_new();
JsonNode *root;
purple_debug_info("pushbullet", "got frame data: %s\n", frame);
if (!json_parser_load_from_data(parser, frame, -1, NULL))
{
purple_debug_error("pushbullet", "Error parsing response: %s\n", frame);
return;
}
root = json_parser_get_root(parser);
if (root != NULL) {
JsonObject *message = json_node_get_object(root);
const gchar *type = json_object_get_string_member(message, "type");
if (purple_strequal(type, "tickle")) {
pb_get_everything_since(pba, purple_account_get_int(pba->account, "last_message_timestamp", 0));
} else if (purple_strequal(type, "push")) {
JsonObject *push = json_object_get_object_member(message, "push");
//{"type":"push","targets":["stream","android","ios"],"push":{"guid":"purple6e94d282","type":"messaging_extension_reply","package_name":"com.pushbullet.android","target_device_iden":"uffvytgsjAoIRwhIL6","conversation_iden":"+6421478252","message":"test2"}}
//{"type":"push","targets":["stream"],"push":{"type":"sms_changed"}}
type = json_object_get_string_member(push, "type");
if (purple_strequal(type, "sms_changed")) {
pb_get_phone_threads(pba, NULL);
}
}
}
g_object_unref(parser);
}
开发者ID:EionRobb,项目名称:pidgin-pushbullet,代码行数:34,代码来源:libpushbullet.c
示例6: purple_find_prpl
PurplePlugin *
purple_find_prpl(const char *id)
{
GList *l;
PurplePlugin *plugin;
g_return_val_if_fail(id != NULL, NULL);
/* libpurple3 compatibility.
* prpl-xmpp isn't used yet (it's prpl-jabber),
* but may be used in the future.
*/
if (purple_strequal(id, "prpl-xmpp") ||
purple_strequal(id, "prpl-gtalk"))
{
id = "prpl-jabber";
}
for (l = purple_plugins_get_protocols(); l != NULL; l = l->next) {
plugin = (PurplePlugin *)l->data;
if (purple_strequal(plugin->info->id, id))
return plugin;
}
return NULL;
}
开发者ID:CkNoSFeRaTU,项目名称:pidgin,代码行数:27,代码来源:prpl.c
示例7: google_session_handle_initiate
static gboolean
google_session_handle_initiate(JabberStream *js, GoogleSession *session, xmlnode *sess, const char *iq_id)
{
const gchar *xmlns;
GoogleAVSessionData *session_data =
(GoogleAVSessionData *) session->session_data;
if (session->state != UNINIT) {
purple_debug_error("jabber", "Received initiate for active session.\n");
return FALSE;
}
session->description = xmlnode_copy(xmlnode_get_child(sess, "description"));
xmlns = xmlnode_get_namespace(session->description);
if (purple_strequal(xmlns, NS_GOOGLE_SESSION_PHONE))
session_data->video = FALSE;
else if (purple_strequal(xmlns, NS_GOOGLE_SESSION_VIDEO))
session_data->video = TRUE;
else {
purple_debug_error("jabber", "Received initiate with "
"invalid namespace %s.\n", xmlns);
return FALSE;
}
session_data->media = purple_media_manager_create_media(
purple_media_manager_get(),
purple_connection_get_account(js->gc),
"fsrtpconference", session->remote_jid, FALSE);
purple_media_set_prpl_data(session_data->media, session);
g_signal_connect_swapped(G_OBJECT(session_data->media),
"candidates-prepared",
G_CALLBACK(google_session_ready), session);
g_signal_connect_swapped(G_OBJECT(session_data->media), "codecs-changed",
G_CALLBACK(google_session_ready), session);
g_signal_connect(G_OBJECT(session_data->media), "state-changed",
G_CALLBACK(google_session_state_changed_cb), session);
g_signal_connect(G_OBJECT(session_data->media), "stream-info",
G_CALLBACK(google_session_stream_info_cb), session);
session->iq_id = g_strdup(iq_id);
if (js->google_relay_host && js->google_relay_token) {
jabber_google_do_relay_request(js, session,
jabber_google_relay_response_session_handle_initiate_cb);
} else {
jabber_google_relay_response_session_handle_initiate_cb(session, NULL,
0, 0, 0, NULL, NULL);
}
return TRUE;
}
开发者ID:wosigh,项目名称:messaging-plugins,代码行数:54,代码来源:google_session.c
示例8: purple_plugins_find_with_basename
PurplePlugin *
purple_plugins_find_with_basename(const char *basename)
{
#ifdef PURPLE_PLUGINS
PurplePlugin *plugin;
GList *l;
char *tmp;
g_return_val_if_fail(basename != NULL, NULL);
for (l = plugins; l != NULL; l = l->next)
{
plugin = (PurplePlugin *)l->data;
if (plugin->path != NULL) {
tmp = purple_plugin_get_basename(plugin->path);
if (purple_strequal(tmp, basename))
{
g_free(tmp);
return plugin;
}
g_free(tmp);
}
}
#endif /* PURPLE_PLUGINS */
return NULL;
}
开发者ID:Distrotech,项目名称:pidgin,代码行数:29,代码来源:plugin.c
示例9: xep_cmp_addr
/**
* Will compare a host with a buddy_ip.
*
* Additionally to a common 'purple_strequal(host, buddy_ip)', it will also return TRUE
* if 'host' is a link local IPv6 address without an appended interface
* identifier and 'buddy_ip' string is "host" + "%iface".
*
* Note: This may theoretically result in the attempt to connect to the wrong
* host, because we do not know for sure which interface the according link
* local IPv6 address might relate to and RFC4862 for instance only ensures the
* uniqueness of this address on a given link. So we could possibly have two
* distinct buddies with the same ipv6 link local address on two distinct
* interfaces. Unfortunately XEP-0065 does not seem to specify how to deal with
* link local ip addresses properly...
* However, in practice the possiblity for such a conflict is relatively low
* (2011 - might be different in the future though?).
*
* @param host ipv4 or ipv6 address string
* @param buddy_ip ipv4 or ipv6 address string
* @return TRUE if they match, FALSE otherwise
*/
static gboolean
xep_cmp_addr(const char *host, const char *buddy_ip)
{
#if defined(AF_INET6) && defined(HAVE_GETADDRINFO)
struct addrinfo hint, *res = NULL;
int ret;
memset(&hint, 0, sizeof(hint));
hint.ai_family = AF_UNSPEC;
hint.ai_flags = AI_NUMERICHOST;
ret = getaddrinfo(host, NULL, &hint, &res);
if(ret)
goto out;
if(res->ai_family != AF_INET6 ||
!IN6_IS_ADDR_LINKLOCAL(&((struct sockaddr_in6 *)res->ai_addr)->sin6_addr)) {
freeaddrinfo(res);
goto out;
}
freeaddrinfo(res);
if(strlen(buddy_ip) <= strlen(host) ||
buddy_ip[strlen(host)] != '%')
return FALSE;
return !strncmp(host, buddy_ip, strlen(host));
out:
#endif
return purple_strequal(host, buddy_ip);
}
开发者ID:dylex,项目名称:pidgin,代码行数:53,代码来源:bonjour_ft.c
示例10: fb_util_get_locale
gchar *
fb_util_get_locale(void)
{
const gchar * const *langs;
const gchar *lang;
gchar *chr;
guint i;
static const gchar chrs[] = {'.', '@'};
langs = g_get_language_names();
lang = langs[0];
if (purple_strequal(lang, "C")) {
return g_strdup("en_US");
}
for (i = 0; i < G_N_ELEMENTS(chrs); i++) {
chr = strchr(lang, chrs[i]);
if (chr != NULL) {
return g_strndup(lang, chr - lang);
}
}
return g_strdup(lang);
}
开发者ID:N8Fear,项目名称:purple-facebook,代码行数:27,代码来源:util.c
示例11: purple_protocol_finalize
static void
purple_protocol_finalize(GObject *object)
{
PurpleProtocol *protocol = PURPLE_PROTOCOL(object);
GList *accounts, *l;
accounts = purple_accounts_get_all_active();
for (l = accounts; l != NULL; l = l->next) {
PurpleAccount *account = PURPLE_ACCOUNT(l->data);
if (purple_account_is_disconnected(account))
continue;
if (purple_strequal(protocol->id,
purple_account_get_protocol_id(account)))
purple_account_disconnect(account);
}
g_list_free(accounts);
purple_request_close_with_handle(protocol);
purple_notify_close_with_handle(protocol);
purple_signals_disconnect_by_handle(protocol);
purple_signals_unregister_by_instance(protocol);
purple_prefs_disconnect_by_handle(protocol);
user_splits_free(protocol);
account_options_free(protocol);
icon_spec_free(protocol);
PURPLE_DBUS_UNREGISTER_POINTER(protocol);
parent_class->finalize(object);
}
开发者ID:N8Fear,项目名称:purple-facebook,代码行数:35,代码来源:protocol.c
示例12: reverse
static gboolean
reverse(PurpleAccount *account, char **who, char **message,
PurpleConversation *conv, int *flags)
{
/* this will drive you insane. whenever you receive a message,
* the text of the message (HTML and all) will be reversed. */
int i, l;
char tmp;
/* this check is necessary in case bad plugins do bad things */
if (message == NULL || *message == NULL)
return FALSE;
l = strlen(*message);
if (purple_strequal(*who, purple_account_get_username(account)))
return FALSE;
for (i = 0; i < l/2; i++) {
tmp = (*message)[i];
(*message)[i] = (*message)[l - i - 1];
(*message)[l - i - 1] = tmp;
}
return FALSE;
}
开发者ID:dylex,项目名称:pidgin,代码行数:25,代码来源:pidgininc.c
示例13: purple_prefs_set_string
void
purple_prefs_set_string(const char *name, const char *value)
{
struct purple_pref *pref = find_pref(name);
if(value != NULL && !g_utf8_validate(value, -1, NULL)) {
purple_debug_error("prefs", "purple_prefs_set_string: Cannot store invalid UTF8 for string pref %s\n", name);
return;
}
if(pref) {
if(pref->type != PURPLE_PREF_STRING && pref->type != PURPLE_PREF_PATH) {
purple_debug_error("prefs",
"purple_prefs_set_string: %s not a string pref\n", name);
return;
}
if (!purple_strequal(pref->value.string, value)) {
g_free(pref->value.string);
pref->value.string = g_strdup(value);
do_callbacks(name, pref);
}
} else {
purple_prefs_add_string(name, value);
}
}
开发者ID:psunkari,项目名称:spicebird,代码行数:26,代码来源:prefs.c
示例14: jabber_auth_handle_challenge
void
jabber_auth_handle_challenge(JabberStream *js, PurpleXmlNode *packet)
{
const char *ns = purple_xmlnode_get_namespace(packet);
if (!purple_strequal(ns, NS_XMPP_SASL)) {
purple_connection_error(js->gc,
PURPLE_CONNECTION_ERROR_NETWORK_ERROR,
_("Invalid response from server"));
return;
}
if (js->auth_mech && js->auth_mech->handle_challenge) {
PurpleXmlNode *response = NULL;
char *msg = NULL;
JabberSaslState state = js->auth_mech->handle_challenge(js, packet, &response, &msg);
if (state == JABBER_SASL_STATE_FAIL) {
purple_connection_error(js->gc,
PURPLE_CONNECTION_ERROR_AUTHENTICATION_IMPOSSIBLE,
msg ? msg : _("Invalid challenge from server"));
} else if (response) {
jabber_send(js, response);
purple_xmlnode_free(response);
}
g_free(msg);
} else
purple_debug_warning("jabber", "Received unexpected (and unhandled) <challenge/>\n");
}
开发者ID:ArmoredPidgin,项目名称:pidgin-hardened,代码行数:29,代码来源:auth.c
示例15: purple_xmlnode_remove_attrib
void
purple_xmlnode_remove_attrib(PurpleXmlNode *node, const char *attr)
{
PurpleXmlNode *attr_node, *sibling = NULL;
g_return_if_fail(node != NULL);
g_return_if_fail(attr != NULL);
attr_node = node->child;
while (attr_node) {
if(attr_node->type == PURPLE_XMLNODE_TYPE_ATTRIB &&
purple_strequal(attr_node->name, attr))
{
if (node->lastchild == attr_node) {
node->lastchild = sibling;
}
if (sibling == NULL) {
node->child = attr_node->next;
purple_xmlnode_free(attr_node);
attr_node = node->child;
} else {
sibling->next = attr_node->next;
sibling = attr_node->next;
purple_xmlnode_free(attr_node);
attr_node = sibling;
}
}
else
{
attr_node = attr_node->next;
}
sibling = attr_node;
}
}
开发者ID:N8Fear,项目名称:purple-facebook,代码行数:34,代码来源:xmlnode.c
示例16: jabber_id_equal
gboolean
jabber_id_equal(const JabberID *jid1, const JabberID *jid2)
{
if (!jid1 && !jid2) {
/* Both are null therefore equal */
return TRUE;
}
if (!jid1 || !jid2) {
/* One is null, other is non-null, therefore not equal */
return FALSE;
}
return purple_strequal(jid1->node, jid2->node) &&
purple_strequal(jid1->domain, jid2->domain) &&
purple_strequal(jid1->resource, jid2->resource);
}
开发者ID:dylex,项目名称:pidgin,代码行数:17,代码来源:jutil.c
示例17: purple_xmlnode_get_attrib_with_namespace
const char *
purple_xmlnode_get_attrib_with_namespace(const PurpleXmlNode *node, const char *attr, const char *xmlns)
{
const PurpleXmlNode *x;
g_return_val_if_fail(node != NULL, NULL);
g_return_val_if_fail(attr != NULL, NULL);
for(x = node->child; x; x = x->next) {
if(x->type == PURPLE_XMLNODE_TYPE_ATTRIB &&
purple_strequal(attr, x->name) &&
purple_strequal(xmlns, x->xmlns)) {
return x->data;
}
}
return NULL;
}
开发者ID:N8Fear,项目名称:purple-facebook,代码行数:18,代码来源:xmlnode.c
示例18: prefs_end_element_handler
static void
prefs_end_element_handler(GMarkupParseContext *context,
const gchar *element_name,
gpointer user_data, GError **error)
{
if(prefs_stack && purple_strequal(element_name, "pref")) {
g_free(prefs_stack->data);
prefs_stack = g_list_delete_link(prefs_stack, prefs_stack);
}
}
开发者ID:psunkari,项目名称:spicebird,代码行数:10,代码来源:prefs.c
示例19: silcpurple_buddy_set_icon
void silcpurple_buddy_set_icon(PurpleConnection *gc, PurpleStoredImage *img)
{
SilcPurple sg = gc->proto_data;
SilcClient client = sg->client;
SilcClientConnection conn = sg->conn;
SilcMime mime;
char type[32];
unsigned char *icon;
const char *t;
SilcAttributeObjMime obj;
/* Remove */
if (!img) {
silc_client_attribute_del(client, conn,
SILC_ATTRIBUTE_USER_ICON, NULL);
return;
}
/* Add */
mime = silc_mime_alloc();
if (!mime)
return;
t = purple_imgstore_get_extension(img);
if (!t || purple_strequal(t, "icon")) {
silc_mime_free(mime);
return;
}
if (purple_strequal(t, "jpg"))
t = "jpeg";
g_snprintf(type, sizeof(type), "image/%s", t);
silc_mime_add_field(mime, "Content-Type", type);
silc_mime_add_data(mime, purple_imgstore_get_data(img), purple_imgstore_get_size(img));
obj.mime = icon = silc_mime_encode(mime, &obj.mime_len);
if (obj.mime)
silc_client_attribute_add(client, conn,
SILC_ATTRIBUTE_USER_ICON, &obj, sizeof(obj));
silc_free(icon);
silc_mime_free(mime);
}
开发者ID:dylex,项目名称:pidgin,代码行数:42,代码来源:buddy.c
示例20: purple_prefs_get_string
PurpleStunNatDiscovery *purple_stun_discover(StunCallback cb) {
const char *servername = purple_prefs_get_string("/purple/network/stun_server");
purple_debug_info("stun", "using server %s\n", servername);
if(nattype.status == PURPLE_STUN_STATUS_DISCOVERING) {
if(cb)
callbacks = g_slist_append(callbacks, cb);
return &nattype;
}
if(nattype.status != PURPLE_STUN_STATUS_UNDISCOVERED) {
gboolean use_cached_result = TRUE;
/** Deal with the server name having changed since we did the
lookup */
if (servername && strlen(servername) > 1
&& !purple_strequal(servername, nattype.servername)) {
use_cached_result = FALSE;
}
/* If we don't have a successful status and it has been 5
minutes since we last did a lookup, redo the lookup */
if (nattype.status != PURPLE_STUN_STATUS_DISCOVERED
&& (time(NULL) - nattype.lookup_time) > 300) {
use_cached_result = FALSE;
}
if (use_cached_result) {
if(cb)
purple_timeout_add(10, call_callback, cb);
return &nattype;
}
}
if(!servername || (strlen(servername) < 2)) {
nattype.status = PURPLE_STUN_STATUS_UNKNOWN;
nattype.lookup_time = time(NULL);
if(cb)
purple_timeout_add(10, call_callback, cb);
return &nattype;
}
nattype.status = PURPLE_STUN_STATUS_DISCOVERING;
nattype.publicip[0] = '\0';
g_free(nattype.servername);
nattype.servername = g_strdup(servername);
callbacks = g_slist_append(callbacks, cb);
purple_srv_resolve_account(NULL, "stun", "udp", servername, do_test1,
(gpointer) servername);
return &nattype;
}
开发者ID:CkNoSFeRaTU,项目名称:pidgin,代码行数:54,代码来源:stun.c
注:本文中的purple_strequal函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论