Cycle through multiple termtypes instead of just sending one.
This commit is contained in:
parent
1efc6fa4e6
commit
3623acbd21
@ -690,6 +690,20 @@ pub(super) fn mudoutput_subnegotiation_termtype<'gc>(
|
|||||||
const SEND_CMD: u8 = 1;
|
const SEND_CMD: u8 = 1;
|
||||||
match cmd {
|
match cmd {
|
||||||
SEND_CMD => {
|
SEND_CMD => {
|
||||||
|
let negidx: Value = mud.get(ctx, "termtype_negotiation_index")?;
|
||||||
|
let mut negidx: u64 = if negidx.is_nil() {
|
||||||
|
1
|
||||||
|
} else {
|
||||||
|
u64::from_value(ctx, negidx)?
|
||||||
|
};
|
||||||
|
let supported_termtypes: Table = mud.get(ctx, "supported_termtypes")?;
|
||||||
|
let optlen = supported_termtypes.length() as u64;
|
||||||
|
if negidx > optlen {
|
||||||
|
negidx = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
let termtype: String = supported_termtypes.get(ctx, negidx as i64)?;
|
||||||
|
|
||||||
send_subnegotiation_if_allowed(
|
send_subnegotiation_if_allowed(
|
||||||
ctx,
|
ctx,
|
||||||
&mud,
|
&mud,
|
||||||
@ -699,8 +713,11 @@ pub(super) fn mudoutput_subnegotiation_termtype<'gc>(
|
|||||||
memo: global_memo.clone(),
|
memo: global_memo.clone(),
|
||||||
mud: socket.clone(),
|
mud: socket.clone(),
|
||||||
},
|
},
|
||||||
format!("\x00{}", "XTERM").as_bytes(),
|
format!("\x00{}", &termtype).as_bytes(),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
mud.set(ctx, "termtype_negotiation_index", (negidx + 1) as i64)?;
|
||||||
|
|
||||||
Ok(CallbackReturn::Return)
|
Ok(CallbackReturn::Return)
|
||||||
}
|
}
|
||||||
_ => Ok(CallbackReturn::Return),
|
_ => Ok(CallbackReturn::Return),
|
||||||
@ -773,6 +790,11 @@ pub(super) fn new_mud<'gc>(ctx: Context<'gc>) -> Callback<'gc> {
|
|||||||
),
|
),
|
||||||
);
|
);
|
||||||
mud.set(ctx, ctx.intern_static(b"frameroutes"), frameroutes)?;
|
mud.set(ctx, ctx.intern_static(b"frameroutes"), frameroutes)?;
|
||||||
|
let termtypes: Table = Table::new(&ctx);
|
||||||
|
termtypes.set(ctx, 1_i64, "WORLDWIDEPORTAL")?;
|
||||||
|
termtypes.set(ctx, 2_i64, "XTERM")?;
|
||||||
|
termtypes.set(ctx, 3_i64, "MTTS 815")?;
|
||||||
|
mud.set(ctx, ctx.intern_static(b"supported_termtypes"), termtypes)?;
|
||||||
|
|
||||||
let curr_frame: Value = ctx
|
let curr_frame: Value = ctx
|
||||||
.get_global::<Table>("info")?
|
.get_global::<Table>("info")?
|
||||||
|
Loading…
Reference in New Issue
Block a user