예제 #1
0
static void testAsyncIMAP()
{
    mailcore::IMAPAsyncSession * session;
    TestIMAPCallback * callback = new TestIMAPCallback();
    
    session = new mailcore::IMAPAsyncSession();
    session->setHostname(MCSTR("imap.gmail.com"));
    session->setPort(993);
    session->setUsername(email);
    session->setPassword(password);
    session->setConnectionType(mailcore::ConnectionTypeTLS);
    
    mailcore::IMAPMessagesRequestKind requestKind = (mailcore::IMAPMessagesRequestKind)
    (mailcore::IMAPMessagesRequestKindHeaders | mailcore::IMAPMessagesRequestKindStructure |
     mailcore::IMAPMessagesRequestKindInternalDate | mailcore::IMAPMessagesRequestKindHeaderSubject |
     mailcore::IMAPMessagesRequestKindFlags);
    mailcore::IMAPFetchMessagesOperation * op = session->fetchMessagesByUIDOperation(MCSTR("INBOX"), requestKind, mailcore::IndexSet::indexSetWithRange(mailcore::RangeMake(1, UINT64_MAX)));
    op->setCallback(callback);
    op->setImapCallback(callback);
    op->start();
    //MCLog("%s", MCUTF8DESC(messages));
	mainLoop();

    //session->release();
}
예제 #2
0
void testAll()
{
    mailcore::setICUDataDirectory(MCSTR("/usr/local/share/icu"));
    
    email = MCSTR("*****@*****.**");
    password = MCSTR("MyP4ssw0rd");
    displayName = MCSTR("My Email");
    
#if __linux__ && !defined(ANDROID) && !defined(__ANDROID__)
    s_main_loop = g_main_loop_new (NULL, FALSE);
#endif
    
    mailcore::AutoreleasePool * pool = new mailcore::AutoreleasePool();
    MCLogEnabled = 1;
    
    //mailcore::Data * data = testMessageBuilder();
    //testMessageParser(data);
    //testSMTP(data);
    //testIMAP();
    //testIMAPMove();
    //testPOP();
    //testNNTP();
    //testAsyncSMTP(data);
    //testAsyncIMAP();
    //testAsyncPOP();
    //testAddresses();
    //testAttachments();

    pool->release();
}
예제 #3
0
// In standalone mode, we try to work out what went wrong...
void MCModeGetStartupErrorMessage(MCStringRef& r_caption, MCStringRef& r_text)
{
	r_caption = MCSTR("Initialization Error");
	if (MCValueGetTypeCode(MCresult -> getvalueref()) == kMCValueTypeCodeString)
		r_text = MCValueRetain((MCStringRef)MCresult -> getvalueref());
	else
		r_text = MCSTR("unknown reason");
}
예제 #4
0
static void testAttachments()
{
    mailcore::Attachment *attachment = mailcore::Attachment::attachmentWithText(MCSTR("Hello World"));
    attachment->setCharset(NULL);
    mailcore::String * str = attachment->decodedString();
    MCLog("%s", MCUTF8DESC(str));
}
예제 #5
0
파일: eps.cpp 프로젝트: alilloyd/livecode
Boolean MCEPS::mdown(uint2 which)
{
	if (state & CS_MFOCUSED)
		return False;
	state |= CS_MFOCUSED;
	switch (which)
	{
	case Button1:
		switch (getstack()->gettool(this))
		{
		case T_BROWSE:
			message_with_valueref_args(MCM_mouse_down, MCSTR("1"));
			break;
		case T_POINTER:
			start(True);
			break;
		case T_HELP:
			break;
		default:
			return False;
		}
		break;
	case Button2:
	case Button3:
		message_with_args(MCM_mouse_down, which);
		break;
	}
	return True;
}
예제 #6
0
bool MCSessionGenerateID(MCStringRef &r_id)
{
	// php calculates session ids by hashing a string composed of REMOTE_ADDR, time in seconds & milliseconds, and a random value

	MCAutoStringRef t_remote_addr_string;
	char *t_remote_addr;
	t_remote_addr = NULL;

	if (MCS_getenv(MCSTR("REMOTE_ADDR"), &t_remote_addr_string))
		MCCStringClone(MCStringGetCString(*t_remote_addr_string), t_remote_addr);
		
	time_t t_time;
	time(&t_time);
	
	MCAutoDataRef t_randombytes;
    
    // MW-2013-05-21; [[ RandomBytes ]] Use system primitive rather than SSL
	//   directly.
	/* UNCHECKED */ MCU_random_bytes(64, &t_randombytes);
	
	md5_state_t t_state;
	md5_byte_t t_digest[16];
	md5_init(&t_state);
	if (t_remote_addr != NULL)
		md5_append(&t_state, (md5_byte_t *)t_remote_addr, MCCStringLength(t_remote_addr));
	md5_append(&t_state, (md5_byte_t *)&t_time, sizeof(t_time));
	md5_append(&t_state, (md5_byte_t *)MCDataGetBytePtr(*t_randombytes), 64);
	md5_finish(&t_state, t_digest);
	
	return byte_to_hex((uint8_t*)t_digest, 16, r_id);
}
예제 #7
0
bool MCSessionExpireCookie()
{
	MCAutoStringRef t_session_name;
	/* UNCHECKED */ MCS_get_session_name(&t_session_name);
	
	return MCServerSetCookie(*t_session_name, MCSTR("EXPIRE"), MCS_time() - 60 * 60 * 24, nil, nil, false, true);
}
예제 #8
0
Boolean MCColors::mup(uint2 which, bool p_release)
{
	if (!(state & CS_MFOCUSED))
		return False;
	state &= ~CS_MFOCUSED;
	switch (which)
	{
	case Button1:
		switch (getstack()->gettool(this))
		{
		case T_BROWSE:
			message_with_valueref_args(MCM_mouse_up, MCSTR("1"));
			break;
		case T_POINTER:
			end(true, p_release);
			break;
		default:
			return False;
		}
		break;
	case Button2:
	case Button3:
		message_with_args(MCM_mouse_up, which);
		break;
	}
	return True;
}
예제 #9
0
void MCPlatformHandleApplicationStartup(int p_argc, MCStringRef *p_argv, MCStringRef *p_envp, int& r_error_code, MCStringRef & r_error_message)
{
    struct X_init_options t_options;
    t_options.argc = p_argc;
    t_options.argv = p_argv;
    t_options.envp = p_envp;
    t_options.app_code_path = nullptr;

	if (X_init(t_options))
	{
		r_error_code = 0;
		r_error_message = nil;
		return;
	}

    r_error_code = -1;

    if (MCresult == nullptr)
    {
        /* TODO[2017-04-05] X_init() failed before initialising global
         * variables.  This could be because something horrible happened, or it
         * could be because it found "-h" in the arguments.  It's better to
         * quit without an error message than to crash, but it the future it
         * would be good to distinguish between the two. */
        r_error_message = MCValueRetain(kMCEmptyString);
    }
    else if (MCValueGetTypeCode(MCresult -> getvalueref()) == kMCValueTypeCodeString)
    {
        r_error_message = (MCStringRef)MCValueRetain(MCresult->getvalueref());
    }
    else
    {
        r_error_message = MCValueRetain(MCSTR("Unknown error occurred"));
    }
}
예제 #10
0
MCStringRef MCSensorTypeToStringRef(MCSensorType p_sensor)
{
    switch (p_sensor)
    {
        case kMCSensorTypeLocation:
            return MCSTR("location");
        case kMCSensorTypeHeading:
            return MCSTR("heading");
        case kMCSensorTypeAcceleration:
            return MCSTR("acceleration");
        case kMCSensorTypeRotationRate:
            return MCSTR("rotation rate");
        default:
			return MCSTR("unknown");
    }
    return NULL;
}
예제 #11
0
void MCButton::SetStyle(MCExecContext& ctxt, intenum_t p_style)
{
	flags &= ~(F_STYLE | F_DISPLAY_STYLE | F_ALIGNMENT);
	if (entry != NULL)
		deleteentry();

	switch (p_style)
	{
	case kMCButtonStyleStandard:
		flags |= F_STANDARD | F_SHOW_BORDER | F_OPAQUE
				| F_ALIGN_CENTER | F_HILITE_BOTH | F_ARM_BORDER;
		break;
	case kMCButtonStyleMenu:
	case kMCButtonStylePopup:
		flags |= F_MENU | F_SHOW_BORDER | F_OPAQUE | F_ALIGN_CENTER | F_ARM_BORDER;
		if (menumode == WM_COMBO)
			createentry();
		if (menumode == WM_TOP_LEVEL)
		{
			MCValueRelease(tabs);
			/* UNCHECKED */ MCStringSplit(menustring, MCSTR("\n"), nil, kMCStringOptionCompareExact, tabs);
		}
		break;
	case kMCButtonStyleCheck:
		flags |= F_CHECK | F_ALIGN_LEFT;
		break;
	case kMCButtonStyleRadio:
		flags |= F_RADIO | F_ALIGN_LEFT;
		flags &= ~F_SHARED_HILITE;
		break;
	case kMCButtonStyleRoundrect:
		flags |=  F_ROUNDRECT | F_SHOW_BORDER | F_OPAQUE | F_ALIGN_CENTER | F_HILITE_FILL;
		break;
	case kMCButtonStyleRectangle:
		flags |= F_RECTANGLE | F_SHOW_BORDER | F_OPAQUE
		        | F_ALIGN_CENTER | F_HILITE_BOTH | F_ARM_BORDER;
		break;
	case kMCButtonStyleOval:
		flags |= F_OVAL_BUTTON | F_HILITE_FILL;
		break;
	case kMCButtonStyleTransparent:
		flags |= F_STANDARD | F_ALIGN_CENTER;
		break;
	case kMCButtonStyleShadow:
		flags |= F_STANDARD | F_SHOW_BORDER | F_OPAQUE
				| F_SHADOW | F_ALIGN_CENTER | F_HILITE_BOTH | F_ARM_BORDER;
		break;
	case kMCButtonStyleShowBorder:
		flags |= F_STANDARD | F_OPAQUE
		        | F_ALIGN_CENTER | F_HILITE_FILL | F_ARM_BORDER;
		break;
	default:
		break;
	}
	// MW-2011-09-21: [[ Layers ]] Make sure the layerattrs are recomputed.
	m_layer_attr_changed = true;
	Redraw();
}
예제 #12
0
Boolean MCPlayer::mup(uint2 which, bool p_release) //mouse up
{
	if (!(state & CS_MFOCUSED))
		return False;
	if (state & CS_MENU_ATTACHED)
		return MCObject::mup(which, p_release);
	state &= ~CS_MFOCUSED;
	if (state & CS_GRAB)
	{
		ungrab(which);
		return True;
	}
	switch (which)
	{
        case Button1:
            switch (getstack()->gettool(this))
		{
            case T_BROWSE:
                if (!p_release && MCU_point_in_rect(rect, mx, my))
                    message_with_valueref_args(MCM_mouse_up, MCSTR("1"));
                else
                    message_with_valueref_args(MCM_mouse_release, MCSTR("1"));
                
                break;
            case T_PLAYER:
            case T_POINTER:
                end(true, p_release);       //stop dragging or moving the movie object, will change controller size
                break;
            case T_HELP:
                help();
                break;
            default:
                return False;
		}
            break;
        case Button2:
        case Button3:
            if (!p_release && MCU_point_in_rect(rect, mx, my))
                message_with_args(MCM_mouse_up, which);
            else
                message_with_args(MCM_mouse_release, which);
            break;
	}
	return True;
}
예제 #13
0
JNIEXPORT void JNICALL Java_com_runrev_android_Engine_doRequestPurchaseResponse(JNIEnv *env, jobject object,
                                                                                jint purchaseId, jint responseCode)
{
    MCLog("doRequestPurchaseResponse(purchaseId=%d, responseCode=%d", purchaseId, responseCode);
    
    MCPurchase *t_purchase = NULL;
    
    if (MCPurchaseFindById(purchaseId, t_purchase))
    {
        MCAndroidPurchase *t_android_data = (MCAndroidPurchase*)t_purchase->platform_data;
        if (responseCode == RESULT_OK)
        {
            // seems to be sent after purchase updates.
        }
        else if (responseCode == RESULT_USER_CANCELED)
        {
            t_purchase->state = kMCPurchaseStateCancelled;
            MCPurchaseNotifyUpdate(t_purchase);
            MCPurchaseRelease(t_purchase);
        }
        else if (responseCode == RESULT_ITEM_UNAVAILABLE)
        {
            t_purchase->state = kMCPurchaseStateError;
            t_android_data->error = MCSTR("requested item unavailable");
            MCPurchaseNotifyUpdate(t_purchase);
            MCPurchaseRelease(t_purchase);            
        }
        else if (responseCode == RESULT_DEVELOPER_ERROR)
        {
            t_purchase->state = kMCPurchaseStateError;
			t_android_data->error = MCSTR("developer error");
            MCPurchaseNotifyUpdate(t_purchase);
            MCPurchaseRelease(t_purchase);            
        }
        else if (responseCode == RESULT_ERROR)
        {
            t_purchase->state = kMCPurchaseStateError;
			t_android_data->error = MCSTR("sending purchase request failed");
            MCPurchaseNotifyUpdate(t_purchase);
            MCPurchaseRelease(t_purchase);
        }
    }
}
예제 #14
0
void MCPurchaseVerify(MCPurchase *p_purchase, bool p_verified)
{
    MCAndroidPurchase *t_android_data = (MCAndroidPurchase*)p_purchase->platform_data;
    if (p_purchase->state == kMCPurchaseStateUnverified)
    {
        if (p_verified)
        {
            switch (t_android_data->purchase_state) {
                case PURCHASED:
                    p_purchase->state = kMCPurchaseStatePaymentReceived;
                    break;
                    
                case CANCELED:
                {
                    //MCLog("verified canceled purchase", nil);
                    p_purchase->state = kMCPurchaseStateCancelled;
                    purchase_confirm(p_purchase);
                    break;
                }
                
                case ALREADY_ENTITLED:
                {
                    MCLog("found ALREADY_ENTITLED purchase", nil);
                    p_purchase->state = kMCPurchaseStateAlreadyEntitled;
                    break;
                }
                case INVALID_SKU:
                    p_purchase->state = kMCPurchaseStateInvalidSKU;
                    break;
                    
                case REFUNDED:
                    //MCLog("verified refunded purchase", nil);
                    p_purchase->state = kMCPurchaseStateRefunded;
                    break;
                    
                case RESTORED:
                    p_purchase->state = kMCPurchaseStateRestored;
                    break;
                    
                default:
                    break;
            }
            MCPurchaseNotifyUpdate(p_purchase);
        }
        else
        {
            p_purchase->state = kMCPurchaseStateError;

            t_android_data->error = MCValueRetain(MCSTR("unable to verify message from billing service"));                                                 
			MCPurchaseNotifyUpdate(p_purchase);

            MCPurchaseRelease(p_purchase);
        }
    }
}
예제 #15
0
static void testAddresses()
{
    mailcore::Address *addr = mailcore::Address::addressWithNonEncodedRFC822String(MCSTR("DINH Viêt Hoà <*****@*****.**>"));
    MCLog("%s %s", MCUTF8DESC(addr->nonEncodedRFC822String()), MCUTF8DESC(addr->RFC822String()));
    
    mailcore::Array *addresses = mailcore::Address::addressesWithNonEncodedRFC822String(MCSTR("My Email1 <*****@*****.**>, DINH Viêt Hoà <*****@*****.**>,\"Email3, My\" <*****@*****.**>"));
    MCLog("%s", MCUTF8DESC(addresses));
    mailcore::String *str = mailcore::Address::nonEncodedRFC822StringForAddresses(addresses);
    MCLog("%s", MCUTF8DESC(str));
    str = mailcore::Address::RFC822StringForAddresses(addresses);
    MCLog("%s", MCUTF8DESC(str));
}
예제 #16
0
static void testIMAPMove()
{
    mailcore::IMAPSession * session;
    mailcore::HashMap *uidMapping;
    mailcore::ErrorCode error;
    
    session = new mailcore::IMAPSession();
    session->setHostname(MCSTR("imap.mail.ru"));
    session->setPort(993);
    session->setUsername(email);
    session->setPassword(password);
    session->setConnectionType(mailcore::ConnectionTypeTLS);

    session->moveMessages(MCSTR("INBOX"),
                          mailcore::IndexSet::indexSetWithIndex(14990),
                          MCSTR("Personal"), &uidMapping, &error);
    
    MCLog("mapping: %s, error: %i", MCUTF8DESC(uidMapping), error);
    
    session->release();
}
예제 #17
0
static void testIMAP()
{
    mailcore::IMAPSession * session;
    mailcore::ErrorCode error;
    
    session = new mailcore::IMAPSession();
    session->setHostname(MCSTR("imap.gmail.com"));
    session->setPort(993);
    session->setUsername(email);
    session->setPassword(password);
    session->setConnectionType(mailcore::ConnectionTypeTLS);
    
    mailcore::IMAPMessagesRequestKind requestKind = (mailcore::IMAPMessagesRequestKind)
    (mailcore::IMAPMessagesRequestKindHeaders | mailcore::IMAPMessagesRequestKindStructure |
     mailcore::IMAPMessagesRequestKindInternalDate | mailcore::IMAPMessagesRequestKindHeaderSubject |
     mailcore::IMAPMessagesRequestKindFlags);
    mailcore::Array * messages = session->fetchMessagesByUID(MCSTR("INBOX"),
                                                             requestKind, mailcore::IndexSet::indexSetWithRange(mailcore::RangeMake(1, UINT64_MAX)), NULL, &error);
    MCLog("%s", MCUTF8DESC(messages));
    
    session->release();
}
예제 #18
0
Boolean MCPlayer::mdown(uint2 which)
{
	if (state & CS_MFOCUSED || flags & F_DISABLED)
		return False;
	if (state & CS_MENU_ATTACHED)
		return MCObject::mdown(which);
	state |= CS_MFOCUSED;
	if (flags & F_TRAVERSAL_ON && !(state & CS_KFOCUSED))
		getstack()->kfocusset(this);
	switch (which)
	{
        case Button1:
            switch (getstack()->gettool(this))
		{
            case T_BROWSE:
                if (message_with_valueref_args(MCM_mouse_down, MCSTR("1")) == ES_NORMAL)
                    return True;
                break;
            case T_POINTER:
            case T_PLAYER:  //when the movie object is in editing mode
                start(True); //starting draggin or resizing
                playpause(True);  //pause the movie
                break;
            case T_HELP:
                break;
            default:
                return False;
		}
            break;
		case Button2:
            if (message_with_valueref_args(MCM_mouse_down, MCSTR("2")) == ES_NORMAL)
                return True;
            break;
		case Button3:
            message_with_valueref_args(MCM_mouse_down, MCSTR("3"));
            break;
	}
	return True;
}
예제 #19
0
bool MCSessionCreateSession(MCSessionIndexRef p_index, MCStringRef p_session_id, MCSession *&r_session)
{
	bool t_success = true;
	
	MCSession *t_session = NULL;

	MCAutoStringRef t_remote_addr_string;
	char *t_remote_addr;
	t_remote_addr = NULL;

	if (MCS_getenv(MCSTR("REMOTE_ADDR"), &t_remote_addr_string))
		MCCStringClone(MCStringGetCString(*t_remote_addr_string), t_remote_addr);
	
	t_success = MCMemoryNew(t_session);
	
	if (t_success)
		t_success = MCCStringClone(t_remote_addr ? t_remote_addr : "", t_session->ip);

	if (t_success)
	{
		if (p_session_id != nil && !MCStringIsEmpty(p_session_id))
		{
			t_session->id = strdup(MCStringGetCString(p_session_id));
			t_success = true;
		}
		else
		{
			MCAutoStringRef t_session_id;
			t_success = MCSessionGenerateID(&t_session_id);
			t_session->id = strdup(MCStringGetCString(*t_session_id));
		}
	}
	
	if (t_success)
		t_success = MCCStringFormat(t_session->filename, "%s_%s", t_remote_addr ? t_remote_addr : "", t_session->id);
	
	if (t_success)
		t_success = MCSessionIndexAddSession(p_index, t_session);
	
	if (t_success)
		r_session = t_session;
	else
	{
		if (t_session != NULL)
			MCSessionCloseSession(t_session, false);
	}
	
	return t_success;
}
예제 #20
0
파일: eps.cpp 프로젝트: alilloyd/livecode
Boolean MCEPS::mup(uint2 which, bool p_release)
{
	if (!(state & CS_MFOCUSED))
		return False;
	state &= ~CS_MFOCUSED;
	switch (which)
	{
	case Button1:
		switch (getstack()->gettool(this))
		{
		case T_BROWSE:
			if (!p_release && MCU_point_in_rect(rect, mx, my))
                message_with_valueref_args(MCM_mouse_up, MCSTR("1"));
            else
                message_with_valueref_args(MCM_mouse_release, MCSTR("1"));
			break;
		case T_POINTER:
			end(true, p_release);
			break;
		case T_HELP:
			help();
			break;
		default:
			return False;
		}
		break;
	case Button2:
	case Button3:
		if (!p_release && MCU_point_in_rect(rect, mx, my))
			message_with_args(MCM_mouse_up, which);
        else
            message_with_args(MCM_mouse_release, which);
		break;
	}
	return True;
}
예제 #21
0
	bool getwidgetpreferredsize(uint32_t &r_width, uint32_t &r_height)
	{
		MCExecContext ctxt(MCdefaultstackptr, nil, nil);
		MCAutoValueRef t_value;
		t_value = MCEngineGetPropertyOfObject(ctxt, MCSTR("preferredSize"), m_widget, 0);
		if (MCErrorIsPending())
			return false;
		
		if (MCValueIsEmpty(*t_value))
			return false;
		
		if (!WidgetGeometryFromLCBList(*t_value, r_width, r_height))
			return MCErrorCreateAndThrow(kMCWidgetSizeFormatErrorTypeInfo, nil);
		
		return true;
	}
예제 #22
0
static void testSMTP(mailcore::Data * data)
{
    mailcore::SMTPSession * smtp;
    mailcore::ErrorCode error;
    
    smtp = new mailcore::SMTPSession();
    
    smtp->setHostname(MCSTR("smtp.gmail.com"));
    smtp->setPort(25);
    smtp->setUsername(email);
    smtp->setPassword(password);
    smtp->setConnectionType(mailcore::ConnectionTypeStartTLS);
    
    smtp->sendMessage(data, NULL, &error);
    
    smtp->release();
}
예제 #23
0
static void testPOP()
{
    mailcore::POPSession * session;
    mailcore::ErrorCode error;
    
    session = new mailcore::POPSession();
    session->setHostname(MCSTR("pop.gmail.com"));
    session->setPort(995);
    session->setUsername(email);
    session->setPassword(password);
    session->setConnectionType(mailcore::ConnectionTypeTLS);
    
    mailcore::Array * messages = session->fetchMessages(&error);
    MCLog("%s", MCUTF8DESC(messages));
    
    session->release();
}
예제 #24
0
static void testNNTP()
{
    mailcore::NNTPSession * session;
    mailcore::ErrorCode error;
    
    session = new mailcore::NNTPSession();
    session->setHostname(MCSTR("news.gmane.org."));
    session->setPort(119);
//    session->setUsername(email);
//    session->setPassword(password);
    session->setConnectionType(mailcore::ConnectionTypeClear);
    
    session->checkAccount(&error);
    mailcore::Array * messages = session->listAllNewsgroups(&error);
    MCLog("%s", MCUTF8DESC(messages));
    
    session->release();

}
예제 #25
0
bool MCSessionFindMatchingSession(MCSessionIndexRef p_index, MCStringRef p_session_id, MCSession *&r_session)
{
	MCAutoStringRef t_remote_addr_str;
	
	const char *t_remote_addr = NULL;

	if (!MCS_getenv(MCSTR("REMOTE_ADDR"), &t_remote_addr_str))
		t_remote_addr = "";
	else
		t_remote_addr = MCStringGetCString(*t_remote_addr_str);

	for (uint32_t i = 0; i < p_index->session_count; i++)
	{
		if (MCStringIsEqualToCString(p_session_id, p_index->session[i]->id, kMCCompareExact) && MCCStringEqual(p_index->session[i]->ip, t_remote_addr))
		{
			r_session = p_index->session[i];
			return true;
		}
	}
	
	return false;
}
예제 #26
0
static void testAsyncSMTP(mailcore::Data * data)
{
    mailcore::SMTPAsyncSession * smtp;
    TestSMTPCallback * callback = new TestSMTPCallback();
    
    smtp = new mailcore::SMTPAsyncSession();
    
    smtp->setHostname(MCSTR("smtp.gmail.com"));
    smtp->setPort(25);
    smtp->setUsername(email);
    smtp->setPassword(password);
    smtp->setConnectionType(mailcore::ConnectionTypeStartTLS);
    
    mailcore::SMTPOperation * op = smtp->sendMessageOperation(data);
    op->setSmtpCallback(callback);
    op->setCallback(callback);
    op->start();
    
	mainLoop();

    //smtp->release();
}
예제 #27
0
void MCButton::SetMenuMode(MCExecContext& ctxt, intenum_t p_mode)
{
	if (entry != nil)
		deleteentry();
	else
		freemenu(False);

	setmenumode((uint1)p_mode);
	
	if (p_mode == WM_COMBO)
		createentry();
	else if (p_mode == WM_TOP_LEVEL)
	{
		if (getstyleint(flags) == F_MENU)
		{
			MCValueRelease(tabs);
			/* UNCHECKED */ MCStringSplit(menustring, MCSTR("\n"), nil, kMCStringOptionCompareExact, tabs);
		}
	}
	
	Redraw();
}
예제 #28
0
static void testAsyncPOP()
{
    mailcore::POPAsyncSession * session;
    TestPOPCallback * callback = new TestPOPCallback();
    
    session = new mailcore::POPAsyncSession();
    session->setHostname(MCSTR("pop.gmail.com"));
    session->setPort(995);
    session->setUsername(email);
    session->setPassword(password);
    session->setConnectionType(mailcore::ConnectionTypeTLS);
    
    mailcore::POPFetchMessagesOperation * op = session->fetchMessagesOperation();
    op->setCallback(callback);
    op->setPopCallback(callback);
    op->start();
    
    //mailcore::Array * messages = session->fetchMessages(&error);
    //MCLog("%s", MCUTF8DESC(messages));
    
	mainLoop();
}
예제 #29
0
파일: font.cpp 프로젝트: alilloyd/livecode
// MW-2011-11-23: [[ Array TextStyle ]] Turn the given style on or off in the style
//   set.
void MCF_changetextstyle(uint2& x_style_set, Font_textstyle p_style, bool p_new_state)
{
	uint2 t_flag;
	t_flag = 0;
	switch(p_style)
	{
	case FTS_BOLD:
		MCF_setweightstring(x_style_set, p_new_state ? MCSTR("bold") : MCSTR("medium"));
		return;
	case FTS_CONDENSED:
		MCF_setexpandstring(x_style_set, p_new_state ? MCSTR("condensed") : MCSTR("normal"));
		return;
	case FTS_EXPANDED:
		MCF_setexpandstring(x_style_set, p_new_state ? MCSTR("expanded") : MCSTR("normal"));
		return;
	case FTS_ITALIC:
		t_flag = FA_ITALIC;
		break;
	case FTS_OBLIQUE:
		t_flag = FA_OBLIQUE;
		break;
	case FTS_BOX:
		t_flag = FA_BOX;
		break;
	case FTS_3D_BOX:
		t_flag = FA_3D_BOX;
		break;
	case FTS_UNDERLINE:
		t_flag = FA_UNDERLINE;
		break;
	case FTS_STRIKEOUT:
		t_flag = FA_STRIKEOUT;
		break;
	case FTS_LINK:
		t_flag = FA_LINK;
		break;
	default:
		break;
	}
	if (p_new_state)
		x_style_set |= t_flag;
	else
		x_style_set &= ~t_flag;
}
예제 #30
0
Boolean MCColors::mdown(uint2 which)
{
	if (state & CS_MFOCUSED)
		return False;
	state |= CS_MFOCUSED;
	MCColor color;
	switch (which)
	{
	case Button1:
		switch (getstack()->gettool(this))
		{
		case T_BROWSE:
			uint2 xcells;
			uint2 ycells;
			getcells(xcells, ycells);
			MCscreen->getpaletteentry((my - rect.y) * ycells / rect.height * xcells
			                          + (mx - rect.x) * xcells / rect.width, color);
			selectedcolor = color.pixel;
			// MW-2011-08-18: [[ Layers ]] Invalidate the whole object.
			layer_redrawall();
			message_with_valueref_args(MCM_mouse_down, MCSTR("1"));
			break;
		case T_POINTER:
			start(True);
			break;
		default:
			return False;
		}
		break;
	case Button2:
	case Button3:
		message_with_args(MCM_mouse_down, which);
		break;
	}
	return True;
}