static gboolean check_timeout(gpointer data)
{
	gint count = check_mail();
	GaimBuddyList *list = gaim_get_blist();

	if (count == -1)
		return FALSE;

	if (!list || !GAIM_IS_GTK_BLIST(list) || !(GAIM_GTK_BLIST(list)->vbox))
		return TRUE;

	if (!mail) {
		/* guess we better build it then :P */
		GtkWidget *vbox = GAIM_GTK_BLIST(list)->vbox;

		mail = gtk_label_new("No mail messages.");
		gtk_box_pack_start(GTK_BOX(vbox), mail, FALSE, FALSE, 0);
		gtk_box_reorder_child(GTK_BOX(vbox), mail, 1);
		g_signal_connect(G_OBJECT(mail), "destroy", G_CALLBACK(destroy_cb), NULL);
		gtk_widget_show(mail);
	}

	if (count & NEW_MAIL)
		gaim_sound_play_event(GAIM_SOUND_POUNCE_DEFAULT);

	if (count & UNREAD_MAIL)
		gtk_label_set_text(GTK_LABEL(mail), "You have new mail!");
	else if (count & ANY_MAIL)
		gtk_label_set_text(GTK_LABEL(mail), "You have mail.");
	else
		gtk_label_set_text(GTK_LABEL(mail), "No mail messages.");

	return TRUE;
}
Example #2
0
        session_widget::session_widget(
                s::session_service_ptr session_service,
                s::session_ptr session,
                a::app_service_ptr app_service) :
            _session_service{session_service},
            _session{session},
            _app_service{app_service},
            _messages{new message_list{app_service, session}}
        {
            REQUIRE(session_service);
            REQUIRE(session);
            REQUIRE(app_service);

            _layout = new QGridLayout;

            _contact_select = new QComboBox;
            _add_contact = new QPushButton{"+"};
            _add_contact->setMaximumSize(20,20);
            connect(_add_contact, SIGNAL(clicked()), this, SLOT(add_contact()));

            update_contact_select();

            _contacts = new contact_list{_session_service->user_service(), _session->contacts()};

            auto* cw = new QWidget;
            auto* cl = new QGridLayout;

            cw->setLayout(cl);
            cl->addWidget(_contact_select, 0,0);
            cl->addWidget(_add_contact, 0, 1);
            cl->addWidget(_contacts, 1, 0, 1, 2);
            cw->resize(CW_WIDTH, cw->height());

            _splitter = new QSplitter{Qt::Horizontal};
            _splitter->addWidget(_messages);
            _splitter->addWidget(cw);
            _splitter->setStretchFactor(0, 1);
            _splitter->setStretchFactor(1, 0);
           
            _layout->addWidget(_splitter);

            setLayout(_layout);
            _layout->setContentsMargins(0,0,0,0);

            //setup mail timer
            auto *t2 = new QTimer(this);
            connect(t2, SIGNAL(timeout()), this, SLOT(check_mail()));
            t2->start(TIMER_SLEEP);

            INVARIANT(_session_service);
            INVARIANT(_session);
            INVARIANT(_messages);
            INVARIANT(_layout);
            INVARIANT(_app_service);
        }
Example #3
0
int calc_account(Uint32 steps)
{
	blink+=steps;
	if (spNetC4AGetStatus() > 0)
	{
		right_after_status = 1;
		return 0;
	}
	if (right_after_status)
	{
		if (spNetC4AGetTaskResult() == 0)
		{
			mode = nextMode;
			askMode = last_task+7;
		}
		else
		{
			askMode = 6;
			spStopKeyboardInput();
		}
			
	}
	right_after_status = 0;
	if (askMode)
	{
		switch ( askMode )
		{
			case 1:
				if ( spGetInput()->button[SP_BUTTON_START_NOWASD] )
				{
					spGetInput()->button[SP_BUTTON_START_NOWASD] = 0;
					if (spNetC4ADeleteAccount(&profile,1,TIME_OUT) == 0)
					{
						right_after_status = 1;
						last_task = 2;
					}
					nextMode = 0;
					sprintf(longName,"");
					sprintf(shortName,"");
					sprintf(password,"");
					sprintf(mail,"");
					askMode = 0;
					switch (line)
					{
						case 0: spPollKeyboardInput(shortName,3,SP_PRACTICE_OK_NOWASD_MASK); break;
						case 1: spPollKeyboardInput(longName,256,SP_PRACTICE_OK_NOWASD_MASK); break;
						case 2: spPollKeyboardInput(password,256,SP_PRACTICE_OK_NOWASD_MASK); break;
						case 3: spPollKeyboardInput(mail,256,SP_PRACTICE_OK_NOWASD_MASK); break;
					}
				}
				if ( spGetInput()->button[SP_PRACTICE_CANCEL_NOWASD] )
				{
					spGetInput()->button[SP_PRACTICE_CANCEL_NOWASD] = 0;
					askMode = 0;
					switch (line)
					{
						case 0: spPollKeyboardInput(shortName,3,SP_PRACTICE_OK_NOWASD_MASK); break;
						case 1: spPollKeyboardInput(longName,256,SP_PRACTICE_OK_NOWASD_MASK); break;
						case 2: spPollKeyboardInput(password,256,SP_PRACTICE_OK_NOWASD_MASK); break;
						case 3: spPollKeyboardInput(mail,256,SP_PRACTICE_OK_NOWASD_MASK); break;
					}
				}
				break;
			default:
				if ( spGetInput()->button[SP_PRACTICE_OK_NOWASD] )
				{
					spGetInput()->button[SP_PRACTICE_OK_NOWASD] = 0;
					askMode = 0;
					switch (line)
					{
						case 0: spPollKeyboardInput(shortName,3,SP_PRACTICE_OK_NOWASD_MASK); break;
						case 1: spPollKeyboardInput(longName,256,SP_PRACTICE_OK_NOWASD_MASK); break;
						case 2: spPollKeyboardInput(password,256,SP_PRACTICE_OK_NOWASD_MASK); break;
						case 3: spPollKeyboardInput(mail,256,SP_PRACTICE_OK_NOWASD_MASK); break;
					}
				}
		}
		return 0;
	}
	if ( spGetInput()->button[SP_PRACTICE_CANCEL_NOWASD] )
	{
		spGetInput()->button[SP_PRACTICE_CANCEL_NOWASD] = 0;
		spStopKeyboardInput();
		return 1;
	}
	
	int i;
	for (i = 0; shortName[i] != 0; i++)
	{
		if ('a' <= shortName[i] && shortName[i] <= 'z')
			shortName[i] += 'A'-'a';
	}
		
	if ((spGetVirtualKeyboardState() == SP_VIRTUAL_KEYBOARD_ALWAYS && spGetInput()->button[SP_BUTTON_R_NOWASD]) ||
	    (spGetVirtualKeyboardState() != SP_VIRTUAL_KEYBOARD_ALWAYS && spGetInput()->axis[1] > 0))
	{
		line = (line + 1) % 4;
		spGetInput()->button[SP_BUTTON_R_NOWASD] = 0;
		if (spGetVirtualKeyboardState() != SP_VIRTUAL_KEYBOARD_ALWAYS)
			spGetInput()->axis[1] = 0;
		blink = 0;
		switch (line)
		{
			case 0: spPollKeyboardInput(shortName,3,SP_PRACTICE_OK_NOWASD_MASK); break;
			case 1: spPollKeyboardInput(longName,256,SP_PRACTICE_OK_NOWASD_MASK); break;
			case 2: spPollKeyboardInput(password,256,SP_PRACTICE_OK_NOWASD_MASK); break;
			case 3: spPollKeyboardInput(mail,256,SP_PRACTICE_OK_NOWASD_MASK); break;
		}
	}
	if ((spGetVirtualKeyboardState() == SP_VIRTUAL_KEYBOARD_ALWAYS && spGetInput()->button[SP_BUTTON_L_NOWASD]) ||
	    (spGetVirtualKeyboardState() != SP_VIRTUAL_KEYBOARD_ALWAYS && spGetInput()->axis[1] < 0))
	{
		line = (line + 3) % 4;
		spGetInput()->button[SP_BUTTON_L_NOWASD] = 0;
		if (spGetVirtualKeyboardState() != SP_VIRTUAL_KEYBOARD_ALWAYS)
			spGetInput()->axis[1] = 0;
		blink = 0;
		switch (line)
		{
			case 0: spPollKeyboardInput(shortName,3,SP_PRACTICE_OK_NOWASD_MASK); break;
			case 1: spPollKeyboardInput(longName,256,SP_PRACTICE_OK_NOWASD_MASK); break;
			case 2: spPollKeyboardInput(password,256,SP_PRACTICE_OK_NOWASD_MASK); break;
			case 3: spPollKeyboardInput(mail,256,SP_PRACTICE_OK_NOWASD_MASK); break;
		}
	}
	if ( spGetInput()->button[SP_BUTTON_START_NOWASD] )
	{
		spGetInput()->button[SP_BUTTON_START_NOWASD] = 0;
		if (check_shortname())
		{
			askMode = 2;
			spStopKeyboardInput();
		}
		else
		if (check_longname())
		{
			askMode = 3;
			spStopKeyboardInput();
		}
		else
		if (check_password())
		{
			askMode = 4;
			spStopKeyboardInput();
		}
		else
		if (check_mail())
		{
			askMode = 5;
			spStopKeyboardInput();
		}
		else
		{
			if (mode == 0)
			{
				if (spNetC4ACreateProfile(&profile,longName,shortName,password,mail,TIME_OUT) == 0)
				{
					right_after_status = 1;
					last_task = 0;
				}
				nextMode = 1;
			}
			else
			{
				if (spNetC4AEditProfile(&profile,longName,shortName,password,mail,TIME_OUT) == 0)
				{
					right_after_status = 1;
					last_task = 1;
				}
				nextMode = 1;
			}
		}
	}
	if ( mode == 1 && spGetInput()->button[SP_BUTTON_SELECT_NOWASD] )
	{
		 spGetInput()->button[SP_BUTTON_SELECT_NOWASD] = 0;
		 askMode = 1;
		 spStopKeyboardInput();
	}
	return 0;
}
void suh::set_mail(const std::string& user, const std::string& mail) {
	check_mail(mail);
	users_[user].mail = mail;
}