本文整理汇总了C++中purple_timeout_add函数的典型用法代码示例。如果您正苦于以下问题:C++ purple_timeout_add函数的具体用法?C++ purple_timeout_add怎么用?C++ purple_timeout_add使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了purple_timeout_add函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: purple_upnp_discover
void
purple_upnp_discover(PurpleUPnPCallback cb, gpointer cb_data)
{
/* Socket Setup Variables */
int sock;
struct hostent* hp;
/* UDP RECEIVE VARIABLES */
UPnPDiscoveryData *dd;
if (control_info.status == PURPLE_UPNP_STATUS_DISCOVERING) {
if (cb) {
discovery_callbacks = g_slist_append(
discovery_callbacks, cb);
discovery_callbacks = g_slist_append(
discovery_callbacks, cb_data);
}
return;
}
dd = g_new0(UPnPDiscoveryData, 1);
if (cb) {
discovery_callbacks = g_slist_append(discovery_callbacks, cb);
discovery_callbacks = g_slist_append(discovery_callbacks,
cb_data);
}
/* Set up the sockets */
sock = socket(AF_INET, SOCK_DGRAM, 0);
if(sock == -1) {
purple_debug_error("upnp",
"purple_upnp_discover(): Failed In sock creation\n");
/* Short circuit the retry attempts */
dd->retry_count = NUM_UDP_ATTEMPTS;
purple_timeout_add(10, purple_upnp_discover_timeout, dd);
return;
}
dd->fd = sock;
/* TODO: Non-blocking! */
if((hp = gethostbyname(HTTPMU_HOST_ADDRESS)) == NULL) {
purple_debug_error("upnp",
"purple_upnp_discover(): Failed In gethostbyname\n");
/* Short circuit the retry attempts */
dd->retry_count = NUM_UDP_ATTEMPTS;
purple_timeout_add(10, purple_upnp_discover_timeout, dd);
return;
}
memset(&(dd->server), 0, sizeof(struct sockaddr));
dd->server.sin_family = AF_INET;
memcpy(&(dd->server.sin_addr), hp->h_addr_list[0], hp->h_length);
dd->server.sin_port = htons(HTTPMU_HOST_PORT);
control_info.status = PURPLE_UPNP_STATUS_DISCOVERING;
purple_upnp_discover_send_broadcast(dd);
}
开发者ID:Mons,项目名称:libpurple-mini,代码行数:59,代码来源:upnp.c
示例2: 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
示例3: purple_upnp_discover_send_broadcast
static void
purple_upnp_discover_send_broadcast(UPnPDiscoveryData *dd)
{
gchar *sendMessage = NULL;
size_t totalSize;
gboolean sentSuccess;
/* because we are sending over UDP, if there is a failure
we should retry the send NUM_UDP_ATTEMPTS times. Also,
try different requests for WANIPConnection and WANPPPConnection*/
for(; dd->retry_count < NUM_UDP_ATTEMPTS; dd->retry_count++) {
sentSuccess = FALSE;
if((dd->retry_count % 2) == 0) {
strncpy(dd->service_type, WAN_IP_CONN_SERVICE, sizeof(dd->service_type));
} else {
strncpy(dd->service_type, WAN_PPP_CONN_SERVICE, sizeof(dd->service_type));
}
sendMessage = g_strdup_printf(SEARCH_REQUEST_STRING, dd->service_type);
totalSize = strlen(sendMessage);
do {
if(sendto(dd->fd, sendMessage, totalSize, 0,
(struct sockaddr*) &(dd->server),
sizeof(struct sockaddr_in)
) == totalSize) {
sentSuccess = TRUE;
break;
}
} while (errno == EINTR || errno == EAGAIN);
g_free(sendMessage);
if(sentSuccess) {
dd->tima = purple_timeout_add(DISCOVERY_TIMEOUT,
purple_upnp_discover_timeout, dd);
dd->inpa = purple_input_add(dd->fd, PURPLE_INPUT_READ,
purple_upnp_discover_udp_read, dd);
return;
}
}
/* We have already done all our retries. Make sure that the callback
* doesn't get called before the original function returns */
dd->tima = purple_timeout_add(10, purple_upnp_discover_timeout, dd);
}
开发者ID:Lilitana,项目名称:Pidgin,代码行数:49,代码来源:upnp.c
示例4: skype_message_received
static void
skype_message_received(char *orig_message)
{
guint request_number;
guint *key;
int string_pos;
char *message;
if (strlen(orig_message) == 0)
return;
message = g_strdup(orig_message);
g_free(orig_message);
skype_debug_info("skype", "Received: %s\n", message);
if(message[0] == '#')
{
//It's a reply from a call we've made - update the hash table
sscanf(message, "#%u %n", &request_number, &string_pos);
key = g_new(guint, 1);
*key = request_number;
g_static_mutex_lock2(&mutex);
g_hash_table_insert(message_queue, key, g_strdup(&message[string_pos]));
g_cond_broadcast(condition);
g_static_mutex_unlock2(&mutex);
g_free(message);
} else {
purple_timeout_add(1, (GSourceFunc)skype_handle_received_message, (gpointer)message);
}
}
开发者ID:novas0x2a,项目名称:skype4pidgin,代码行数:33,代码来源:skype_messaging.c
示例5: plugin_load
static gboolean
plugin_load(PurplePlugin * plugin)
{
plugin_self = plugin;
purple_signal_connect(purple_conversations_get_handle(), "conversation-created", plugin,
PURPLE_CALLBACK(timezone_createconv_cb), NULL);
purple_plugin_ipc_register(plugin, BUDDYTIME_BUDDY_GET_TIMEZONE,
PURPLE_CALLBACK(buddy_get_timezone),
marshal_POINTER__POINTER_BOOL,
purple_value_new(PURPLE_TYPE_STRING),
2,
purple_value_new(PURPLE_TYPE_SUBTYPE,
PURPLE_SUBTYPE_BLIST_NODE),
purple_value_new(PURPLE_TYPE_BOOLEAN));
purple_plugin_ipc_register(plugin, BUDDYTIME_TIMEZONE_GET_TIME,
PURPLE_CALLBACK(timezone_get_time),
marshal_POINTER__POINTER_POINTER_POINTER,
purple_value_new(PURPLE_TYPE_INT),
2,
purple_value_new(PURPLE_TYPE_POINTER),
purple_value_new(PURPLE_TYPE_POINTER));
/* This is done as an idle callback to avoid an infinite loop
* when we try to load the UI plugin which depends on this plugin
* which isn't officially loaded yet. */
purple_timeout_add(0, load_ui_plugin, NULL);
return TRUE;
}
开发者ID:Javran,项目名称:purple-plugin-pack,代码行数:32,代码来源:buddytime.c
示例6: msn_soap_connection_handle_next
static void
msn_soap_connection_handle_next(MsnSoapConnection *conn)
{
msn_soap_connection_sanitize(conn, FALSE);
conn->run_timer = purple_timeout_add(0, msn_soap_connection_run, conn);
}
开发者ID:Draghtnod,项目名称:pidgin,代码行数:7,代码来源:soap.c
示例7: split_and_send
/* create message queue and prepare timer callbacks */
static void
split_and_send(message_to_conv *msg_to_conv, const char **message) {
gint message_delay_ms;
g_return_if_fail( msg_to_conv != NULL );
g_return_if_fail( message != NULL );
g_return_if_fail( *message != NULL );
/* read and validate preferences */
current_split_size = purple_prefs_get_int("/plugins/core/splitter/split_size");
if( current_split_size > MAX_SPLIT_SIZE ) current_split_size = MAX_SPLIT_SIZE;
if( current_split_size < MIN_SPLIT_SIZE ) current_split_size = MIN_SPLIT_SIZE;
message_delay_ms = purple_prefs_get_int("/plugins/core/splitter/delay_ms");
if( message_delay_ms > MAX_DELAY_MS ) message_delay_ms = MAX_DELAY_MS;
if( message_delay_ms < MIN_DELAY_MS ) message_delay_ms = MIN_DELAY_MS;
/* prepare message queue */
msg_to_conv->messages = create_message_queue(*message);
g_return_if_fail( msg_to_conv->messages != NULL );
/* initialize message send timer */
purple_timeout_add( (g_queue_get_length(msg_to_conv->messages) > 1) ? message_delay_ms : 0,
(GSourceFunc)send_message_timer_cb,
msg_to_conv);
/* free the original message and ensure it does not get sent */
g_free((char*)*message);
*message = NULL;
}
开发者ID:rgenoud,项目名称:purple-plugin-pack,代码行数:31,代码来源:splitter.c
示例8: tgprpl_xfer_send_init
static void tgprpl_xfer_send_init (PurpleXfer *X) {
struct tgp_xfer_send_data *data = X->data;
purple_xfer_start (X, -1, NULL, 0);
const char *file = purple_xfer_get_filename (X);
const char *localfile = purple_xfer_get_local_filename (X);
const char *who = purple_xfer_get_remote_user (X);
debug ("xfer_on_init (file=%s, local=%s, who=%s)", file, localfile, who);
tgl_peer_t *P = find_peer_by_name (data->conn->TLS, who);
if (P) {
if (tgl_get_peer_type (P->id) != TGL_PEER_ENCR_CHAT) {
tgl_do_send_document (data->conn->TLS, P->id, (char*) localfile, NULL,
0, TGL_SEND_MSG_FLAG_DOCUMENT_AUTO, tgprpl_xfer_on_finished, data);
}
else {
purple_notify_message (_telegram_protocol, PURPLE_NOTIFY_MSG_ERROR, "Not supported",
"Sorry, sending documents to encrypted chats not yet supported.",
NULL, NULL, NULL);
}
}
data->timer = purple_timeout_add (100, tgprpl_xfer_upload_progress, X);
}
开发者ID:prodigeni,项目名称:telegram-purple,代码行数:25,代码来源:tgp-ft.c
示例9: skypeweb_get_icon
void
skypeweb_get_icon(PurpleBuddy *buddy)
{
if (!buddy) return;
purple_timeout_add(100, skypeweb_get_icon_queuepop, (gpointer)buddy);
}
开发者ID:rtmf,项目名称:skype4pidgin,代码行数:7,代码来源:skypeweb_contacts.c
示例10: tgp_msg_send_schedule
static void tgp_msg_send_schedule (struct tgl_state *TLS, gchar *chunk, tgl_peer_id_t to) {
g_queue_push_tail (tls_get_data (TLS)->out_messages, tgp_msg_sending_init (TLS, chunk, to));
if (tls_get_data (TLS)->out_timer) {
purple_timeout_remove (tls_get_data (TLS)->out_timer);
}
tls_get_data (TLS)->out_timer = purple_timeout_add (0, tgp_msg_send_schedule_cb, tls_get_data (TLS));
}
开发者ID:Houlbek,项目名称:telegram-purple,代码行数:7,代码来源:tgp-msg.c
示例11: purple_dnsquery_a
PurpleDnsQueryData *
purple_dnsquery_a(const char *hostname, int port,
PurpleDnsQueryConnectFunction callback, gpointer data)
{
PurpleDnsQueryData *query_data;
g_return_val_if_fail(hostname != NULL, NULL);
g_return_val_if_fail(port != 0, NULL);
g_return_val_if_fail(callback != NULL, NULL);
query_data = g_new(PurpleDnsQueryData, 1);
query_data->hostname = g_strdup(hostname);
g_strstrip(query_data->hostname);
query_data->port = port;
query_data->callback = callback;
query_data->data = data;
if (strlen(query_data->hostname) == 0)
{
purple_dnsquery_destroy(query_data);
g_return_val_if_reached(NULL);
}
/* Don't call the callback before returning */
query_data->timeout = purple_timeout_add(0, resolve_host, query_data);
return query_data;
}
开发者ID:arminius2,项目名称:apolloim,代码行数:28,代码来源:dnsquery.c
示例12: purple_dnsquery_a_account
PurpleDnsQueryData *
purple_dnsquery_a_account(PurpleAccount *account, const char *hostname, int port,
PurpleDnsQueryConnectFunction callback, gpointer data)
{
PurpleDnsQueryData *query_data;
g_return_val_if_fail(hostname != NULL, NULL);
g_return_val_if_fail(port != 0, NULL);
g_return_val_if_fail(callback != NULL, NULL);
purple_debug_info("dnsquery", "Performing DNS lookup for %s\n", hostname);
query_data = g_new0(PurpleDnsQueryData, 1);
query_data->hostname = g_strdup(hostname);
g_strstrip(query_data->hostname);
query_data->port = port;
query_data->callback = callback;
query_data->data = data;
query_data->account = account;
if (*query_data->hostname == '\0')
{
purple_dnsquery_destroy(query_data);
g_return_val_if_reached(NULL);
}
query_data->timeout = purple_timeout_add(0, initiate_resolving, query_data);
return query_data;
}
开发者ID:CkNoSFeRaTU,项目名称:pidgin,代码行数:30,代码来源:dnsquery.c
示例13: irc_receiving_text
static void
irc_receiving_text(PurpleConnection *gc, const char **incoming, gpointer null)
{
char **splits, *str;
PurpleAccount *account = NULL;
if (!incoming || !*incoming || !**incoming) /* oh the fun .. I can do this all day! */
return;
splits = g_strsplit(*incoming, " ", -1);
/* if there's not at least 5 elements in the string array, this isn't a kick; ignore */
if(g_strv_length(splits) < 5)
return;
account = purple_connection_get_account(gc);
str = g_ascii_strdown(splits[1], -1);
if (strcmp(str, "kick") == 0 && splits[2] && splits[3]) {
char *name = splits[2];
GList *chats = purple_get_chats();
while (chats) {
PurpleConversation *conv = chats->data;
chats = chats->next;
if (purple_conversation_get_account(conv) == account
&& strcmp(purple_conversation_get_name(conv), name) == 0) {
purple_timeout_add(100, show_them, conv);
break;
}
}
}
g_free(str);
g_strfreev(splits);
}
开发者ID:Javran,项目名称:purple-plugin-pack,代码行数:35,代码来源:irc-more.c
示例14: tgprpl_xfer_send_init
static void tgprpl_xfer_send_init (PurpleXfer *X) {
debug ("tgprpl_xfer_send_init(): sending xfer accepted.");
struct tgp_xfer_send_data *data;
const char *file, *localfile, *who;
tgl_peer_t *P;
data = X->data;
purple_xfer_start (X, -1, NULL, 0);
file = purple_xfer_get_filename (X);
localfile = purple_xfer_get_local_filename (X);
who = purple_xfer_get_remote_user (X);
debug ("xfer_on_init (file=%s, local=%s, who=%s)", file, localfile, who);
P = tgp_blist_lookup_peer_get (data->conn->TLS, who);
g_return_if_fail (P);
if (tgl_get_peer_type (P->id) == TGL_PEER_ENCR_CHAT) {
purple_xfer_error (PURPLE_XFER_SEND, data->conn->pa, who,
_("Sorry, sending documents to encrypted chats not yet supported."));
purple_xfer_cancel_local (X);
return;
}
tgl_do_send_document (data->conn->TLS, P->id, (char*) localfile, NULL, 0,
TGL_SEND_MSG_FLAG_DOCUMENT_AUTO, tgprpl_xfer_send_on_finished, data);
// see comment in tgprpl_xfer_recv_init()
purple_xfer_ref (X);
data->timer = purple_timeout_add (100, tgprpl_xfer_upload_progress, X);
data->loading = TRUE;
}
开发者ID:Houlbek,项目名称:telegram-purple,代码行数:34,代码来源:tgp-ft.c
示例15: msn_session_new
MsnSession *
msn_session_new (const gchar *username,
const gchar *password,
gboolean http_method)
{
MsnSession *session;
session = g_new0 (MsnSession, 1);
session->username = pn_normalize (username);
session->password = g_strndup (password, 16);
#ifdef INTERNAL_MAINLOOP
session->g_main_loop = g_main_loop_new (NULL, FALSE);
session->g_main_loop_timer = purple_timeout_add (1000, g_main_context_iteration_timer, NULL);
#endif
session->config = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);
/** @todo sb and ns need this here but should be updated on-the-fly. */
msn_session_set_bool (session, "use_http_method", http_method);
#if 0
if (session->http_method)
{
PnNode *foo;
foo = PN_NODE (pn_http_server_new ("foo server"));
foo->session = session;
session->http_conn = foo;
}
#endif
session->dp_manager = pn_dp_manager_new (session);
session->notification = msn_notification_new (session);
pn_node_set_id(session->notification->cmdproc->conn,
session->conn_count++, "ns");
session->contactlist = pn_contactlist_new (session);
session->user = pn_contact_new (NULL);
pn_contact_set_passport (session->user, session->username);
session->conv_seq = 1;
session->oim_session = pn_oim_session_new (session);
session->conversations = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, (GDestroyNotify) msn_switchboard_unref);
session->chats = g_hash_table_new_full (g_direct_hash, g_direct_equal, NULL, (GDestroyNotify) msn_switchboard_unref);
#if defined(PECAN_CVR)
session->links = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, (GDestroyNotify) pn_peer_link_unref);
#endif /* defined(PECAN_CVR) */
purple_signal_connect (purple_conversations_get_handle(), "conversation-created",
session, PURPLE_CALLBACK (conversation_created_cb), session);
return session;
}
开发者ID:mikecpt,项目名称:msn-pecan,代码行数:59,代码来源:session.c
示例16: qq_dispatch
void qq_dispatch(LwqqCommand cmd,unsigned long timeout)
{
if(timeout==0)timeout=10;
LwqqCommand* d = s_malloc0(sizeof(*d));
*d = cmd;
purple_timeout_add(timeout,did_dispatch,d);
}
开发者ID:5rather,项目名称:pidgin-lwqq,代码行数:8,代码来源:qq_types.c
示例17: plugin_load
static gboolean plugin_load(PurplePlugin *plugin) {
guint poll_interval = 3000;
spotify_plugin = plugin;
// register the timeout
spotify_handle = purple_timeout_add(poll_interval, spotify_poll, NULL);
return TRUE;
}
开发者ID:fry,项目名称:pidgin-spotify,代码行数:9,代码来源:spotify.cpp
示例18: ssl_gnutls_connect
static void
ssl_gnutls_connect(PurpleSslConnection *gsc)
{
PurpleSslGnutlsData *gnutls_data;
static const int cert_type_priority[2] = { GNUTLS_CRT_X509, 0 };
gnutls_data = g_new0(PurpleSslGnutlsData, 1);
gsc->private_data = gnutls_data;
gnutls_init(&gnutls_data->session, GNUTLS_CLIENT);
#ifdef HAVE_GNUTLS_PRIORITY_FUNCS
{
const char *prio_str = NULL;
gboolean set = FALSE;
/* Let's see if someone has specified a specific priority */
if (gsc->host && host_priorities)
prio_str = g_hash_table_lookup(host_priorities, gsc->host);
if (prio_str)
set = (GNUTLS_E_SUCCESS ==
gnutls_priority_set_direct(gnutls_data->session, prio_str,
NULL));
if (!set)
gnutls_priority_set(gnutls_data->session, default_priority);
}
#else
gnutls_set_default_priority(gnutls_data->session);
#endif
gnutls_certificate_type_set_priority(gnutls_data->session,
cert_type_priority);
gnutls_credentials_set(gnutls_data->session, GNUTLS_CRD_CERTIFICATE,
xcred);
gnutls_transport_set_ptr(gnutls_data->session, GINT_TO_POINTER(gsc->fd));
gnutls_data->handshake_handler = purple_input_add(gsc->fd,
PURPLE_INPUT_READ, ssl_gnutls_handshake_cb, gsc);
/* Orborde asks: Why are we configuring a callback, then
(almost) immediately calling it?
Answer: gnutls_handshake (up in handshake_cb) needs to be called
once in order to get the ball rolling on the SSL connection.
Once it has done so, only then will the server reply, triggering
the callback.
Since the logic driving gnutls_handshake is the same with the first
and subsequent calls, we'll just fire the callback immediately to
accomplish this.
*/
gnutls_data->handshake_timer = purple_timeout_add(0, start_handshake_cb,
gsc);
}
开发者ID:Lilitana,项目名称:Pidgin,代码行数:57,代码来源:ssl-gnutls.c
示例19: Log
bool ReceiveFile::receive() {
if (m_stream->recv() != ConnNoError || shouldStop()) {
m_file.close();
Log("ReceiveFile", "transferFinished");
purple_timeout_add(1000,&transferFinished,this);
return false;
}
return true;
}
开发者ID:bochi,项目名称:spectrum-gw,代码行数:9,代码来源:filetransferrepeater.cpp
示例20: fb_mqtt_ping
static void
fb_mqtt_ping(FbMqtt *mqtt)
{
FbMqttPrivate *priv = mqtt->priv;
fb_mqtt_timeout_clear(mqtt);
priv->tev = purple_timeout_add(FB_MQTT_TIMEOUT_PING,
fb_mqtt_cb_ping, mqtt);
}
开发者ID:duxet,项目名称:adium-facebook,代码行数:9,代码来源:mqtt.c
注:本文中的purple_timeout_add函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论