1 #import "JubCLIChatUI.h"
2 #import "JubCLIColor.h"
6 @implementation JubCLIChatUI
7 - initWithTitle: (OFString*)title
8 closeBlock: (jub_close_block_t)closeBlock
9 sendBlock: (jub_send_block_t)sendBlock
14 _sendBlock = [sendBlock copy];
15 _title = [title copy];
31 - (void)addMessage: (OFString*)text
32 sender: (OFString*)sender
34 [of_stdout writeString: @"\r" COL_IN(@"-> ")];
35 [of_stdout writeFormat: BOLD(@"%@:") @" %@\n", sender, text];
36 [[Linenoise sharedLinenoise] refreshLine];
39 - (void)send: (OFString*)text
41 [of_stdout writeString: @"\033[1A" COL_OUT(@"<- ")];
42 [of_stdout writeFormat: BOLD(@"%@:") @" %@\n", _title, text];