Example #1
0
static bool RecordMsgText( unsigned *conditions )
{
    char        *p,*p2;
    unsigned    flags;
    bool        rc = false;

    do {
        flags = RemoteGetMsgText( TxtBuff, TXT_LEN );
        p2 = TxtBuff;
        for( p = TxtBuff; *p != NULLCHAR ;p++ ) {
            if( *p != '\r' && *p != '\n' ) {
                *p2++ = *p;
            }
        }
        if( MsgText != NULL ) {
            DUIDlgTxt( MsgText );
            DbgFree( MsgText );
            MsgText = NULL;
        }
        *p2++ = '\n';
        *p2 = NULLCHAR;
        rc = SetMsgText( TxtBuff, conditions );
    } while( flags & MSG_MORE );
    return( rc );
}
Example #2
0
void MsgBubbleText::InitInfo(const nim::IMMessage &msg)
{
	__super::InitInfo(msg);

	std::wstring str = nbase::UTF8ToUTF16(msg.content_);
	if (IsNetCallMsg((nim::NIMMessageType)msg.type_, msg.attach_))
	{
		GetNotifyMsg(msg.attach_, msg.sender_accid_, msg.receiver_accid_, str, sid_);
		msg_.content_ = nbase::UTF16ToUTF8(str);
	}
	else if (msg.type_ == nim::kNIMMessageTypeCustom)
	{
		str = GetCustomMsg(msg.attach_);
		msg_.content_ = nbase::UTF16ToUTF8(str);
	}
	SetMsgText(str);
}
Example #3
0
unsigned CheckBPs( unsigned conditions, unsigned run_conditions )
{
    brkp                *bp;
    item_mach           item;
    bool                hit, bphit, wphit;
    bool                state_set;
    mad_type_info       mti;

    wphit = false;
    state_set = false;
    bphit = false;
    for( bp = BrkList; bp != NULL; bp = bp->next ) {
        if( !bp->status.b.active )
            continue;
        hit = false;
        if( IS_BP_EXECUTE( bp->th ) ) {
            if( HaveHitBP( bp ) ) {
                hit = true;
            }
        } else {
            if( SectIsLoaded( bp->loc.addr.sect_id, OVL_MAP_EXE ) ) {
                MADTypeInfo( bp->th, &mti );
                if( ItemGetMAD( &bp->loc.addr, &item, IT_NIL, bp->th ) ) {
                    
                    /*
                     * If the breakpoint fires here because of a write, but the value hasn't changed then
                     * the breakpoint does not fire off!!!! The SupportsExactBreakpoints actually enables
                     * break on write, not break on change and allocates the exact data space - not plus
                     * or minus a few bytes...
                     *
                     */
                    
                    if( _IsOn( SW_BREAK_ON_WRITE ) && IsExactBreakpointsSupported() ) {

                        bool    drop_hit = false;
                        
                        if( ( UserTmpBrk.status.b.active ) || ( DbgTmpBrk.status.b.active ) ) {
                        
                            if( HaveHitBP( &UserTmpBrk ) ) {
                                drop_hit = true;
                            }
                            if( HaveHitBP( &DbgTmpBrk ) ) {
                                drop_hit = true;
                            }
                            if( ! ( conditions & ( COND_BREAK | COND_WATCH | COND_TRACE | COND_USER | COND_EXCEPTION | COND_STOP ) ) ) {
                                drop_hit = true;
                            }
                        }
                        
                        if( !drop_hit ) 
                            hit = true;
                    } else {
                        if( ( memcmp( &bp->item, &item, mti.b.bits / BITS_PER_BYTE ) != 0 ) || !bp->status.b.has_value ) {
                            hit = true;
                        }
                    }
                } else if( bp->status.b.has_value ) {
                    if( conditions & ( COND_BREAK | COND_WATCH | COND_TRACE | COND_USER | COND_EXCEPTION | COND_STOP ) ) {
                        hit = true;
                    }
                }
            }
        }
        if( hit ) {
            bp->total_hits++;
        }
        if( hit && bp->condition != NULL && bp->status.b.use_condition ) {
            _SwitchOn( SW_ERR_IN_TXTBUFF );
            if( !state_set ) {
                /* gets all the registers updated */
                SetProgState( run_conditions );
                state_set = true;
            }
            if( SpawnP( TestExpression, bp ) == 0 ) {
                if( !bp->status.b.expr_true ) {
                    hit = false;
                } else {
                    bp->status.b.expr_true = false;
                }
            } else {
                bp->status.b.expr_error = true;
                bp->error = DupStr( TxtBuff );
                hit = true;
            }
            _SwitchOff( SW_ERR_IN_TXTBUFF );
        }

        if( hit && bp->status.b.use_countdown && bp->countdown != 0 && !bp->status.b.expr_error ) {
            if( --bp->countdown != 0 ) {
                hit = false;
            }
        }
        if( hit ) {
            if( IS_BP_EXECUTE( bp->th ) ) {
                bphit = true;
            } else {
                wphit = true;
            }
            bp->status.b.hit = true;
        }
    }
    if( state_set ) {
        /* we might have changed a register in eval'ing conditions */
        WriteDbgRegs();
    }
    if( HaveHitBP( &UserTmpBrk ) ) {
        bphit = true;
        UserTmpBrk.status.b.hit = true;
    }
    if( HaveHitBP( &DbgTmpBrk ) ) {
        bphit = true;
        DbgTmpBrk.status.b.hit = true;
    }
    if( bphit )
        return( COND_BREAK | ( conditions & ~COND_STOPPERS ) );
    if( wphit )
        return( COND_WATCH | ( conditions & ~COND_STOPPERS ) );
    if( conditions & COND_BREAK ) {
        unsigned        max = TXT_LEN;

        ReadDbgRegs();
        if( MADUnexpectedBreak( &DbgRegs->mr, TxtBuff, &max ) == MS_OK ) {
            WriteDbgRegs();
            if( max == 0 ) {
                conditions &= ~COND_STOPPERS;
                if( _IsOff( SW_CONTINUE_UNEXPECTED_BREAK ) ) {
                    conditions |= COND_TRACE;
                }
                return( conditions );
            } else if( SetMsgText( TxtBuff, &conditions ) ) {
                DUIMsgBox( TxtBuff );
                return( COND_TRACE | COND_MESSAGE | ( conditions & ~COND_STOPPERS ) );
            } else {
                return( conditions & ~COND_STOPPERS );
            }
        } else {
            return( conditions & ~COND_STOPPERS );
        }
    } else if( conditions & COND_WATCH ) {
        return( conditions & ~COND_STOPPERS );
    }
    return( conditions );
}
Example #4
0
void CustomMsgBubble::InitInfo(const nim::IMMessage &msg)
{
	sender_id_ = msg.sender_accid_;
	session_type_ = msg.session_type_;
	receiver_id_ = msg.receiver_accid_;

	std::wstring sender = UserService::GetInstance()->GetUserName(sender_id_);
	if (session_type_ == nim::kNIMSessionTypeP2P)
	{
		head_->SetBkImage(PhotoService::GetInstance()->GetUserPhoto(sender_id_));
		name_->SetText(sender);
	}
	else
	{
		head_->SetBkImage(PhotoService::GetInstance()->GetTeamPhoto(receiver_id_, true));
		std::wstring team_sender = TeamService::GetInstance()->GetTeamName(receiver_id_) + L"->" + sender;
		name_->SetText(team_sender);
	}

	std::wstring tm = GetMessageTime(msg.timetag_, false);
	time_->SetText(tm);

	std::wstring msg_body;
	if (msg.msg_setting_.server_history_saved_)
	{
		//msg_body = L"【可离线通知】";
	}
	else
	{
		msg_body = L"【在线通知】";
	}
// 	if (!msg.custom_apns_text.empty())
// 	{
// 		if (!msg_body.empty())
// 		{
// 			msg_body += L"\r\n";
// 		}
// 		msg_body += L"【推送】" + nbase::UTF8ToUTF16(msg.custom_apns_text);
// 	}
	if (!msg.content_.empty())
	{
		if (!msg_body.empty())
		{
			msg_body += L"\r\n";
		}
		msg_body += L"【附言】" + nbase::UTF8ToUTF16(msg.content_);
	}
	bool fetch_data = false;
	Json::Value json;
	if (StringToJson(msg.attach_, json) && json.isObject())
	{
		if (json.isMember("id") && json.isMember("content"))
		{
			std::string id = json["id"].asString();
			std::string content = json["content"].asString();
			if (id == "2" && !content.empty())
			{
				if (!msg_body.empty())
				{
					msg_body += L"\r\n【内容】";
				}
				msg_body = nbase::UTF8ToUTF16(content);
				fetch_data = true;
			}
		}
	}
	if (!fetch_data)
		msg_body = nbase::UTF8ToUTF16(msg.attach_);

	SetMsgText(msg_body);
}