本文整理汇总了C++中purple_debug_info函数的典型用法代码示例。如果您正苦于以下问题:C++ purple_debug_info函数的具体用法?C++ purple_debug_info怎么用?C++ purple_debug_info使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了purple_debug_info函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
}
示例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 */
//.........这里部分代码省略.........
示例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));
}
示例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;
}
示例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");
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例11: purplemot_register_user
static void
purplemot_register_user(PurpleAccount *acct)
{
purple_debug_info("purplemot", "registering account for %s\n",
acct->username);
}
示例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);
}
示例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);
}
示例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, ×tamp)) {
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, ×tamp)) {
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, ×tamp)) {
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, ×tamp)) {
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);
}
}
//.........这里部分代码省略.........
示例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);
}