本文整理汇总了C++中purple_account_get_username函数的典型用法代码示例。如果您正苦于以下问题:C++ purple_account_get_username函数的具体用法?C++ purple_account_get_username怎么用?C++ purple_account_get_username使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了purple_account_get_username函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: discover_status
static void discover_status(PurpleConnection *from, PurpleConnection *to,
gpointer userdata) {
const char *from_username = purple_account_get_username(purple_connection_get_account(from));
const char *to_username = purple_account_get_username(purple_connection_get_account(to));
if (purple_blist_find_buddy(purple_connection_get_account(from), to_username)) {
PurpleStatus *status = purple_account_get_active_status(purple_connection_get_account(to));
const char *status_id = purple_status_get_id(status);
const char *message = purple_status_get_attr_string(status, "message");
if (!strcmp(status_id, NULL_STATUS_ONLINE) ||
!strcmp(status_id, NULL_STATUS_AWAY) ||
!strcmp(status_id, NULL_STATUS_OFFLINE)) {
purple_debug_info("nullprpl", "%s sees that %s is %s: %s\n",
from_username, to_username, status_id, message);
purple_prpl_got_user_status(purple_connection_get_account(from), to_username, status_id,
(message) ? "message" : NULL, message, NULL);
} else {
purple_debug_error("nullprpl",
"%s's buddy %s has an unknown status: %s, %s",
from_username, to_username, status_id, message);
}
}
}
示例2: signing_on_cb
static void
signing_on_cb(PurpleConnection *gc)
{
if (!console)
return;
gtk_combo_box_append_text(GTK_COMBO_BOX(console->dropdown), purple_account_get_username(gc->account));
console->accounts = g_list_append(console->accounts, gc);
console->count++;
if (console->count == 1)
console->gc = gc;
else
gtk_widget_show_all(console->hbox);
}
示例3: purple_account_get_username
static PurpleRoomlist *nullprpl_roomlist_get_list(PurpleConnection *gc) {
const char *username = purple_account_get_username(purple_connection_get_account(gc));
PurpleRoomlist *roomlist = purple_roomlist_new(purple_connection_get_account(gc));
GList *fields = NULL;
PurpleRoomlistField *field;
GList *chats;
GList *seen_ids = NULL;
purple_debug_info("nullprpl", "%s asks for room list; returning:\n", username);
/* set up the room list */
field = purple_roomlist_field_new(PURPLE_ROOMLIST_FIELD_STRING, "room",
"room", TRUE /* hidden */);
fields = g_list_append(fields, field);
field = purple_roomlist_field_new(PURPLE_ROOMLIST_FIELD_INT, "Id", "Id", FALSE);
fields = g_list_append(fields, field);
purple_roomlist_set_fields(roomlist, fields);
/* add each chat room. the chat ids are cached in seen_ids so that each room
* is only returned once, even if multiple users are in it. */
for (chats = purple_conversations_get_chats(); chats; chats = g_list_next(chats)) {
PurpleChatConversation *chat = PURPLE_CHAT_CONVERSATION(chats->data);
PurpleRoomlistRoom *room;
const char *name = purple_conversation_get_name(PURPLE_CONVERSATION(chat));
int id = purple_chat_conversation_get_id(chat);
/* have we already added this room? */
if (g_list_find_custom(seen_ids, name, (GCompareFunc)strcmp))
continue; /* yes! try the next one. */
/* This cast is OK because this list is only staying around for the life
* of this function and none of the conversations are being deleted
* in that timespan. */
seen_ids = g_list_prepend(seen_ids, (char *)name); /* no, it's new. */
purple_debug_info("nullprpl", "%s (%d), ", name, 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, &id);
purple_roomlist_room_add(roomlist, room);
}
g_list_free(seen_ids);
purple_timeout_add(1 /* ms */, nullprpl_finish_get_roomlist, g_object_ref(roomlist));
return roomlist;
}
示例4: _h_elim_set_icon
xmlnode * _h_elim_set_icon ( const char *name ,
const char *id ,
SEXP_VALUE *args ,
gpointer data )
{
ASSERT_ALISTP( args, id, name );
elim_ping();
const char *aname = ALIST_VAL_STR ( args, "account-name" );
const char *proto = ALIST_VAL_STR ( args, "im-protocol" );
gpointer auid = ALIST_VAL_PTR ( args, "account-uid" );
const char *file = ALIST_VAL_STR ( args, "icon-file" );
GString *img = ALIST_VAL_DATA( args, "icon-data" );
gchar *bytes = NULL;
gsize len = 0;
gpointer set = NULL;
PurpleAccount *acct =
auid ? find_acct_by_uid( auid ) : purple_accounts_find( aname, proto );
if( !acct )
{
sexp_val_free( args );
return response_error( ENXIO, id, name, "unknown account" );
}
if( !img && file && *file )
{
g_file_get_contents( file, &bytes, &len, NULL );
}
else if( img )
{
bytes = g_memdup( img->str, img->len );
len = img->len;
}
// the imgstore owns `bytes' after this, don't free it:
set = purple_buddy_icons_set_account_icon( acct, (guchar *)bytes, len );
xmlnode *rval = xnode_new( "alist" );
AL_PTR ( rval, "account-uid" , acct );
AL_STR ( rval, "account-name", purple_account_get_username ( acct ) );
AL_STR ( rval, "im-protocol" , purple_account_get_protocol_id( acct ) );
AL_BOOL( rval, "has-icon" , set ? TRUE : FALSE );
sexp_val_free( args );
return response_value( 0, id, name, rval );
}
示例5: set_account_idle
static void
set_account_idle(PurpleAccount *account, int time_idle)
{
PurplePresence *presence;
presence = purple_account_get_presence(account);
if (purple_presence_is_idle(presence))
/* This account is already idle! */
return;
purple_debug_info("idle", "Setting %s idle %d seconds\n",
purple_account_get_username(account), time_idle);
purple_presence_set_idle(presence, TRUE, time(NULL) - time_idle);
idled_accts = g_list_prepend(idled_accts, account);
}
示例6: qq_account_new
qq_account* qq_account_new(PurpleAccount* account)
{
qq_account* ac = g_malloc0(sizeof(qq_account));
ac->account = account;
ac->magic = QQ_MAGIC;
ac->flag = 0;
// this is auto increment sized array . so don't worry about it.
const char* username = purple_account_get_username(account);
const char* password = purple_account_get_password(account);
ac->qq = lwqq_client_new(username, password);
ac->js = lwqq_js_init();
ac->sys_log = purple_log_new(PURPLE_LOG_SYSTEM, "system", account, NULL,
time(NULL), NULL);
// add ~/.config/lwqq into search path
lwqq_util_add_path(lwdb_get_config_dir());
#ifdef WITH_MOZJS
lwqq_hash_add_entry(ac->qq, "hash_local", (LwqqHashFunc)hash_with_local_file,
ac->js);
lwqq_hash_add_entry(ac->qq, "hash_url", (LwqqHashFunc)hash_with_remote_file,
ac->js);
lwqq_hash_add_entry(ac->qq, "hash_db", (LwqqHashFunc)hash_with_db_url, ac);
#endif
ac->font.family = s_strdup("宋体");
ac->font.size = 12;
ac->font.style = 0;
// lwqq_async_set(ac->qq,1);
#if QQ_USE_FAST_INDEX
ac->qq->find_buddy_by_uin = find_buddy_by_uin;
ac->qq->find_buddy_by_qqnumber = find_buddy_by_qqnumber;
ac->fast_index.uin_index
= g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free);
ac->fast_index.qqnum_index
= g_hash_table_new_full(g_str_hash, g_str_equal, g_free, NULL);
#endif
ac->qq->dispatch = qq_dispatch;
char cookie[256];
snprintf(cookie, sizeof(cookie), "%s/%s.cookie", lwdb_get_config_dir(),
username);
LwqqExtension* ext = lwqq_make_cookie_extension(ac->qq, cookie);
ext->init(ac->qq, ext);
return ac;
}
示例7: set_account_unidle
static void
set_account_unidle(PurpleAccount *account)
{
PurplePresence *presence;
presence = purple_account_get_presence(account);
idled_accts = g_list_remove(idled_accts, account);
if (!purple_presence_is_idle(presence))
/* This account is already unidle! */
return;
purple_debug_info("idle", "Setting %s unidle\n",
purple_account_get_username(account));
purple_presence_set_idle(presence, FALSE, 0);
}
示例8: _h_elim_buddy_info
xmlnode * _h_elim_buddy_info ( const char *name ,
const char *id ,
SEXP_VALUE *args ,
gpointer data )
{
ASSERT_ALISTP( args, id, name );
PurpleAccount *acct = NULL;
PurpleConnection *conn = NULL;
gpointer a_uid = NULL;
gpointer b_uid = ALIST_VAL_PTR( args, "bnode-uid" );
PurpleBlistNode *bnode = find_blist_node_by_uid( b_uid, TRUE );
PurpleBlistNodeType bt = PURPLE_BLIST_OTHER_NODE;
if( !bnode )
HANDLER_FAIL( args, id, name, ENOENT, "no such buddy" );
bt = purple_blist_node_get_type( bnode );
switch( bt )
{
case PURPLE_BLIST_BUDDY_NODE:
a_uid = purple_buddy_get_account( (PurpleBuddy *)bnode );
break;
default:
HANDLER_FAIL( args, id, name, EINVAL, "unsupported buddy type" );
break;
}
FETCH_ACCOUNT( args, id, name, acct, a_uid );
conn = purple_account_get_connection( acct );
if( !conn )
HANDLER_FAIL( args, id, name, ENXIO, "account disconnected" );
xmlnode *rval = xnode_new( "alist" );
AL_PTR ( rval, "bnode-uid" , bnode );
AL_PTR ( rval, "account-uid" , acct );
AL_STR ( rval, "account-name", purple_account_get_username ( acct ) );
AL_STR ( rval, "im-protocol" , purple_account_get_protocol_id( acct ) );
serv_get_info( conn, purple_buddy_get_name( (PurpleBuddy *)bnode ) );
sexp_val_free( args );
return response_value( 0, id, name, rval );
}
示例9: insert_cap_failure
static void insert_cap_failure(CapStatistics *stats) {
gchar *buddy_name = stats->buddy->name;
const gchar *protocol_id = purple_account_get_protocol_id(stats->buddy->account);
const gchar *account_id = purple_account_get_username(stats->buddy->account);
const gchar *status_id = (stats->last_message_status_id) ?
stats->last_message_status_id :
purple_status_get_id(get_status_for(stats->buddy));
struct tm *current_time = localtime(&stats->last_message);
int minute = current_time->tm_min + current_time->tm_hour * 60;
insert_cap_msg_count_failed(buddy_name, account_id, protocol_id, minute);
insert_cap_status_count_failed(buddy_name, account_id, protocol_id, status_id);
stats->last_message = -1;
stats->last_message_status_id = NULL;
}
示例10: msn_show_sync_issue
void
msn_show_sync_issue(MsnSession *session, const char *passport,
const char *group_name)
{
PurpleConnection *gc;
PurpleAccount *account;
MsnAddRemData *data;
char *msg, *reason;
account = session->account;
gc = purple_account_get_connection(account);
data = g_new0(MsnAddRemData, 1);
data->who = g_strdup(passport);
data->group = g_strdup(group_name);
data->gc = gc;
msg = g_strdup_printf(_("Buddy list synchronization issue in %s (%s)"),
purple_account_get_username(account),
purple_account_get_protocol_name(account));
if (group_name != NULL)
{
reason = g_strdup_printf(_("%s on the local list is "
"inside the group \"%s\" but not on "
"the server list. "
"Do you want this buddy to be added?"),
passport, group_name);
}
else
{
reason = g_strdup_printf(_("%s is on the local list but "
"not on the server list. "
"Do you want this buddy to be added?"),
passport);
}
purple_request_action(gc, NULL, msg, reason, PURPLE_DEFAULT_ACTION_NONE,
purple_connection_get_account(gc), data->who, NULL,
data, 2,
_("Yes"), G_CALLBACK(msn_add_cb),
_("No"), G_CALLBACK(msn_rem_cb));
g_free(reason);
g_free(msg);
}
示例11: tgprpl_login
static void tgprpl_login (PurpleAccount * acct) {
debug ("tgprpl_login()\n");
PurpleConnection *gc = purple_account_get_connection(acct);
char const *username = purple_account_get_username(acct);
struct tgl_state *TLS = tgl_state_alloc ();
const char *dir = config_dir;
struct passwd *pw = getpwuid(getuid());
size_t len = strlen (dir) + strlen (pw->pw_dir) + 2 + strlen (username);
TLS->base_path = malloc (len);
snprintf (TLS->base_path, len, "%s/%s/%s", pw->pw_dir, dir, username);
debug ("base configuration path: '%s'", TLS->base_path);
g_mkdir_with_parents(TLS->base_path, 0700);
len += strlen ("/downloads");
char *ddir = malloc (len);
sprintf (ddir, "%s/downloads", TLS->base_path);
tgl_set_download_directory (TLS, ddir);
g_mkdir_with_parents(ddir, 0700);
free (ddir);
tgl_set_verbosity (TLS, 4);
tgl_set_rsa_key (TLS, pk_path);
// create handle to store additional info for libpurple in
// the new telegram instance
telegram_conn *conn = g_new0(telegram_conn, 1);
conn->TLS = TLS;
conn->gc = gc;
conn->pa = acct;
conn->new_messages = g_queue_new ();
conn->joining_chats = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free);
purple_connection_set_protocol_data (gc, conn);
tgl_set_ev_base (TLS, conn);
tgl_set_net_methods (TLS, &tgp_conn_methods);
tgl_set_timer_methods (TLS, &tgp_timers);
tgl_set_callback (TLS, &tgp_callback);
tgl_register_app_id (TLS, TGP_APP_ID, TGP_APP_HASH);
tgl_init (TLS);
purple_connection_set_state (conn->gc, PURPLE_CONNECTING);
telegram_login (TLS);
}
示例12: mxit_create_object
/*------------------------------------------------------------------------
* Create a new mxit session object
*
* @return The MXit session object
*/
static struct MXitSession* mxit_create_object( PurpleAccount* account )
{
PurpleConnection* con = purple_account_get_connection( account );
struct MXitSession* session = NULL;
/* currently the wapsite does not handle a '+' in front of the username (mxitid) so we just strip it */
{
const char* username = purple_account_get_username( account );
if ( username[0] == '+' ) {
char* fixed = g_strdup( &username[1] );
purple_account_set_username( account, fixed );
g_free( fixed );
}
}
session = g_new0( struct MXitSession, 1 );
session->con = con;
session->acc = account;
/* configure the connection (reference: "libpurple/connection.h") */
purple_connection_set_protocol_data( con, session );
purple_connection_set_flags( con,
PURPLE_CONNECTION_FLAG_NO_BGCOLOR
| PURPLE_CONNECTION_FLAG_NO_URLDESC
| PURPLE_CONNECTION_FLAG_HTML
| PURPLE_CONNECTION_FLAG_SUPPORT_MOODS
);
/* configure the session (reference: "libpurple/account.h") */
g_strlcpy( session->server, purple_account_get_string( account, MXIT_CONFIG_SERVER_ADDR, DEFAULT_SERVER ), sizeof( session->server ) );
g_strlcpy( session->http_server, purple_account_get_string( account, MXIT_CONFIG_HTTPSERVER, DEFAULT_HTTP_SERVER ), sizeof( session->http_server ) );
session->port = purple_account_get_int( account, MXIT_CONFIG_SERVER_PORT, DEFAULT_PORT );
g_strlcpy( session->distcode, purple_account_get_string( account, MXIT_CONFIG_DISTCODE, "" ), sizeof( session->distcode ) );
g_strlcpy( session->clientkey, purple_account_get_string( account, MXIT_CONFIG_CLIENTKEY, "" ), sizeof( session->clientkey ) );
g_strlcpy( session->dialcode, purple_account_get_string( account, MXIT_CONFIG_DIALCODE, "" ), sizeof( session->dialcode ) );
session->http = purple_account_get_bool( account, MXIT_CONFIG_USE_HTTP, FALSE );
session->iimages = g_hash_table_new( g_str_hash, g_str_equal );
session->rx_state = RX_STATE_RLEN;
session->http_interval = MXIT_HTTP_POLL_MIN;
session->http_last_poll = mxit_now_milli();
session->async_http_reqs = purple_http_connection_set_new();
return session;
}
示例13: set_chat_topic_fn
static void set_chat_topic_fn(PurpleChatConversation *from, PurpleChatConversation *to,
int id, const char *room, gpointer userdata) {
const char *topic = (const char *)userdata;
const char *username = purple_account_get_username(purple_conversation_get_account(PURPLE_CONVERSATION(from)));
char *msg;
purple_chat_conversation_set_topic(to, username, topic);
if (topic && *topic)
msg = g_strdup_printf(_("%s sets topic to: %s"), username, topic);
else
msg = g_strdup_printf(_("%s clears topic"), username);
purple_conversation_write_message(PURPLE_CONVERSATION(to), username, msg,
PURPLE_MESSAGE_SYSTEM | PURPLE_MESSAGE_NO_LOG,
time(NULL));
g_free(msg);
}
示例14: connection_error_cb
static void
connection_error_cb(PurpleConnection *gc, PurpleConnectionError err,
const gchar *desc, void *data)
{
char* growl_msg;
PurpleAccount* account = purple_connection_get_account(gc);
const gchar *username = purple_account_get_username(account);
int len = s_strlen((char*)desc) + s_strlen((char*)username) + 2 ;
DEBUG_MSG("connection_error_cb\n");
growl_msg = malloc( len);
g_snprintf(growl_msg, len, "%s\n%s", desc, username);
gntp_notify("connection-error", NULL, "Connection Error", growl_msg, NULL);
free(growl_msg);
}
示例15: main
int main (int argc, char **argv)
{
GList *alist, *node;
purple_init();
alist = purple_accounts_get_all();
for (node = alist; node != NULL; node = node->next)
{
PurpleAccount *account = (PurpleAccount*) node->data;
char *name = purple_account_get_username(account);
g_print("Name: %s\n", name);
g_free(name);
}
g_list_free(alist);
return 0;
}