• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ purple_debug_info函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中purple_debug_info函数的典型用法代码示例。如果您正苦于以下问题:C++ purple_debug_info函数的具体用法?C++ purple_debug_info怎么用?C++ purple_debug_info使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了purple_debug_info函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: purplemot_set_info

static void
purplemot_set_info(PurpleConnection *gc, const char *info)
{
  purple_debug_info("purplemot", "setting %s's user info to %s\n",
                    gc->account->username, info);
}
开发者ID:flowerhack,项目名称:motmot,代码行数:6,代码来源:purplemot.c


示例2: mxit_profile_cb

/*------------------------------------------------------------------------
 * The user has selected to change their profile.
 *
 *  @param gc		The connection object
 *  @param fields	The fields from the request pop-up
 */
static void mxit_profile_cb( PurpleConnection* gc, PurpleRequestFields* fields )
{
	struct MXitSession*		session	= purple_connection_get_protocol_data( gc );
	PurpleRequestField*		field	= NULL;
	const char*				name	= NULL;
	const char*				bday	= NULL;
	const char*				err		= NULL;
	GList*					entry	= NULL;

	purple_debug_info( MXIT_PLUGIN_ID, "mxit_profile_cb\n" );

	PURPLE_ASSERT_CONNECTION_IS_VALID(gc);

	/* validate name */
	name = purple_request_fields_get_string( fields, "name" );
	if ( ( !name ) || ( strlen( name ) < 3 ) ) {
		err = _( "The Display Name you entered is invalid." );
		goto out;
	}

	/* validate birthdate */
	bday = purple_request_fields_get_string( fields, "bday" );
	if ( ( !bday ) || ( strlen( bday ) < 10 ) || ( !validateDate( bday ) ) ) {
		err = _( "The birthday you entered is invalid. The correct format is: 'YYYY-MM-DD'." );
		goto out;
	}

out:
	if ( !err ) {
		struct MXitProfile*	profile		= session->profile;
		GString*			attributes	= g_string_sized_new( 128 );
		char				attrib[512];
		unsigned int		acount		= 0;


		/* update name */
		g_strlcpy( profile->nickname, name, sizeof( profile->nickname ) );
		g_snprintf( attrib, sizeof( attrib ), "\01%s\01%i\01%s", CP_PROFILE_FULLNAME, CP_PROFILE_TYPE_UTF8, profile->nickname );
		g_string_append( attributes, attrib );
		acount++;

		/* update birthday */
		g_strlcpy( profile->birthday, bday, sizeof( profile->birthday ) );
		g_snprintf( attrib, sizeof( attrib ), "\01%s\01%i\01%s", CP_PROFILE_BIRTHDATE, CP_PROFILE_TYPE_UTF8, profile->birthday );
		g_string_append( attributes, attrib );
		acount++;

		/* update gender */
		profile->male = ( purple_request_fields_get_choice( fields, "male" ) != 0 );
		g_snprintf( attrib, sizeof( attrib ), "\01%s\01%i\01%s", CP_PROFILE_GENDER, CP_PROFILE_TYPE_BOOL, ( profile->male ) ? "1" : "0" );
		g_string_append( attributes, attrib );
		acount++;

		/* update title */
		name = purple_request_fields_get_string( fields, "title" );
		if ( !name )
			profile->title[0] = '\0';
		else
			g_strlcpy( profile->title, name, sizeof( profile->title ) );
		g_snprintf( attrib, sizeof( attrib ), "\01%s\01%i\01%s", CP_PROFILE_TITLE, CP_PROFILE_TYPE_UTF8, profile->title );
		g_string_append( attributes, attrib );
		acount++;

		/* update firstname */
		name = purple_request_fields_get_string( fields, "firstname" );
		if ( !name )
			profile->firstname[0] = '\0';
		else
			g_strlcpy( profile->firstname, name, sizeof( profile->firstname ) );
		g_snprintf( attrib, sizeof( attrib ), "\01%s\01%i\01%s", CP_PROFILE_FIRSTNAME, CP_PROFILE_TYPE_UTF8, profile->firstname );
		g_string_append( attributes, attrib );
		acount++;

		/* update lastname */
		name = purple_request_fields_get_string( fields, "lastname" );
		if ( !name )
			profile->lastname[0] = '\0';
		else
			g_strlcpy( profile->lastname, name, sizeof( profile->lastname ) );
		g_snprintf( attrib, sizeof( attrib ), "\01%s\01%i\01%s", CP_PROFILE_LASTNAME, CP_PROFILE_TYPE_UTF8, profile->lastname );
		g_string_append( attributes, attrib );
		acount++;

		/* update email address */
		name = purple_request_fields_get_string( fields, "email" );
		if ( !name )
			profile->email[0] = '\0';
		else
			g_strlcpy( profile->email, name, sizeof( profile->email ) );
		g_snprintf( attrib, sizeof( attrib ), "\01%s\01%i\01%s", CP_PROFILE_EMAIL, CP_PROFILE_TYPE_UTF8, profile->email );
		g_string_append( attributes, attrib );
		acount++;

		/* update mobile number */
//.........这里部分代码省略.........
开发者ID:ArmoredPidgin,项目名称:pidgin-hardened,代码行数:101,代码来源:actions.c


示例3: flist_global_profile_cb

static void flist_global_profile_cb(FListWebRequestData *req_data,
        gpointer user_data, JsonObject *root, const gchar *error_message) {
    FListAccount *fla = user_data;
    FListProfiles *flp = _flist_profiles(fla);
    JsonObject *info;
    GList *categories, *cur;
    int i, len;

    flp->global_profile_request = NULL;
    
    if(!root) {
        purple_debug_warning(FLIST_DEBUG, "Failed to obtain the global list of profile fields. Error Message: %s\n", error_message);
        return;
    }

    info = json_object_get_object_member(root, "info");
    if(!info) {
        purple_debug_warning(FLIST_DEBUG, "We received the global list of profile fields, but it was empty.\n");
        return;
    }
    
    purple_debug_info(FLIST_DEBUG, "Processing global profile fields...\n");
    
    flp->category_table = g_hash_table_new_full(g_str_hash, g_str_equal, NULL, NULL);
    
    categories = json_object_get_members(info);
    cur = categories;
    while(cur) {
        const gchar *group_name;
        JsonObject *field_group;
        JsonArray *field_array;
        FListProfileFieldCategory *category;
        guint i, len;
        
        field_group = json_object_get_object_member(info, cur->data);
        group_name = json_object_get_string_member(field_group, "group");
        field_array = json_object_get_array_member(field_group, "items");
        
        category = g_new0(FListProfileFieldCategory, 1);
        category->name = g_strdup(group_name);
        
        len = json_array_get_length(field_array);
        for(i = 0; i < len; i++) {
            JsonObject *field_object = json_array_get_object_element(field_array, i);
            FListProfileField *field = g_new0(FListProfileField, 1);
            field->category = category;
            field->fieldid = g_strdup_printf("%d", (gint) json_object_get_int_member(field_object, "id"));
            field->name = g_strdup(json_object_get_string_member(field_object, "name"));
            category->fields = g_slist_prepend(category->fields, field);
            if(fla->debug_mode) {
                purple_debug_info(FLIST_DEBUG,
                                  "Global profile field processed. (ID: %s) (Category: %s) (Name: %s)\n",
                                  field->fieldid, field->category->name, field->name);
            }
        }
        category->fields = g_slist_sort(category->fields, (GCompareFunc) flist_profile_field_cmp);
        flp->category_list = g_slist_append(flp->category_list, category);
        g_hash_table_insert(flp->category_table, category->name, category);
        cur = g_list_next(cur);
    }
    g_list_free(categories);
    
    purple_debug_info(FLIST_DEBUG, 
        "We received the global list of profile fields. Total Categories: %d\n", 
        g_hash_table_size(flp->category_table));
}
开发者ID:FList-Adium,项目名称:flist-adium,代码行数:66,代码来源:f-list_profile.c


示例4: ggp_chat_roomlist_get_list

PurpleRoomlist * ggp_chat_roomlist_get_list(PurpleConnection *gc)
{
	ggp_chat_session_data *sdata = ggp_chat_get_sdata(gc);
	PurpleRoomlist *roomlist;
	GList *fields = NULL;
	int i;

	purple_debug_info("gg", "ggp_chat_roomlist_get_list\n");

	roomlist = purple_roomlist_new(purple_connection_get_account(gc));

	fields = g_list_append(fields, purple_roomlist_field_new(
		PURPLE_ROOMLIST_FIELD_STRING, _("Conference identifier"), "id",
		TRUE));

	fields = g_list_append(fields, purple_roomlist_field_new(
		PURPLE_ROOMLIST_FIELD_STRING, _("Start Date"), "date",
		FALSE));

	fields = g_list_append(fields, purple_roomlist_field_new(
		PURPLE_ROOMLIST_FIELD_INT, _("User Count"), "users",
		FALSE));

	fields = g_list_append(fields, purple_roomlist_field_new(
		PURPLE_ROOMLIST_FIELD_STRING, _("Status"), "status",
		FALSE));

	purple_roomlist_set_fields(roomlist, fields);

	for (i = sdata->chats_count - 1; i >= 0 ; i--) {
		PurpleRoomlistRoom *room;
		ggp_chat_local_info *chat = &sdata->chats[i];
		const gchar *name;
		time_t date;
		const gchar *status;
		int count = chat->participants_count;

		date = (uint32_t)(chat->id >> 32);

		if (chat->conv)
			status = _("Joined");
		else if (chat->left)
			/* Translators: For Gadu-Gadu, this is one possible status for a
			   chat room. It means you had previously joined the chat room but
			   you have since left it. You cannot rejoin without another
			   invitation. */
			status = _("Chat left");
		else {
			status = _("Can join chat");
			count--;
		}

		name = ggp_chat_get_name_from_id(chat->id);
		room = purple_roomlist_room_new(PURPLE_ROOMLIST_ROOMTYPE_ROOM,
			name, NULL);
		purple_roomlist_room_add_field(roomlist, room, name);
		purple_roomlist_room_add_field(roomlist, room, purple_date_format_full(localtime(&date)));
		purple_roomlist_room_add_field(roomlist, room, GINT_TO_POINTER(count));
		purple_roomlist_room_add_field(roomlist, room, status);
		purple_roomlist_room_add(roomlist, room);
	}

	/* TODO
	 * purple_roomlist_set_in_progress(roomlist, FALSE);
	 */
	g_object_ref(roomlist);
	purple_timeout_add(1, ggp_chat_roomlist_get_list_finish, roomlist);
	return roomlist;
}
开发者ID:N8Fear,项目名称:purple-facebook,代码行数:69,代码来源:chat.c


示例5: cipher_test_pbkdf2

static void
cipher_test_pbkdf2(void)
{
	PurpleCipher *cipher;
	PurpleHash *hash;
	int i = 0;
	gboolean fail = FALSE;

	purple_debug_info("cipher-test", "Running PBKDF2 tests\n");

	while (!fail && pbkdf2_tests[i].answer) {
		pbkdf2_test *test = &pbkdf2_tests[i];
		gchar digest[2 * 32 + 1 + 10];
		gchar *digest_nss = NULL;
		gboolean ret, skip_nss = FALSE;

		i++;

		purple_debug_info("cipher-test", "Test %02d:\n", i);
		purple_debug_info("cipher-test",
			"\tTesting '%s' with salt:'%s' hash:%s iter_count:%d \n",
			test->passphrase, test->salt, test->hash,
			test->iter_count);

		if (!strcmp(test->hash, "sha1"))
			hash = purple_sha1_hash_new();
		else if (!strcmp(test->hash, "sha256"))
			hash = purple_sha256_hash_new();
		else
			hash = NULL;

		cipher = purple_pbkdf2_cipher_new(hash);

		g_object_set(G_OBJECT(cipher), "iter_count", GUINT_TO_POINTER(test->iter_count), NULL);
		g_object_set(G_OBJECT(cipher), "out_len", GUINT_TO_POINTER(test->out_len), NULL);
		purple_cipher_set_salt(cipher, (const guchar*)test->salt, test->salt ? strlen(test->salt): 0);
		purple_cipher_set_key(cipher, (const guchar*)test->passphrase, strlen(test->passphrase));

		ret = purple_cipher_digest_to_str(cipher, digest, sizeof(digest));
		purple_cipher_reset(cipher);

		if (!ret) {
			purple_debug_info("cipher-test", "\tfailed\n");
			fail = TRUE;
			g_object_unref(cipher);
			g_object_unref(hash);
			continue;
		}

		if (g_strcmp0(test->hash, "sha1") != 0)
			skip_nss = TRUE;
		if (test->out_len != 16 && test->out_len != 32)
			skip_nss = TRUE;

#ifdef HAVE_NSS
		if (!skip_nss) {
			digest_nss = cipher_pbkdf2_nss_sha1(test->passphrase,
				test->salt, test->iter_count, test->out_len);
		}
#else
		skip_nss = TRUE;
#endif

		purple_debug_info("cipher-test", "\tGot:          %s\n", digest);
		if (digest_nss)
			purple_debug_info("cipher-test", "\tGot from NSS: %s\n", digest_nss);
		purple_debug_info("cipher-test", "\tWanted:       %s\n", test->answer);

		if (g_strcmp0(digest, test->answer) == 0 &&
			(skip_nss || g_strcmp0(digest, digest_nss) == 0)) {
			purple_debug_info("cipher-test", "\tTest OK\n");
		}
		else {
			purple_debug_info("cipher-test", "\twrong answer\n");
			fail = TRUE;
		}

		g_object_unref(cipher);
		g_object_unref(hash);
	}

	if (fail)
		purple_debug_info("cipher-test", "PBKDF2 tests FAILED\n\n");
	else
		purple_debug_info("cipher-test", "PBKDF2 tests completed successfully\n\n");
}
开发者ID:N8Fear,项目名称:purple-facebook,代码行数:86,代码来源:ciphertest.c


示例6: om_got_events

static void om_got_events(OmegleAccount *oma, gchar *response, gsize len,
		gpointer userdata)
{
	//[["waiting"], ["connected"]]
	gchar *who = userdata;
	const gchar *message;
	const gchar *event_type;
	JsonParser *parser;
	JsonNode *rootnode, *currentnode;
	JsonArray *array, *current;
	guint i;

	purple_debug_info("omegle", "got events: %s\n", response?response:"(null)");
	
	if (!response || g_str_equal(response, "null"))
	{
		g_free(who);
		return;
	}
	
	parser = json_parser_new();
	json_parser_load_from_data(parser, response, len, NULL);
	rootnode = json_parser_get_root(parser);
	if (!rootnode)
	{
		g_object_unref(parser);
		return;
	}
	array = json_node_get_array(rootnode);
	
	for(i=0; i<json_array_get_length(array); i++)
	{
		currentnode = json_array_get_element(array, i);
		current = json_node_get_array(currentnode);
		event_type = json_node_get_string(json_array_get_element(current, 0));
		if (!event_type)
		{
			continue;
		} else if (g_str_equal(event_type, "waiting")) {
			serv_got_im(oma->pc, who, "Looking for someone you can chat with. Hang on.", PURPLE_MESSAGE_SYSTEM, time(NULL));
		} else if (g_str_equal(event_type, "connected")) {
			serv_got_im(oma->pc, who, "You're now chatting with a random stranger. Say hi!", PURPLE_MESSAGE_SYSTEM, time(NULL));
		} else if (g_str_equal(event_type, "gotMessage")) {
			//[["gotMessage","message goes here"]]
			message = json_node_get_string(json_array_get_element(current, 1));
			if (message)
				serv_got_im(oma->pc, who, message, PURPLE_MESSAGE_RECV, time(NULL));
		} else if (g_str_equal(event_type, "typing")) {
			serv_got_typing(oma->pc, who, 10, PURPLE_TYPING);
		} else if (g_str_equal(event_type, "stoppedTyping")) {
			serv_got_typing(oma->pc, who, 10, PURPLE_TYPED);
		} else if (g_str_equal(event_type, "strangerDisconnected")) {
			serv_got_im(oma->pc, who, "Your conversational partner has disconnected", PURPLE_MESSAGE_SYSTEM, time(NULL));
		}
	}
	
	om_fetch_events(oma, g_strdup(who));
	
	g_free(who);
	g_object_unref(parser);
}
开发者ID:Javran,项目名称:purple-plugin-pack,代码行数:61,代码来源:omegle.c


示例7: purplemot_remove_group

static void
purplemot_remove_group(PurpleConnection *gc, PurpleGroup *group)
{
  purple_debug_info("purplemot", "%s has removed group %s\n",
                    gc->account->username, group->name);
}
开发者ID:flowerhack,项目名称:motmot,代码行数:6,代码来源:purplemot.c


示例8: purplemot_roomlist_cancel

static void
purplemot_roomlist_cancel(PurpleRoomlist *list)
{
  purple_debug_info("purplemot", "%s asked to cancel room list request\n",
                    list->account->username);
}
开发者ID:flowerhack,项目名称:motmot,代码行数:6,代码来源:purplemot.c


示例9: purplemot_alias_buddy

static void
purplemot_alias_buddy(PurpleConnection *gc, const char *who, const char *alias)
{
  purple_debug_info("purplemot", "%s sets %s's alias to %s\n",
                    gc->account->username, who, alias);
}
开发者ID:flowerhack,项目名称:motmot,代码行数:6,代码来源:purplemot.c


示例10: purplemot_convo_closed

static void
purplemot_convo_closed(PurpleConnection *gc, const char *who)
{
  purple_debug_info("purplemot", "%s's conversation with %s was closed\n",
                    gc->account->username, who);
}
开发者ID:flowerhack,项目名称:motmot,代码行数:6,代码来源:purplemot.c


示例11: purplemot_register_user

static void
purplemot_register_user(PurpleAccount *acct)
{
  purple_debug_info("purplemot", "registering account for %s\n",
      acct->username);
}
开发者ID:flowerhack,项目名称:motmot,代码行数:6,代码来源:purplemot.c


示例12: purplemot_rem_deny

static void
purplemot_rem_deny(PurpleConnection *gc, const char *name)
{
  purple_debug_info("purplemot", "%s removes %s from their blocked list\n",
                    gc->account->username, name);
}
开发者ID:flowerhack,项目名称:motmot,代码行数:6,代码来源:purplemot.c


示例13: purplemot_add_deny

static void
purplemot_add_deny(PurpleConnection *gc, const char *name)
{
  purple_debug_info("purplemot", "%s adds %s to their blocked list\n",
                    gc->account->username, name);
}
开发者ID:flowerhack,项目名称:motmot,代码行数:6,代码来源:purplemot.c


示例14: waprpl_process_incoming_events

static void waprpl_process_incoming_events(PurpleConnection * gc)
{
	whatsapp_connection *wconn = purple_connection_get_protocol_data(gc);
	PurpleAccount *acc = purple_connection_get_account(gc);

	switch (waAPI_loginstatus(wconn->waAPI)) {
	case 0:
		purple_connection_update_progress(gc, "Connecting", 0, 4);
		break;
	case 1:
		purple_connection_update_progress(gc, "Sending authorization", 1, 4);
		break;
	case 2:
		purple_connection_update_progress(gc, "Awaiting response", 2, 4);
		break;
	case 3:
		purple_connection_update_progress(gc, "Connection established", 3, 4);
		purple_connection_set_state(gc, PURPLE_CONNECTED);

		if (!wconn->connected)
			waprpl_insert_contacts(gc);

		wconn->connected = 1;

		PurpleAccount *account = purple_connection_get_account(gc);
		PurpleStatus *status = purple_account_get_active_status(account);
		waprpl_set_status(account, status);

		break;
	default:
		break;
	};

	char *msg, *who, *prev, *url, *author;
	int status;
	int size;
	double lat, lng;
	unsigned long timestamp;
	/* Incoming messages */
	while (1) {
		int r = waAPI_querynext(wconn->waAPI);
		switch (r) {
		case 0:
		if (waAPI_querychat(wconn->waAPI, &who, &msg, &author, &timestamp)) {
			purple_debug_info(WHATSAPP_ID, "Got chat message from %s: %s\n", who, msg);
			conv_add_message(gc, who, msg, author, timestamp);
		}
		break;
		case 1:
		if (waAPI_querychatimage(wconn->waAPI, &who, &prev, &size, &url, &author, &timestamp)) {
			purple_debug_info(WHATSAPP_ID, "Got image from %s: %s\n", who, url);
			int imgid = purple_imgstore_add_with_id(g_memdup(prev, size), size, NULL);

			char *msg = g_strdup_printf("<a href=\"%s\"><img id=\"%u\"></a><br/><a href=\"%s\">%s</a>", url, imgid, url, url);
			conv_add_message(gc, who, msg, author, timestamp);
			g_free(msg);
		}
		break;
		case 2:
		if (waAPI_querychatlocation(wconn->waAPI, &who, &prev, &size, &lat, &lng, &author, &timestamp)) {
			purple_debug_info(WHATSAPP_ID, "Got geomessage from: %s Coordinates (%f %f)\n", who, (float)lat, (float)lng);
			int imgid = purple_imgstore_add_with_id(g_memdup(prev, size), size, NULL);
			char *msg = g_strdup_printf("<a href=\"http://openstreetmap.org/?lat=%f&lon=%f&zoom=16\"><img src=\"%u\"></a>", lat, lng, imgid);
			conv_add_message(gc, who, msg, author, timestamp);
			g_free(msg);
		}
		break;
		case 3:
		if (waAPI_querychatsound(wconn->waAPI, &who, &url, &author, &timestamp)) {
			purple_debug_info(WHATSAPP_ID, "Got chat sound from %s: %s\n", who, url);
			char *msg = g_strdup_printf("<a href=\"%s\">%s</a>", url, url);
			conv_add_message(gc, who, msg, author, timestamp);
			g_free(msg);
		}
		break;
		default: break;
		};
		if (r < 0) break;
	}

	/* User status change */
	while (waAPI_querystatus(wconn->waAPI, &who, &status)) {
		if (status == 1) {
			purple_prpl_got_user_status(acc, who, "available", "message", "", NULL);
		} else {
			purple_prpl_got_user_status(acc, who, "unavailable", "message", "", NULL);
		}
	}
	/* User typing info notify */
	while (waAPI_querytyping(wconn->waAPI, &who, &status)) {
		if (status == 1) {
			purple_debug_info(WHATSAPP_ID, "%s is typing\n", who);
			serv_got_typing(gc, who, 0, PURPLE_TYPING);
		} else {
			purple_debug_info(WHATSAPP_ID, "%s is not typing\n", who);
			serv_got_typing(gc, who, 0, PURPLE_NOT_TYPING);
			serv_got_typing_stopped(gc, who);
		}
	}

//.........这里部分代码省略.........
开发者ID:sanaewah,项目名称:whatsapp-purple,代码行数:101,代码来源:wa_purple.c


示例15: AddMobileBuddy

void AddMobileBuddy(struct fetion_account_data *sip,struct sipmsg *msg ,struct transaction *tc)
{
	gint xml_len;
	xmlnode *root,*son,*item;
	gchar *body;
	const gchar *uri, *name ,*group_id;
	struct group_attr *g_attr=NULL;
	gchar *buddy_name;
	PurpleBuddy *b;
	PurpleGroup *g = NULL;
	struct fetion_buddy *bs;
	struct sipmsg *old=NULL;
	const gchar *real_name;

	real_name = purple_account_get_string(sip->account, "realname", sip->username);

         if(!real_name || strlen(real_name) < 1)
	 {
                 real_name = sip->username;
         }

	g_return_if_fail(tc->msg!=NULL);
	old = tc->msg;
	g_return_if_fail(old!=NULL);
	purple_debug_info("fetion:","AddMobileBuddy:oldmsg[%s]",old->body);
	root = xmlnode_from_str(old->body, old->bodylen);
	item = xmlnode_get_child(root,"contacts/buddies/buddy");
	g_return_if_fail(item!=NULL);

	uri = xmlnode_get_attrib(item, "uri");
	name = xmlnode_get_attrib(item, "local-name");
	group_id = xmlnode_get_attrib(item, "buddy-lists");
	buddy_name = g_strdup_printf("%s", uri);
	g_attr = g_hash_table_lookup(sip->group,group_id);
	g_return_if_fail(g_attr!=NULL);
	g = purple_find_group(g_attr->name);
	if(!g)
		g = purple_group_new(g_attr->name);

	b = purple_find_buddy(sip->account, buddy_name);
	if(!b){
		b = purple_buddy_new(sip->account, buddy_name, NULL);
	}

	purple_blist_add_buddy(b, NULL, g, NULL);
	if(name!=NULL && *name!='\0')
		purple_blist_alias_buddy(b, name);
	bs = g_new0(struct fetion_buddy, 1);
	bs->name = g_strdup(b->name);
	g_hash_table_insert(sip->buddies, bs->name, bs);

	xmlnode_free(root);

	root = xmlnode_new("args");
	g_return_if_fail(root!=NULL);
	son = xmlnode_new_child(root,"contacts");
	g_return_if_fail(son!=NULL);
	son = xmlnode_new_child(son,"mobile-buddies");
	g_return_if_fail(son!=NULL);
	item = xmlnode_new_child(son,"mobile-buddy");
	g_return_if_fail(item!=NULL);


	xmlnode_set_attrib(item,"expose-mobile-no","1");
	xmlnode_set_attrib(item,"expose-name","1");
	xmlnode_set_attrib(item,"invite","1");

	xmlnode_set_attrib(item,"uri",buddy_name);
	xmlnode_set_attrib(item,"buddy-lists","1");
	//xmlnode_set_attrib(item,"desc",sip->mobileno);
	xmlnode_set_attrib(item,"desc",real_name);

	body = g_strdup_printf(xmlnode_to_str(root,&xml_len));
	purple_debug_info("fetion:","add_buddy:body=[%s]",body);

	send_sip_request(sip->gc,"S","","","N: AddMobileBuddy\r\n",body,NULL,(TransCallback) AddMobileBuddy_cb);

	g_free(buddy_name);
	xmlnode_free(root);
	g_free(body);


}
开发者ID:scljz,项目名称:fetion,代码行数:83,代码来源:f_buddy.c


示例16: skypeweb_close

static void
skypeweb_close(PurpleConnection *pc)
{
	SkypeWebAccount *sa;
	GSList *buddies;
	
	g_return_if_fail(pc != NULL);
	
	sa = purple_connection_get_protocol_data(pc);
	g_return_if_fail(sa != NULL);
	
	purple_timeout_remove(sa->authcheck_timeout);
	purple_timeout_remove(sa->poll_timeout);
	purple_timeout_remove(sa->watchdog_timeout);

	skypeweb_logout(sa);
	purple_signal_disconnect(purple_conversations_get_handle(), "conversation-updated", pc, PURPLE_CALLBACK(skypeweb_mark_conv_seen));
	purple_debug_info("skypeweb", "destroying %d waiting connections\n",
					  g_queue_get_length(sa->waiting_conns));
	
	while (!g_queue_is_empty(sa->waiting_conns))
		skypeweb_connection_destroy(g_queue_pop_tail(sa->waiting_conns));
	g_queue_free(sa->waiting_conns);
	
	purple_debug_info("skypeweb", "destroying %d incomplete connections\n",
			g_slist_length(sa->conns));

	while (sa->conns != NULL)
		skypeweb_connection_destroy(sa->conns->data);
		
	while (sa->dns_queries != NULL) {
		PurpleDnsQueryData *dns_query = sa->dns_queries->data;
		purple_debug_info("skypeweb", "canceling dns query for %s\n",
					purple_dnsquery_get_host(dns_query));
		sa->dns_queries = g_slist_remove(sa->dns_queries, dns_query);
		purple_dnsquery_destroy(dns_query);
	}

	while (sa->url_datas) {
		purple_util_fetch_url_cancel(sa->url_datas->data);
		sa->url_datas = g_slist_delete_link(sa->url_datas, sa->url_datas);
	}

	buddies = purple_find_buddies(sa->account, NULL);
	while (buddies != NULL) {
		PurpleBuddy *buddy = buddies->data;
		skypeweb_buddy_free(buddy);
		purple_buddy_set_protocol_data(buddy, NULL);
		buddies = g_slist_delete_link(buddies, buddies);
	}
	
	g_hash_table_destroy(sa->sent_messages_hash);
	g_hash_table_destroy(sa->cookie_table);
	g_hash_table_destroy(sa->hostname_ip_cache);
	
	g_free(sa->messages_host);
	g_free(sa->skype_token);
	g_free(sa->registration_token);
	g_free(sa->endpoint);
	g_free(sa->username);
	g_free(sa);
}
开发者ID:EduardoLeggiero,项目名称:skype4pidgin,代码行数:62,代码来源:libskypeweb.c


示例17: GetContactList_cb

gboolean GetContactList_cb(struct fetion_account_data *sip, struct sipmsg *msg, struct transaction *tc) 
{
	xmlnode *item, *group, *isc;
	const gchar *name_group,*group_id;
	PurpleBuddy *b;
	PurpleGroup *g = NULL;
	struct fetion_buddy *bs;
	struct group_attr *g_attr;
	gint len = msg->bodylen;

	purple_debug(PURPLE_DEBUG_MISC, "fetion", "in process GetContactList response response: %d\n", msg->response);
	switch (msg->response)
	{
		case 200:

			/*Convert the contact from XML to Purple Buddies*/
			isc = xmlnode_from_str(msg->body, len);
			purple_debug_info("fetion:","after xmlnode to str\n");
			group = xmlnode_get_child(isc,"contacts/buddy-lists");
			g_return_val_if_fail(group!=NULL,FALSE);

			/* ToDo. Find for all groups */
			sip->GetContactFlag = 1; 
			for((group = xmlnode_get_child(group, "buddy-list"));group;group = xmlnode_get_next_twin(group))
			{
				purple_debug_info("fetion:","buddy-list\n");
				name_group = xmlnode_get_attrib(group, "name");
				group_id = xmlnode_get_attrib(group, "id");
				g_return_val_if_fail(name_group!=NULL,FALSE);
				purple_debug_info("fetion", "name_group->%s\n", name_group);
				g = purple_find_group(name_group);
				if(!g)
				{
					g = purple_group_new(name_group);
				}
				g_attr= g_new0(struct group_attr,1);
				g_attr->name = g_strdup(name_group);
				g_attr->id = g_strdup(group_id);
				g_hash_table_insert(sip->group,g_attr->id,g_attr);
				g_hash_table_insert(sip->group2id,g_attr->name,g_attr);
			}


			group = xmlnode_get_child(isc,"contacts/buddies");
			g_return_val_if_fail(group!=NULL,FALSE);


			for(item = xmlnode_get_child(group, "buddy"); item; item = xmlnode_get_next_twin(item))
			{
				const gchar *uri, *name ;
				char *buddy_name;
				const gchar *g_id;
				uri = xmlnode_get_attrib(item, "uri");
				name = xmlnode_get_attrib(item, "local-name");
				g_id = xmlnode_get_attrib(item,"buddy-lists");

				buddy_name = g_strdup_printf("%s", uri);
				if((g_id==NULL) ||(*g_id=='\0')||strlen(g_id)>1)
				{
					g = purple_find_group("未分组");	
					if(!g)
						g = purple_group_new("未分组");
				}
				else
				{
					g_attr = g_hash_table_lookup(sip->group,g_id);
					g_return_val_if_fail(g_attr!=NULL,FALSE);
					g = purple_find_group(g_attr->name);

					if(!g)
						g = purple_group_new(g_attr->name);
				}

				b = purple_find_buddy(sip->account, buddy_name);
				if(!b){
					b = purple_buddy_new(sip->account, buddy_name, NULL);
				}
				g_free(buddy_name);

				purple_blist_add_buddy(b, NULL, g, NULL);
				if(name!=NULL && *name!='\0')
					purple_blist_alias_buddy(b, name);
				bs = g_new0(struct fetion_buddy, 1);
				bs->name = g_strdup(b->name);
				g_hash_table_insert(sip->buddies, bs->name, bs);

				purple_prpl_got_user_status(sip->account,uri,"mobile",NULL);

			}
			group = xmlnode_get_child(isc,"contacts/mobile-buddies");
			g_return_val_if_fail(group!=NULL,FALSE);



			for(item = xmlnode_get_child(group, "mobile-buddy"); item; item = xmlnode_get_next_twin(item))
			{
				const gchar *uri, *name ;
				gchar *buddy_name;
				const gchar *g_id;
				uri = xmlnode_get_attrib(item, "uri");
//.........这里部分代码省略.........
开发者ID:scljz,项目名称:fetion,代码行数:101,代码来源:f_buddy.c


示例18: cipher_test_aes

static void
cipher_test_aes(void)
{
	PurpleCipher *cipher;
	int i = 0;
	gboolean fail = FALSE;

	purple_debug_info("cipher-test", "Running AES tests\n");

	cipher = purple_aes_cipher_new();
	if (cipher == NULL) {
		purple_debug_error("cipher-test", "AES cipher not found\n");
		fail = TRUE;
	}

	while (!fail && aes_tests[i].cipher) {
		aes_test *test = &aes_tests[i];
		gsize key_size;
		guchar *key;
		guchar cipher_s[1024], decipher_s[1024];
		ssize_t cipher_len, decipher_len;
		gchar *cipher_b16, *deciphered;

		purple_debug_info("cipher-test", "Test %02d:\n", i);
		purple_debug_info("cipher-test", "\tTesting '%s' (%" G_GSIZE_FORMAT "bit) \n",
			test->plaintext ? test->plaintext : "(null)",
			strlen(test->key) * 8 / 2);

		i++;

		purple_cipher_reset(cipher);

		if (test->iv) {
			gsize iv_size;
			guchar *iv = purple_base16_decode(test->iv, &iv_size);
			g_assert(iv != NULL);
			purple_cipher_set_iv(cipher, iv, iv_size);
			g_free(iv);
		}

		key = purple_base16_decode(test->key, &key_size);
		g_assert(key != NULL);
		purple_cipher_set_key(cipher, key, key_size);
		g_free(key);

		if (purple_cipher_get_key_size(cipher) != key_size) {
			purple_debug_info("cipher-test", "\tinvalid key size\n");
			fail = TRUE;
			continue;
		}

		cipher_len = purple_cipher_encrypt(cipher,
			(const guchar*)(test->plaintext ? test->plaintext : ""),
			test->plaintext ? (strlen(test->plaintext) + 1) : 0,
			cipher_s, sizeof(cipher_s));
		if (cipher_len < 0) {
			purple_debug_info("cipher-test", "\tencryption failed\n");
			fail = TRUE;
			continue;
		}

		cipher_b16 = purple_base16_encode(cipher_s, cipher_len);

		purple_debug_info("cipher-test", "\tGot:          %s\n", cipher_b16);
		purple_debug_info("cipher-test", "\tWanted:       %s\n", test->cipher);

		if (g_strcmp0(cipher_b16, test->cipher) != 0) {
			purple_debug_info("cipher-test",
				"\tencrypted data doesn't match\n");
			g_free(cipher_b16);
			fail = TRUE;
			continue;
		}
		g_free(cipher_b16);

		decipher_len = purple_cipher_decrypt(cipher,
			cipher_s, cipher_len, decipher_s, sizeof(decipher_s));
		if (decipher_len < 0) {
			purple_debug_info("cipher-test", "\tdecryption failed\n");
			fail = TRUE;
			continue;
		}

		deciphered = (decipher_len > 0) ? (gchar*)decipher_s : NULL;

		if (g_strcmp0(deciphered, test->plaintext) != 0) {
			purple_debug_info("cipher-test",
				"\tdecrypted data doesn't match\n");
			fail = TRUE;
			continue;
		}

		purple_debug_info("cipher-test", "\tTest OK\n");
	}

	if (cipher != NULL)
		g_object_unref(cipher);

	if (fail)
		purple_debug_info("cipher-test", "AES tests FAILED\n\n");
//.........这里部分代码省略.........
开发者ID:N8Fear,项目名称:purple-facebook,代码行数:101,代码来源:ciphertest.c


示例19: purple_info

void purple_info(const std::string &msg)
{
    purple_debug_info(PLUGIN_ID, "%s\n", msg.c_str());
}
开发者ID:clapautius,项目名称:purple-rest,代码行数:4,代码来源:purple-interaction.cpp


示例20: ggp_avatar_buddy_update_next

/* return TRUE if avatar update was performed or there is no new requests,
   FALSE if we can request another one immediately */
static gboolean ggp_avatar_buddy_update_next(PurpleConnection *gc)
{
    PurpleHttpRequest *req;
    ggp_avatar_session_data *avdata = ggp_avatar_get_avdata(gc);
    GList *pending_update_it;
    ggp_avatar_buddy_update_req *pending_update;
    PurpleBuddy *buddy;
    PurpleAccount *account = purple_connection_get_account(gc);
    time_t old_timestamp;
    const char *old_timestamp_str;

    pending_update_it = g_list_first(avdata->pending_updates);
    if (pending_update_it == NULL)
        return TRUE;

    pending_update = pending_update_it->data;
    avdata->pending_updates = g_list_remove(avdata->pending_updates,
                                            pending_update);
    buddy = purple_blist_find_buddy(account, ggp_uin_to_str(pending_update->uin));

    if (!buddy) {
        if (ggp_str_to_uin(purple_account_get_username(account)) ==
                pending_update->uin)
        {
            purple_debug_misc("gg",
                              "ggp_avatar_buddy_update_next(%p): own "
                              "avatar update requested, but we don't have "
                              "ourselves on buddy list\n", gc);
        } else {
            purple_debug_warning("gg",
                                 "ggp_avatar_buddy_update_next(%p): "
                                 "%u update requested, but he's not on buddy "
                                 "list\n", gc, pending_update->uin);
        }
        return FALSE;
    }

    old_timestamp_str = purple_buddy_icons_get_checksum_for_user(buddy);
    old_timestamp = old_timestamp_str ? g_ascii_strtoull(
                        old_timestamp_str, NULL, 10) : 0;
    if (old_timestamp == pending_update->timestamp) {
        if (purple_debug_is_verbose()) {
            purple_debug_misc("gg",
                              "ggp_avatar_buddy_update_next(%p): "
                              "%u have up to date avatar with ts=%lu\n", gc,
                              pending_update->uin, pending_update->timestamp);
        }
        return FALSE;
    }
    if (old_timestamp > pending_update->timestamp) {
        purple_debug_warning("gg",
                             "ggp_avatar_buddy_update_next(%p): "
                             "saved timestamp for %u is newer than received "
                             "(%lu > %lu)\n", gc, pending_update->uin, old_timestamp,
                             pending_update->timestamp);
    }

    purple_debug_info("gg",
                      "ggp_avatar_buddy_update_next(%p): "
                      "updating %u with ts=%lu...\n", gc, pending_update->uin,
                      pending_update->timestamp);

    pending_update->gc = gc;
    avdata->current_update = pending_update;

    req = purple_http_request_new(NULL);
    purple_http_request_set_url_printf(req, GGP_AVATAR_BUDDY_URL,
                                       pending_update->uin);
    purple_http_request_header_set(req, "User-Agent", GGP_AVATAR_USERAGENT);
    purple_http_request_set_max_len(req, GGP_AVATAR_SIZE_MAX);
    pending_update->request = purple_http_request(gc, req,
                              ggp_avatar_buddy_update_received, pending_update);
    purple_http_request_unref(req);

    return TRUE;
}
开发者ID:N8Fear,项目名称:purple-facebook,代码行数:78,代码来源:avatar.c



注:本文中的purple_debug_info函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ purple_debug_is_verbose函数代码示例发布时间:2022-05-30
下一篇:
C++ purple_debug_error函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap