Пример #1
0
void AIMNetManager::MishMashWarningFunction( int type, SNAC_Object& snac )
{
	BMessage* msg;

	// you got booted because someone signed on w/ the same screen name
	if( type == 1 ) {
		printf( "You are being IMPERSONATED!!!! AAAAAAAHHHHHHH!!!!!\n" );
	
		// kill the connection and let 'em know why they got booted
		Logout();
		msg = new BMessage(BEAIM_DISCONNECTED);
		msg->AddBool("quietly", true);
		PostAppMessage( msg );
		windows->ShowMessage( Language.get("ERR_BEING_IMPERSONATED"), B_STOP_ALERT );
	}
	
	// you missed a few messages due to somebody else's rate violation
	else if( type == 2 ) {
		printf( "some messages were missed... the other person sent them too fast.\n" );
		windows->ShowMessage( Language.get("ERR_MISSED_MESSAGES"), B_INFO_ALERT );
	}
	
	// you did a rate violation yourself, you naughty person, you!
	else if( type == 3 ) {
		printf( "Rate violation!\n" );
		windows->ShowMessage( Language.get("ERR_RATE_VIOLATION"), B_STOP_ALERT, Language.get("BEHAVE_LABEL"), WS_WARNED );
	}
}
Пример #2
0
void InfoWindow::AskAway() {

	BMessage* awMsg = new BMessage(BEAIM_GET_AWAY_INFO);
	awMsg->AddString( "userid", userName.UserString() );
	PostAppMessage( awMsg );
	askedAway = true;
}
Пример #3
0
// Receive message function
void AIMNetManager::ReceiveMessage( SNAC_Object& snac ) {

	short i = 10;
	unsigned short temp, temp2;
	unsigned int languageValue;
	bool autoRespond = false;
	BMessage* incomingMsg = new BMessage(BEAIM_INCOMING_IM);
	DataContainer msg;
	
	// Grab the other person's info
	DecodeBuddyStuff( snac.data, i, incomingMsg );

	// This will be either 0x0002 or 0x0004 (autorespond mode?)
	temp = (unsigned short)GetWord( snac.data, i );
	i += 2;
	if( temp == 0x0004 ) {
		temp = (unsigned short)GetWord( snac.data, i );		// 0x0000
		temp = (unsigned short)GetWord( snac.data, i+2 );	// 0x0002
		autoRespond = true;
		i += 4;
	}

	if( autoRespond )
		printf( "AutoResponded IM...\n" );
	incomingMsg->AddBool( "autorespond", autoRespond );

	// Reality check
	if( temp != 0x0002 )
		printf( "RECV_MESSAGE ERROR: temp should be 0x0002, not 0x%X!\n", temp );
	
	// Get the message length (with 0x0D tacked on), and fixed value 0x0501
	temp = (unsigned short)GetWord( snac.data, i );
	temp = (unsigned short)GetWord( snac.data, i+2 );
	i += 4;
	
	// Another reality check
	if( temp != 0x0501 )
		printf( "RECV_MESSAGE ERROR: temp should be 0x0501, not 0x%X!\n", temp );
	
	// Grab the mysterious language value
	temp = (unsigned short)GetWord( snac.data, i );
	temp2 = (unsigned short)GetWord( snac.data, temp + i + 8 );
	languageValue = (temp2 << 16) + (unsigned short)GetWord( snac.data, temp + i + 6 );
	incomingMsg->AddInt32( "languagevalue", (int32)languageValue );
	i += 2;	
	
	printf( "Mysterious Language value: 0x%X\n", (unsigned)languageValue );
	
	// Get the message itself
	msg = snac.data.getrange( temp + i + 8 );
	msg << char(0);
	incomingMsg->AddString( "message", (char*)msg.c_ptr() );
	
	printf( "actual message: %s\n", msg.c_ptr() );
	
	// Send the message off its final resting place... the great bit-bucket in the sky
	incomingMsg->AddInt32( "wtype", (int32)USER_MESSAGE_TYPE );
	PostAppMessage( incomingMsg );
}
Пример #4
0
bool InfoWindow::QuitRequested()
{
	// Tell the main app that the window has been closed
	BMessage* sendMessage = new BMessage( BEAIM_IM_WINDOW_CLOSED );
	sendMessage->AddInt32( "wtype", (int32)USER_INFO_TYPE );
	sendMessage->AddString( "userid", userName.UserString() );
	PostAppMessage( sendMessage );
	
	return true;
}
Пример #5
0
/*
 * doExitTask:
 *
 * handle NFY_EXITTASK notification
 *
 * If the task was the debuggee, we notify the debugger that the
 * debuggee has terminated.
 */
static BOOL doExitTask( DWORD data )
{
    data = data;

    if( TaskAtNotify == DebugeeTask ) {
        TerminateCSIP = TaskGetCSIP( DebugeeTask );
        PostAppMessage( DebuggerTask, WM_NULL, TASK_ENDED, MAGIC_COOKIE );
    }
    return( FALSE );

} /* doExitTask */
Пример #6
0
bool AwayEditorWindow::QuitRequested()
{
	if( !CheckMessage() )
		return false;

	BMessage* clsMessage = new BMessage(BEAIM_SINGLE_WINDOW_CLOSED);
	clsMessage->AddInt32( "wtype", SW_AWAY_EDITOR );
	PostAppMessage( clsMessage );
	
	return(true);
}
Пример #7
0
void AIMNetManager::ReceiveFailedSearch( SNAC_Object& snac ) {

	// is this the current search? If not, ignore it
	if( snac.GetRequestID() != emailSearchID )
		return;
		
	// post a message saying that the search failed
	BMessage* failMessage = new BMessage( BEAIM_EMAIL_SEARCH_RESULTS );
	failMessage->AddBool( "failed", true );
	PostAppMessage( failMessage );	
}
Пример #8
0
InfoWindow::InfoWindow( BRect frame, AIMUser uName )
				: BWindow(frame, "", B_TITLED_WINDOW, B_NOT_RESIZABLE | B_NOT_ZOOMABLE )
{
	char windowTitle[DISPLAY_NAME_MAX+50];
	userName = uName;

	// Make the message to request the info
	BMessage* infMessage = new BMessage( BEAIM_GET_USER_INFO );
	infMessage->AddString( "userid", uName.UserString() );

	// do some name stuff
	sprintf( windowTitle, "%s: %s", Language.get("IW_USER_INFO"), uName.UserString() );
	SetTitle( windowTitle );

	// invoke the instantiation routine to create a new view 
	BRect rect = Bounds();
	rect.bottom -= 15;
	iView = new InfoView( users->IsABuddy(uName), rect, "InfoView", infMessage, users->GetBuddyEncoding(uName) ); 

	// add the view to the window 
	AddChild(iView);

	// make the stats view
	BRect statFrame = Bounds();
	statFrame.bottom = Bounds().bottom;
	statFrame.top = statFrame.bottom - 14;
	statView = new GStatusView( (char*)LangWithSuffix("IM_WAITING_FOR_INFO", B_UTF8_ELLIPSIS), statFrame );
	statView->SetSpinner(true);
	AddChild( statView );
	
	// Tell the main app that the window has been opened
	BMessage* sendMessage = new BMessage( BEAIM_IM_WINDOW_OPENED );
	sendMessage->AddInt32( "wtype", (int32)USER_INFO_TYPE );
	sendMessage->AddString( "userid", uName.UserString() );
	sendMessage->AddPointer( "new_window", this );
	PostAppMessage( sendMessage );
	
	gotInfo = false;
	gotAway = false;
	needsAway = false;
	askedAway = false;
	
	// get all the language stuff taken care of
	RefreshLangStrings();
}
Пример #9
0
void AwayEditorWindow::DeleteMessage() {

	if( client->AwayMode() == AM_STANDARD_MESSAGE ) {
		if( client->CurrentAwayMessageName() == currentMsg ) {
			windows->ShowMessage( Language.get("AME_ERR1"), B_INFO_ALERT );
			return;
		}
	}

	prefs->RemoveAwayMessage( currentMsg );
	currentMsg = "";
	hasSelection = false;
	isDirty = false;
	genView->textview->MakeDirty(false);
	BuildList();
	EnableMessageStuff(false);
	PostAppMessage( new BMessage(BEAIM_LOAD_AWAY_MENU) );
}
Пример #10
0
bool AwayEditorWindow::SaveMessage() {

	if( client->AwayMode() == AM_STANDARD_MESSAGE ) {
		if( client->CurrentAwayMessageName() == currentMsg ) {
			windows->ShowMessage( Language.get("AME_ERR1"), B_INFO_ALERT );
			return false;
		}
	}

	BString text = genView->messageName->Text();
	if( text == BString(Language.get("AME_NEW_MESSAGE")) || text == BString("") ) {
		windows->ShowMessage( Language.get("AME_ERR2"), B_WARNING_ALERT );
		Revert();
		genView->messageName->MakeFocus(true);
		return false;
	}

	if( (text != currentMsg) && (prefs->FindAwayMessage(text) != -1) ) {
		windows->ShowMessage( Language.get("AME_ERR3"), B_WARNING_ALERT );
		Revert();
		genView->messageName->MakeFocus(true);
		return false;	
	}

	int32 selected = genView->listview->CurrentSelection();
	BString message = genView->textview->Text();
	message.ReplaceAll( "\n", "<br>" );
	prefs->SetAwayMessage( genView->messageName->Text(), currentMsg, message );
	BuildList();
	
	isDirty = false;
	genView->textview->MakeDirty(false);
	genView->listview->Select( selected );
	PostAppMessage( new BMessage(BEAIM_LOAD_AWAY_MENU) );
	return true;
}
Пример #11
0
void AIMNetManager::ReceiveSearchResults( SNAC_Object& snac ) {

	DataContainer name;
	char actualName[50];	
	unsigned short length;
	BMessage* sndMessage;
	short i = 0;

	// is this the current search? If not, ignore it
	if( snac.GetRequestID() != emailSearchID )
		return;

	// go through and suck out all the search results
	while( (snac.data.length() - i) > 4 ) {

		// get 0x0001 (a constant), and the length of the screen name
		GetWord( snac.data, i );
		length = (unsigned short)GetWord( snac.data, i+2 );
		i += 4;
		
		printf( "SR---> SN length: %d chars\n", length );
		
		// get the screen name itself
		name = snac.data.getrange( i, length );
		strncpy( actualName, name.c_ptr(), length );
		actualName[length] = '\0';
		i += length;
		
		printf( "SR---> SN name: %s\n", name.c_ptr() );
		
		// send a message with this match
		sndMessage = new BMessage( BEAIM_EMAIL_SEARCH_RESULTS );
		sndMessage->AddString( "userid", actualName );
		PostAppMessage( sndMessage );
	}
}
Пример #12
0
restart_opts DebugeeWaitForMessage( void )
{
    MSG         msg;
    HANDLE      huser;
    HWND        hwnddtop;
    HWND        capture;
    HWND        wnd;
    HANDLE      hinst;

    /*
     * give up any capture in context of debugee
     */
    capture = SetCapture(NULL);
    if( capture != NULL ) {
        ReleaseCapture();
        Out((OUT_SOFT,"Capture hwnd=%04x", capture ));
    }

    /*
     * hang out and wait
     */
    huser = GetModuleHandle( "USER");
    hwnddtop = GetDesktopWindow();
    wnd = GetFocus();
    if( IsTaskWnd( wnd ) ) {
        FocusWnd = wnd;
    }
    wnd = GetActiveWindow();
    if( IsTaskWnd( wnd ) ) {
        ActiveWnd = wnd;
    }
    if( HardModeRequired || SystemDebugState == SDS_NOTASKQUEUE || DebuggerWindow == NULL ) {
        Out((OUT_SOFT,"In HardMode Loop! req=%d,SDS=%d,Window=%4.4x",HardModeRequired,SystemDebugState,DebuggerWindow ));
        while( DebuggerState == ACTIVE ) {
            DirectedYield( DebuggerTask );
        }
        if( capture != NULL ) {
            SetCapture( capture );
        }
        return( AppMessage );
    }

    Out((OUT_SOFT,"In SoftMode Loop task=%04x(%04x), act=%04x, foc=%04x, t=%d, DW=%04x", GetCurrentTask(), DebugeeTask, ActiveWnd, FocusWnd, TraceOn, DebuggerWindow ));

    DefaultProcInstance = (FARPROC)MakeProcInstance( (FARPROC)DefaultProc, DebugeeInstance );

    EnumTaskProcInstance = MakeProcInstance( (FARPROC)EnumTaskWindowsFunc, DebugeeInstance );
    EnumChildProcInstance = MakeProcInstance( (FARPROC)EnumChildWindowsFunc, DebugeeInstance );
    EnumTaskWindows( GetCurrentTask(), (WNDENUMPROC)EnumTaskProcInstance, 0 );
    FreeProcInstance( EnumChildProcInstance );
    FreeProcInstance( EnumTaskProcInstance );

    while( 1 ) {
        GetMessage( &msg, NULL, 0, 0 );
        if( msg.hwnd == NULL &&
            msg.message == WM_NULL && msg.lParam == MAGIC_COOKIE ) break;
        if( msg.hwnd != NULL ) {
            hinst = (HINSTANCE)GetWindowWord( msg.hwnd, GWW_HINSTANCE );
        } else {
            hinst = NULL;
        }
        if( msg.hwnd == hwnddtop || hinst == huser ) {
            TranslateMessage( &msg );
            DispatchMessage( &msg );
        } else {
            SubClassProc( msg.hwnd, msg.message, msg.wParam, msg.lParam );
        }
    }
    if( !TraceOn && DebuggerWindow != NULL ) {
        if( IsTaskWnd( FocusWnd ) ) {
            Out((OUT_SOFT,"Focus Window to %4.4x", FocusWnd ));
            SetFocus( FocusWnd );
        }
        if( IsTaskWnd( ActiveWnd ) ) {
            Out((OUT_SOFT,"Active Window to %4.4x", ActiveWnd ));
            SetActiveWindow( ActiveWnd );
        }
    }
    ExitSoftMode();
    FreeProcInstance( DefaultProcInstance );
    if( capture != NULL ) {
        SetCapture( capture );
    }
    Out((OUT_SOFT,"active=%04x, focus=%04x, TraceOn=%d, DW=%04x", ActiveWnd, FocusWnd, TraceOn, DebuggerWindow ));
    PostAppMessage( GetCurrentTask(), WM_NULL, 0, 0L );
    return( msg.wParam );

} /* DebugeeWaitForMessage */
Пример #13
0
void DIGENTRY MADUNLOAD( void )
{
    PostAppMessage( TaskId, WM_QUIT, 0, 0 );
}
Пример #14
0
void AIMNetManager::Disconnected( nlID nid )
{
	PostAppMessage( new BMessage(BEAIM_DISCONNECTED) );
}
Пример #15
0
DIG_DLLEXPORT void DIGENTRY DIPUNLOAD( void )
{
    PostAppMessage( TaskId, WM_QUIT, 0, 0 );
}
Пример #16
0
void InfoView::AttachedToWindow() {

	bool isAway = false;
	int awayOff = awayOffset;
	if( !isAway )
		awayOff = 0;

	BRect labelFrame1, labelFrame2;
	BFont chatFont;

	// Make the box frame
	BRect boxFrame = Bounds();
	boxFrame.InsetBy(10,5);
	boxFrame.bottom = 125;

	// make the box
	infoBox = new BBox( boxFrame );
	
	// set up the label frames
	labelFrame1 = boxFrame;
	labelFrame1.InsetBy( 12, 15 );
	labelFrame1.bottom = labelFrame1.top + 20;
	labelFrame2 = labelFrame1;
//	labelFrame2.right += 10;
	labelFrame2.left = Bounds().Width() / 2 - 13;

	// make lots of labels
	label1 = new BStringView( labelFrame1, "label1", "User Class:" );
	label1->SetFont(be_bold_font);
	label1->SetFontSize(11);
	labelFrame1.top += 18;
	labelFrame1.bottom += 18;
	infoBox->AddChild( label1 );

	label2 = new BStringView( labelFrame2, "label2", "--" );
	label2->SetFont(be_plain_font);
	label2->SetFontSize(11);
	labelFrame2.top += 18;
	labelFrame2.bottom += 18;
	infoBox->AddChild( label2 );
	
	label3 = new BStringView( labelFrame1, "label3", "Member Since:" );
	label3->SetFont(be_bold_font);
	label3->SetFontSize(11);
	labelFrame1.top += 18;
	labelFrame1.bottom += 18;
	infoBox->AddChild( label3 );

	label4 = new BStringView( labelFrame2, "label4", "--" );
	label4->SetFont(be_plain_font);
	label4->SetFontSize(11);
	labelFrame2.top += 18;
	labelFrame2.bottom += 18;
	infoBox->AddChild( label4 );
	
	label5 = new BStringView( labelFrame1, "label5", "Online Time:" );
	label5->SetFont(be_bold_font);
	label5->SetFontSize(11);
	labelFrame1.top += 18;
	labelFrame1.bottom += 18;
	infoBox->AddChild( label5 );

	label6 = new BStringView( labelFrame2, "label6", "--" );
	label6->SetFont(be_plain_font);
	label6->SetFontSize(11);
	labelFrame2.top += 18;
	labelFrame2.bottom += 18;
	infoBox->AddChild( label6 );	
	
	label7 = new BStringView( labelFrame1, "label7", "Warning Level:" );
	label7->SetFont(be_bold_font);
	label7->SetFontSize(11);
	labelFrame1.top += 18;
	labelFrame1.bottom += 18;
	infoBox->AddChild( label7 );

	label8 = new BStringView( labelFrame2, "label8", "--" );
	label8->SetFont(be_plain_font);
	label8->SetFontSize(11);
	labelFrame2.top += 18;
	labelFrame2.bottom += 18;
	infoBox->AddChild( label8 );

	label9 = new BStringView( labelFrame1, "label9", "Status:" );
	label9->SetFont(be_bold_font);
	label9->SetFontSize(11);
	labelFrame1.top += 18;
	labelFrame1.bottom += 18;
	infoBox->AddChild( label9 );

	label10 = new BStringView( labelFrame2, "label10", "--" );
	label10->SetFont(be_plain_font);
	label10->SetFontSize(11);
	labelFrame2.top += 18;
	labelFrame2.bottom += 18;
	infoBox->AddChild( label10 );	
	
	// resize for the away stuff if necessary
	if( isAway ) {
		ResizeBy( 0, awayOff );
		Window()->ResizeBy( 0, awayOff );
	}

	// make the away label
	BRect awayLabelRect = boxFrame;
	awayLabelRect.bottom = awayLabelRect.top + 20;
	awayLabelRect.OffsetBy( 0, boxFrame.Height() + 3 );
	awayLabel = new BStringView( awayLabelRect, "awaylabel", "Away Message:" );
	awayLabel->SetFont(be_bold_font);
	awayLabel->SetFontSize(12);		
	AddChild( awayLabel );
	if( !isAway )
		awayLabel->Hide();

	// make the textview
	BRect trect, txrect;
	trect = boxFrame;
	trect.OffsetBy( 0, boxFrame.Height() + 25 );
	trect.right -= B_V_SCROLL_BAR_WIDTH;
	trect.bottom = trect.top + 48;
	txrect = trect;
	txrect.OffsetTo( 0, 0 );
	txrect.InsetBy( 2, 2 );
	awaymessage = new FancyTextView( trect, "text_view", txrect, B_FOLLOW_NONE );
	awayHolder = new BScrollView( "profholder", awaymessage, B_FOLLOW_NONE, 0, false, true ); 
	if( !isAway )
		awayHolder->Hide();

	// Whew... make the profile label
	BRect profLabelRect = boxFrame;
	profLabelRect.bottom = profLabelRect.top + 20;
	profLabelRect.OffsetBy( 0, boxFrame.Height() + 3 + awayOff );
	profileLabel = new BStringView( profLabelRect, "proflabel", "Profile:" );
	profileLabel->SetFont(be_bold_font);
	profileLabel->SetFontSize(12);	
	AddChild( profileLabel );	
	
	// make the textview
	trect = boxFrame;
	trect.OffsetBy( 0, boxFrame.Height() + 25 + awayOff );
	trect.right -= B_V_SCROLL_BAR_WIDTH;
	trect.bottom = trect.top + 80;
	txrect = trect;
	txrect.OffsetTo( 0, 0 );
	txrect.InsetBy( 2, 2 );
	profile = new FancyTextView( trect, "text_view", txrect, B_FOLLOW_NONE );
	profHolder = new BScrollView( "profholder", profile, B_FOLLOW_NONE, 0, false, true ); 
	
	// Set the textview's base font and attributes
	rgb_color black;
	black.red = black.green = black.blue = 0;
	chatFont.SetSize( 12.0 );
	profile->SetBaseFontAndColor( chatFont, black );
	profile->MakeEditable( false );
	profile->SetStylable( true );
	profile->SetAutoScrollEnabled( false );
	awaymessage->SetBaseFontAndColor( chatFont, black );
	awaymessage->MakeEditable( false );
	awaymessage->SetStylable( true );
	awaymessage->SetAutoScrollEnabled( false );
	
	// make some buttons
	addToListButton = new BButton( BRect(7,trect.bottom+10,120,trect.bottom+34), "add",
							Language.get("ADD_BLIST_LABEL"), new BMessage(BEAIM_ADD_BUDDY) );
	addToListButton->ResizeToPreferred();
	addToListButton->SetEnabled( !isBuddy );
	
	closeButton = new BButton( BRect(Bounds().right-68, trect.bottom + 10,
							   Bounds().right-8, trect.bottom + 34), "close", Language.get("CLOSE_LABEL"),
							   new BMessage(BEAIM_CLOSE_WINDOW) );
	closeButton->ResizeToPreferred();
	closeButton->MoveTo( Bounds().Width() - closeButton->Bounds().Width() - 8, closeButton->Frame().top );
	closeButton->MakeDefault( true );

	// add the views
	AddChild( infoBox );
	AddChild( profHolder );
	AddChild( awayHolder );
	AddChild( addToListButton );
	AddChild( closeButton );
	
	profile->MakeEditable( false );
	profile->SetStylable( true );
	
	// finally, send the message
	PostAppMessage( reqMsg );
}