本文整理汇总了C++中purple_account_get_string函数的典型用法代码示例。如果您正苦于以下问题:C++ purple_account_get_string函数的具体用法?C++ purple_account_get_string怎么用?C++ purple_account_get_string使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了purple_account_get_string函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: twitter_get_subdir_from_base
const gchar *twitter_option_search_api_subdir(PurpleAccount * account)
{
if (!strcmp(purple_account_get_protocol_id(account), TWITTER_PROTOCOL_ID)) {
return twitter_get_subdir_from_base(purple_account_get_string(account, TWITTER_PREF_SEARCH_API_BASE, TWITTER_PREF_SEARCH_API_BASE_DEFAULT));
} else {
return twitter_get_subdir_from_base(purple_account_get_string(account, TWITTER_PREF_SEARCH_API_BASE, STATUSNET_PREF_API_BASE_DEFAULT));
}
}
示例2: fb_data_load
gboolean
fb_data_load(FbData *fata)
{
const gchar *str;
FbDataPrivate *priv;
FbId id;
gboolean ret = TRUE;
guint i;
guint64 uint;
GValue val = G_VALUE_INIT;
PurpleAccount *acct;
g_return_val_if_fail(FB_IS_DATA(fata), FALSE);
priv = fata->priv;
acct = purple_connection_get_account(priv->gc);
for (i = 0; i < G_N_ELEMENTS(fb_props_strs); i++) {
str = purple_account_get_string(acct, fb_props_strs[i], NULL);
if (str == NULL) {
ret = FALSE;
}
g_value_init(&val, G_TYPE_STRING);
g_value_set_string(&val, str);
g_object_set_property(G_OBJECT(priv->api), fb_props_strs[i],
&val);
g_value_unset(&val);
}
str = purple_account_get_string(acct, "mid", NULL);
if (str != NULL) {
uint = g_ascii_strtoull(str, NULL, 10);
g_value_init(&val, G_TYPE_UINT64);
g_value_set_uint64(&val, uint);
g_object_set_property(G_OBJECT(priv->api), "mid", &val);
g_value_unset(&val);
} else {
ret = FALSE;
}
str = purple_account_get_string(acct, "uid", NULL);
if (str != NULL) {
id = FB_ID_FROM_STR(str);
g_value_init(&val, FB_TYPE_ID);
g_value_set_int64(&val, id);
g_object_set_property(G_OBJECT(priv->api), "uid", &val);
g_value_unset(&val);
} else {
ret = FALSE;
}
fb_api_rehash(priv->api);
return ret;
}
示例3: purple_account_get_string
void IdenticaProtocol::onDestroy(User *user) {
PurpleAccount *account = user->account();
if (account == NULL)
return;
user->updateSetting<std::string>("twitter_oauth_secret", purple_account_get_string(account, "twitter_oauth_secret", ""));
user->updateSetting<std::string>("twitter_oauth_token", purple_account_get_string(account, "twitter_oauth_token", ""));
user->updateSetting<std::string>("twitter_sent_msg_ids", purple_account_get_string(account, "twitter_sent_msg_ids", ""));
user->updateSetting<std::string>("twitter_last_msg_id", purple_account_get_string(account, "twitter_last_msg_id", ""));
}
示例4: flist_update_server_status
void flist_update_server_status(FListAccount *fla) {
JsonObject *json = json_object_new();
const gchar *status = purple_account_get_string(fla->pa, "_status", "online");
const gchar *status_message = purple_account_get_string(fla->pa, "_status_message", "");
json_object_set_string_member(json, "status", status);
json_object_set_string_member(json, "statusmsg", status_message);
flist_request(fla->pc, FLIST_SET_STATUS, json);
json_object_unref(json);
}
示例5: do_login
static gboolean do_login(PurpleConnection *gc) {
char *buf, *tmp = NULL;
char hostname[256];
const char *username, *realname;
struct irc_conn *irc = gc->proto_data;
const char *pass = purple_connection_get_password(gc);
if (pass && *pass) {
buf = irc_format(irc, "vv", "PASS", pass);
if (irc_send(irc, buf) < 0) {
/* purple_connection_error(gc, "Error sending password"); */
g_free(buf);
return FALSE;
}
g_free(buf);
}
gethostname(hostname, sizeof(hostname));
hostname[sizeof(hostname) - 1] = '\0';
realname = purple_account_get_string(irc->account, "realname", "");
username = purple_account_get_string(irc->account, "username", "");
if (username == NULL || *username == '\0') {
username = g_get_user_name();
}
if (username != NULL && strchr(username, ' ') != NULL) {
tmp = g_strdup(username);
while ((buf = strchr(tmp, ' ')) != NULL) {
*buf = '_';
}
}
buf = irc_format(irc, "vvvv:", "USER", tmp ? tmp : username, hostname, irc->server,
strlen(realname) ? realname : IRC_DEFAULT_ALIAS);
g_free(tmp);
if (irc_send(irc, buf) < 0) {
/* purple_connection_error(gc, "Error registering with server");*/
g_free(buf);
return FALSE;
}
g_free(buf);
buf = irc_format(irc, "vn", "NICK", purple_connection_get_display_name(gc));
if (irc_send(irc, buf) < 0) {
/* purple_connection_error(gc, "Error sending nickname");*/
g_free(buf);
return FALSE;
}
g_free(buf);
irc->recv_time = time(NULL);
return TRUE;
}
示例6: g_tree_new
static GString *purple_fbapi_construct_request_vargs(PurpleAccount *account, const char *method, va_list args)
{
GTree *params;
const char *api_key, *api_secret;
const char *key, *value;
char call_id[21];
char *signature;
GString *body;
/* Read all paramters into a sorted tree */
params = g_tree_new((GCompareFunc)strcmp);
while ((key = va_arg(args, const char *)) != NULL)
{
value = va_arg(args, const char *);
g_tree_insert(params, (char *)key, (char *)value);
/* If we have a session_key then we need a call_id */
if (g_str_equal(key, "session_key")) {
struct timeval tv;
if (gettimeofday(&tv, NULL) != 0) {
time_t now;
purple_debug_error("fbapi",
"Error calling gettimeofday(): %s\n",
g_strerror(errno));
now = time(NULL);
strftime(call_id, sizeof(call_id), "%s000000", localtime(&now));
} else {
char tmp[22];
strftime(tmp, sizeof(tmp), "%s", localtime(&tv.tv_sec));
sprintf(call_id, "%s%06lu", tmp, (long unsigned int)tv.tv_usec);
}
g_tree_insert(params, "call_id", call_id);
}
}
api_key = purple_account_get_string(account, "fb_api_key", PURPLE_FBAPI_KEY);
api_secret = purple_account_get_string(account, "fb_api_secret", API_SECRET);
/* Add the method and api_key parameters to the list */
g_tree_insert(params, "method", (char *)method);
g_tree_insert(params, "api_key", (char *)api_key);
/* Add the signature parameter to the list */
signature = generate_signature((char *)api_secret, params);
g_tree_insert(params, "sig", signature);
/* Construct the body of the HTTP POST request */
body = g_string_new(NULL);
g_tree_foreach(params, append_params_to_body, body);
g_tree_destroy(params);
g_free(signature);
return body;
}
示例7: waprpl_login
static void waprpl_login(PurpleAccount * acct)
{
PurpleConnection *gc = purple_account_get_connection(acct);
purple_debug_info(WHATSAPP_ID, "logging in %s\n", purple_account_get_username(acct));
purple_connection_update_progress(gc, "Connecting", 0, 4);
whatsapp_connection *wconn = g_new0(whatsapp_connection, 1);
wconn->fd = -1;
wconn->sslfd = -1;
wconn->account = acct;
wconn->rh = 0;
wconn->wh = 0;
wconn->timer = 0;
wconn->connected = 0;
wconn->conv_id = 1;
wconn->gsc = 0;
wconn->sslrh = 0;
wconn->sslwh = 0;
const char *username = purple_account_get_username(acct);
const char *password = purple_account_get_password(acct);
const char *nickname = purple_account_get_string(acct, "nick", "");
wconn->waAPI = waAPI_create(username, password, nickname);
purple_connection_set_protocol_data(gc, wconn);
const char *hostname = purple_account_get_string(acct, "server", "");
int port = purple_account_get_int(acct, "port", WHATSAPP_DEFAULT_PORT);
char hn[256];
if (strlen(hostname) == 0) {
sprintf(hn, "e%d.whatsapp.net", rand() % 9 + 1);
hostname = hn;
}
if (purple_proxy_connect(gc, acct, hostname, port, waprpl_connect_cb, gc) == NULL) {
purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, "Unable to connect");
}
static int sig_con = 0;
if (!sig_con) {
sig_con = 1;
purple_signal_connect(purple_blist_get_handle(), "blist-node-removed", _whatsapp_protocol, PURPLE_CALLBACK(waprpl_blist_node_removed), NULL);
purple_signal_connect(purple_blist_get_handle(), "blist-node-added", _whatsapp_protocol, PURPLE_CALLBACK(waprpl_blist_node_added), NULL);
}
}
示例8: purple_buddy_icons_set_account_icon
PurpleStoredImage *
purple_buddy_icons_set_account_icon(PurpleAccount *account,
guchar *icon_data, size_t icon_len)
{
PurpleStoredImage *old_img;
PurpleStoredImage *img = NULL;
char *old_icon;
if (icon_data != NULL && icon_len > 0)
{
img = purple_buddy_icon_data_new(icon_data, icon_len, NULL);
}
old_icon = g_strdup(purple_account_get_string(account, "buddy_icon", NULL));
if (img && purple_buddy_icons_is_caching())
{
const char *filename = purple_imgstore_get_filename(img);
purple_account_set_string(account, "buddy_icon", filename);
purple_account_set_int(account, "buddy_icon_timestamp", time(NULL));
ref_filename(filename);
}
else
{
purple_account_set_string(account, "buddy_icon", NULL);
purple_account_set_int(account, "buddy_icon_timestamp", 0);
}
unref_filename(old_icon);
old_img = g_hash_table_lookup(pointer_icon_cache, account);
if (img)
g_hash_table_insert(pointer_icon_cache, account, img);
else
g_hash_table_remove(pointer_icon_cache, account);
if (purple_account_is_connected(account))
{
PurpleConnection *gc;
PurplePluginProtocolInfo *prpl_info;
gc = purple_account_get_connection(account);
prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(purple_connection_get_prpl(gc));
if (prpl_info && prpl_info->set_buddy_icon)
prpl_info->set_buddy_icon(gc, img);
}
if (old_img)
purple_imgstore_unref(old_img);
else if (old_icon)
{
/* The old icon may not have been loaded into memory. In that
* case, we'll need to uncache the filename. The filenames
* are ref-counted, so this is safe. */
purple_buddy_icon_data_uncache_file(old_icon);
}
g_free(old_icon);
return img;
}
示例9: purple_buddy_icons_find_account_icon
PurpleStoredImage *
purple_buddy_icons_find_account_icon(PurpleAccount *account)
{
PurpleStoredImage *img;
const char *account_icon_file;
const char *dirname;
char *path;
guchar *data;
size_t len;
g_return_val_if_fail(account != NULL, NULL);
if ((img = g_hash_table_lookup(pointer_icon_cache, account)))
{
return purple_imgstore_ref(img);
}
account_icon_file = purple_account_get_string(account, "buddy_icon", NULL);
if (account_icon_file == NULL)
return NULL;
dirname = purple_buddy_icons_get_cache_dir();
path = g_build_filename(dirname, account_icon_file, NULL);
if (read_icon_file(path, &data, &len))
{
g_free(path);
img = purple_buddy_icons_set_account_icon(account, data, len);
return purple_imgstore_ref(img);
}
g_free(path);
return NULL;
}
示例10: silcpurple_idle_set
void silcpurple_idle_set(PurpleConnection *gc, int idle)
{
SilcPurple sg;
SilcClient client;
SilcClientConnection conn;
SilcAttributeObjService service;
const char *server;
int port;
sg = gc->proto_data;
if (sg == NULL)
return;
client = sg->client;
if (client == NULL)
return;
conn = sg->conn;
if (conn == NULL)
return;
server = purple_account_get_string(sg->account, "server",
"silc.silcnet.org");
port = purple_account_get_int(sg->account, "port", 706),
memset(&service, 0, sizeof(service));
silc_client_attribute_del(client, conn,
SILC_ATTRIBUTE_SERVICE, NULL);
service.port = port;
g_snprintf(service.address, sizeof(service.address), "%s", server);
service.idle = idle;
silc_client_attribute_add(client, conn, SILC_ATTRIBUTE_SERVICE,
&service, sizeof(service));
}
示例11: waprpl_send_chat
static int waprpl_send_chat(PurpleConnection * gc, int id, const char *message, PurpleMessageFlags flags)
{
whatsapp_connection *wconn = purple_connection_get_protocol_data(gc);
PurpleAccount *account = purple_connection_get_account(gc);
PurpleConversation *convo = purple_find_chat(gc, id);
PurpleChat *ch = blist_find_chat_by_convo(gc, id);
GHashTable *hasht = purple_chat_get_components(ch);
char *chat_id = g_hash_table_lookup(hasht, "id");
char *plain;
purple_markup_html_to_xhtml(message, NULL, &plain);
char msgid[128];
waAPI_getmsgid(wconn->waAPI, msgid);
purple_signal_emit(purple_connection_get_prpl(gc), "whatsapp-sending-message", gc, msgid, chat_id, message);
waAPI_sendchat(wconn->waAPI, msgid, chat_id, plain);
g_free(plain);
waprpl_check_output(gc);
const char *me = purple_account_get_string(account, "nick", "");
purple_conv_chat_write(PURPLE_CONV_CHAT(convo), me, message, PURPLE_MESSAGE_SEND, time(NULL));
return 1;
}
示例12: account
AccountWindow::StringListOption::StringListOption(PurpleAccount *account_,
PurpleAccountOption *option_)
: account(account_), option(option_)
{
g_assert(account);
g_assert(option);
setText(purple_account_option_get_text(option));
const char *def = purple_account_get_string(account,
purple_account_option_get_setting(option),
purple_account_option_get_default_list_value(option));
for (GList *l = purple_account_option_get_list(option); l; l = l->next)
if (l->data) {
PurpleKeyValuePair *kvp = reinterpret_cast<PurpleKeyValuePair*>(
l->data);
addOptionPtr(kvp->key, kvp->value);
if (kvp->value && def
&& !strcmp(def, reinterpret_cast<const char*>(kvp->value)))
setSelectedByDataPtr(kvp->value);
}
signal_selection_changed.connect(sigc::mem_fun(this,
&StringListOption::onSelectionChanged));
}
示例13: purple_account_get_string
static char *gaym_send_convert(struct gaym_conn *gaym, const char *string)
{
char *utf8;
GError *err = NULL;
const gchar *charset;
charset =
purple_account_get_string(gaym->account, "encoding",
IRC_DEFAULT_CHARSET);
if (!strcasecmp("UTF-8", charset))
return g_strdup(string);
utf8 =
g_convert(string, strlen(string), charset, "UTF-8", NULL, NULL,
&err);
if (err) {
purple_debug(PURPLE_DEBUG_ERROR, "gaym", "Send conversion error: %s\n",
err->message);
purple_debug(PURPLE_DEBUG_ERROR, "gaym",
"Sending as UTF-8 instead of %s\n", charset);
utf8 = g_strdup(string);
g_error_free(err);
}
return utf8;
}
示例14: get_string_setting
static VALUE get_string_setting(VALUE self, VALUE name, VALUE default_value)
{
PurpleAccount *account;
Data_Get_Struct(self, PurpleAccount, account);
const char* value = purple_account_get_string(account, RSTRING_PTR(name), RSTRING_PTR(default_value));
return (NULL == value) ? Qnil : rb_str_new2(value);
}
示例15: purple_account_get_string
static char *irc_send_convert(struct irc_conn *irc, const char *string)
{
char *utf8;
GError *err = NULL;
gchar **encodings;
const gchar *enclist;
enclist = purple_account_get_string(irc->account, "encoding", IRC_DEFAULT_CHARSET);
encodings = g_strsplit(enclist, ",", 2);
if (encodings[0] == NULL || !g_ascii_strcasecmp("UTF-8", encodings[0])) {
g_strfreev(encodings);
return NULL;
}
utf8 = g_convert(string, strlen(string), encodings[0], "UTF-8", NULL, NULL, &err);
if (err) {
purple_debug(PURPLE_DEBUG_ERROR, "irc", "Send conversion error: %s\n", err->message);
purple_debug(PURPLE_DEBUG_ERROR, "irc", "Sending as UTF-8 instead of %s\n", encodings[0]);
utf8 = g_strdup(string);
g_error_free(err);
}
g_strfreev(encodings);
return utf8;
}