Exemplo n.º 1
0
/* FlashWindowEx is only supported by Win98+ and WinNT5+. If its
   not supported we do it our own way */
void wgaim_conv_im_blink(GtkWidget *window) {
        if(!blink_turned_on)
                return;
	if(MyFlashWindowEx) {
		FLASHWINFO info;
                if(GetForegroundWindow() == GDK_WINDOW_HWND(window->window))
                        return;
                memset(&info, 0, sizeof(FLASHWINFO));
		info.cbSize = sizeof(FLASHWINFO);
		info.hwnd = GDK_WINDOW_HWND(window->window);
		info.dwFlags = FLASHW_ALL | FLASHW_TIMER;
		info.dwTimeout = 0;
		MyFlashWindowEx(&info);
                /* Stop flashing when window receives focus */
                g_signal_connect(G_OBJECT(window), 
                                 "focus-in-event", 
                                 G_CALLBACK(halt_flash_filter), info.hwnd);
	}
	else {
		WGAIM_FLASH_INFO *finfo = g_new0(WGAIM_FLASH_INFO, 1);

		/* Start Flashing window */
		finfo->t_handle = gaim_timeout_add(1000, 
						flash_window_cb, 
						GDK_WINDOW_HWND(window->window));
		finfo->sig_handler = g_signal_connect(G_OBJECT(window), 
						      "focus-in-event", 
						      G_CALLBACK(halt_flash_filter), finfo);
	}
}
Exemplo n.º 2
0
gboolean gaym_blist_timeout(struct gaym_conn * gaym)
{
    /**
     * There are 510 characters available for an IRC command (512 if
     * you count CR-LF).  "WHOIS " takes up 6 characters.  Assuming
     * you need allow an extra character for the NULL when using
     * g_string_sized_new(), we need to allocate (510-6)+1=505 here.
     */
    BListWhois *blist_whois = g_new0(BListWhois, 1);
    blist_whois->count = 0;
    blist_whois->string = g_string_sized_new(505);

    char *list, *buf;

    g_hash_table_foreach(gaym->buddies, (GHFunc) gaym_buddy_append,
                         (gpointer) blist_whois);

    list = g_string_free(blist_whois->string, FALSE);
    if (!list || !strlen(list)) {
        g_hash_table_foreach(gaym->buddies, (GHFunc) gaym_buddy_clear_done,
                             NULL);
        gaim_timeout_remove(gaym->timer);
        gaym->timer =
            gaim_timeout_add(BLIST_UPDATE_PERIOD,
                             (GSourceFunc) gaym_blist_timeout,
                             (gpointer) gaym);
        g_free(list);
        g_free(blist_whois);

        return TRUE;
    }
    gaym->blist_updating = TRUE;
    buf = gaym_format(gaym, "vn", "WHOIS", list);
    gaym_send(gaym, buf);
    gaim_timeout_remove(gaym->timer);
    gaym->timer =
        gaim_timeout_add(BLIST_CHUNK_INTERVAL,
                         (GSourceFunc) gaym_blist_timeout,
                         (gpointer) gaym);

    g_free(buf);
    g_free(list);
    g_free(blist_whois);

    return TRUE;
}
Exemplo n.º 3
0
/* we need to do this for Oscar because serv_login only starts the login
 * process, it doesn't end there. gaim_setup will be called later from
 * oscar.c, after the buddy list is made and serv_finish_login is called */
void gaim_setup(GaimConnection *gc)
{
	if (gaim_prefs_get_bool("/gaim/gtk/sound/enabled/login")) {
		if (snd_tmout)
			g_source_remove(snd_tmout);
		gaim_gtk_sound_set_login_mute(TRUE);
		snd_tmout = gaim_timeout_add(10000, sound_timeout, NULL);
	}
}
Exemplo n.º 4
0
void
gaim_connection_error(GaimConnection *gc, const char *text)
{
	GaimConnectionUiOps *ops;

	g_return_if_fail(gc   != NULL);
	g_return_if_fail(text != NULL);

	/* If we've already got one error, we don't need any more */
	if (gc->disconnect_timeout)
		return;

	ops = gaim_connections_get_ui_ops();

	if (ops != NULL) {
		if (ops->report_disconnect != NULL)
			ops->report_disconnect(gc, text);
	}

	gc->disconnect_timeout = gaim_timeout_add(0, gaim_connection_disconnect_cb,
			gaim_connection_get_account(gc));
}
Exemplo n.º 5
0
static void
update_keepalive(GaimConnection *gc, gboolean on)
{
	GaimPluginProtocolInfo *prpl_info = NULL;

	if (gc != NULL && gc->prpl != NULL)
		prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl);

	if (!prpl_info || !prpl_info->keepalive)
		return;

	if (on && !gc->keepalive)
	{
		gaim_debug_info("connection", "Activating keepalive.\n");
		gc->keepalive = gaim_timeout_add(30000, send_keepalive, gc);
	}
	else if (!on && gc->keepalive > 0)
	{
		gaim_debug_info("connection", "Deactivating keepalive.\n");
		gaim_timeout_remove(gc->keepalive);
		gc->keepalive = 0;
	}
}
Exemplo n.º 6
0
static void
schedule_status_save()
{
    if (!status_save_timer)
        status_save_timer = gaim_timeout_add(5000, status_save_cb, NULL);
}
Exemplo n.º 7
0
static void
schedule_pounces_save(void)
{
	if (!pounces_save_timer)
		pounces_save_timer = gaim_timeout_add(5000, pounces_save_cb, NULL);
}