private:
void OnButtonPressed(wxCommandEvent& whichbutton);
CitClient *citsock;
- DECLARE_EVENT_TABLE()
void do_readloop(wxString readcmd);
wxMDIParentFrame *citMyMDI;
wxHtmlWindow *message_window;
wxPanel *banner;
wxButton *close_button;
wxString ThisRoom;
+ DECLARE_EVENT_TABLE()
};
void extract(wxString& outputbuf, wxString inputbuf, int parmnum);
int extract_int(wxString inputbuf, int parmnum);
void load_roomlist(RoomTree *tree, CitClient *citsock);
+void variformat_to_html(wxString& outputbuf,
+ wxString inputbuf,
+ bool add_header_and_footer);
class RoomItem : public wxTreeItemData {
public:
- RoomItem(wxString name);
+ RoomItem(wxString name, bool newmsgs);
wxString RoomName;
+ bool HasNewMessages;
};
-RoomItem::RoomItem(wxString name)
+RoomItem::RoomItem(wxString name, bool newmsgs)
: wxTreeItemData() {
- RoomName = name;
+ RoomName = name;
+ HasNewMessages = newmsgs;
}
roomname,
2,
-1,
- new RoomItem(roomname)
+ new RoomItem(roomname, TRUE)
);
SetItemBold(item, TRUE);
SetItemBold(floorboards[floornum], TRUE);
roomname,
3,
-1,
- new RoomItem(roomname)
+ new RoomItem(roomname, FALSE)
);
}
+
}
"UserLogin"
) {
- wxString sendcmd, recvcmd, xferbuf;
+ wxString sendcmd, recvcmd, xferbuf, buf;
wxPanel *banner;
citsock = sock;
"exit_button"
);
- wxTextCtrl *hello = new wxTextCtrl(this, -1,
- "", //value
- wxDefaultPosition, wxDefaultSize,
- wxTE_MULTILINE | wxTE_READONLY,
- wxDefaultValidator, "");
-
-
+ wxHtmlWindow *hello = new wxHtmlWindow(this);
// Set up a panel for the title...
banner = new wxPanel(this, -1);
sendcmd = "MESG hello";
if (citsock->serv_trans(sendcmd, recvcmd, xferbuf)==1) {
- hello->SetValue(xferbuf);
+ variformat_to_html(buf, xferbuf, FALSE);
+ buf = "<HTML><BODY><CENTER>"
+ + buf + "</CENTER></BODY></HTML>\n";
+ hello->SetPage(buf);
}
-
-
}
return atoi((const char *)buf);
}
+
+
+// Convert traditional Citadel variformat text to HTML
+void variformat_to_html(wxString& outputbuf,
+ wxString inputbuf,
+ bool add_header_and_footer) {
+
+ wxString buf;
+ int pos;
+
+ outputbuf.Empty();
+ buf = inputbuf;
+
+ if (add_header_and_footer) {
+ outputbuf.Append("<HTML><BODY>");
+ }
+
+ while (buf.Length() > 0) {
+ pos = buf.Find('\n', FALSE);
+ if (pos < 0) {
+ buf = buf + "\n";
+ pos = buf.Find('\n', FALSE);
+ }
+ if ( (buf.Left(1) == " ") && (outputbuf.Length() > 0) ) {
+ outputbuf.Append("<BR>\n");
+ }
+ outputbuf.Append(buf.Left(pos));
+ buf = buf.Mid(pos+1);
+ }
+
+ if (add_header_and_footer) {
+ outputbuf.Append("</BODY></HTML>\n");
+ }
+}