who.o: who.cpp includes.hpp
c++ -c $(CFLAGS) who.cpp
-utils.o: utils.c includes.hpp
- c++ -c $(CFLAGS) utils.c
+utils.o: utils.cpp includes.hpp
+ c++ -c $(CFLAGS) utils.cpp
tcp_sockets.o: tcp_sockets.cpp includes.hpp
c++ -c $(CFLAGS) tcp_sockets.cpp
#include <wx/wx.h>
#include <wx/listctrl.h>
#include <wx/socket.h>
-#include "utils.h"
// Globals
extern wxMDIParentFrame *BigMDI;
-
-
+extern wxTreeCtrl *RoomList;
void Notify(void);
};
+
+
+
+// Stuff from utils.cpp
+
+void ListToMultiline(wxString& outputbuf, wxStringList inputlist);
+void MultilineToList(wxStringList& outputlist, wxString inputbuf);
+void extract(wxString& outputbuf, wxString inputbuf, int parmnum);
+void load_roomlist(wxTreeCtrl *tree, CitClient *citsock);
+
+
+
+
+
// Globals
wxMDIParentFrame *BigMDI;
+wxTreeCtrl *RoomList;
// ----------------------------------------------------------------------------
private:
void OnUsersMenu(wxCommandEvent& cmd);
void OnWindowMenu(wxCommandEvent& cmd);
- wxTreeCtrl *RoomList;
wxButton *do_cmd;
void InitToolBar(wxToolBar* toolBar);
wxDefaultValidator,
"RoomList");
- RoomList->AddRoot(
- "Room List",
- -1,
- -1,
- NULL);
-
wxLayoutConstraints *t2 = new wxLayoutConstraints;
t2->top.SameAs(this, wxTop, 4);
t2->left.SameAs(this, wxLeft, 0);
- t2->right.PercentOf(this, wxWidth, 25);
+ t2->right.PercentOf(this, wxWidth, 20);
t2->bottom.SameAs(this, wxBottom, 0);
RoomList->SetConstraints(t2);
wxLayoutConstraints *t3 = new wxLayoutConstraints;
t3->top.SameAs(this, wxTop, 4);
- t3->left.PercentOf(this, wxWidth, 25);
+ t3->left.PercentOf(this, wxWidth, 20);
t3->right.SameAs(this, wxRight, 0);
t3->bottom.SameAs(this, wxBottom, 0);
wxMDIClientWindow *children = GetClientWindow();
citsock->GotoRoom("_BASEROOM_", "", junk);
// FIX ... add code here to perform registration if necessary
+
+ load_roomlist(RoomList, citsock);
+
}
+++ /dev/null
-// utils.c: utility functions not belonging to any particular class
-
-#include <wx/wx.h>
-#include "utils.h"
-
-
-// The following two functions convert between the wxStringList class used for
-// text transfers to and from the Citadel server, and the wxString class used
-// for the contents of a wxTextCtrl.
-
-
-void ListToMultiline(wxString& outputbuf, wxStringList inputlist) {
- int i;
- wxString buf;
-
- outputbuf.Empty();
- for (i=0; i<inputlist.Number(); ++i) {
- buf.Printf("%s", (wxString *)inputlist.Nth(i)->GetData());
- outputbuf.Append(buf);
- outputbuf.Append("\n");
- }
-}
-
-
-void MultilineToList(wxStringList& outputlist, wxString inputbuf) {
- wxString buf;
- int pos;
-
- buf = inputbuf;
- outputlist.Clear();
-
- while (buf.Length() > 0) {
- // First try to locate a line break
- pos = buf.Find('\n', FALSE);
- if ( (pos >=0) && (pos < 256) ) {
- outputlist.Add(buf.Mid(0, pos-1));
- buf = buf.Mid(pos+1);
- } else {
- // Otherwise, try to find a space
- pos = buf.Mid(0, 256).Find(' ', TRUE);
- if ( (pos >=0) && (pos < 256) ) {
- outputlist.Add(buf.Mid(0, pos-1));
- buf = buf.Mid(pos+1);
- } else {
- pos = 255;
- outputlist.Add(buf.Mid(0, pos-1));
- buf = buf.Mid(pos);
- }
- }
- }
-}
-
-
-
-// Extract a field from a string returned by the server
-//
-void extract(wxString& outputbuf, wxString inputbuf, int parmnum) {
- int a;
- int p;
-
- outputbuf = inputbuf;
-
- for (a=0; a<parmnum; ++a) {
- p = outputbuf.First('|');
- if (p >= 0) {
- outputbuf = outputbuf.Mid(p+1, 32767);
- }
- }
-
- p = outputbuf.First('|');
- if (p > 0) {
- outputbuf = outputbuf.Mid(0, p);
- }
-}
--- /dev/null
+// utility functions not belonging to any particular class
+
+#include <wx/wx.h>
+#include "includes.hpp"
+
+
+// The following two functions convert between the wxStringList class used for
+// text transfers to and from the Citadel server, and the wxString class used
+// for the contents of a wxTextCtrl.
+
+
+void ListToMultiline(wxString& outputbuf, wxStringList inputlist) {
+ int i;
+ wxString buf;
+
+ outputbuf.Empty();
+ for (i=0; i<inputlist.Number(); ++i) {
+ buf.Printf("%s", (wxString *)inputlist.Nth(i)->GetData());
+ outputbuf.Append(buf);
+ outputbuf.Append("\n");
+ }
+}
+
+
+void MultilineToList(wxStringList& outputlist, wxString inputbuf) {
+ wxString buf;
+ int pos;
+
+ buf = inputbuf;
+ outputlist.Clear();
+
+ while (buf.Length() > 0) {
+ // First try to locate a line break
+ pos = buf.Find('\n', FALSE);
+ if ( (pos >=0) && (pos < 256) ) {
+ outputlist.Add(buf.Mid(0, pos-1));
+ buf = buf.Mid(pos+1);
+ } else {
+ // Otherwise, try to find a space
+ pos = buf.Mid(0, 256).Find(' ', TRUE);
+ if ( (pos >=0) && (pos < 256) ) {
+ outputlist.Add(buf.Mid(0, pos-1));
+ buf = buf.Mid(pos+1);
+ } else {
+ pos = 255;
+ outputlist.Add(buf.Mid(0, pos-1));
+ buf = buf.Mid(pos);
+ }
+ }
+ }
+}
+
+
+
+// Extract a field from a string returned by the server
+//
+void extract(wxString& outputbuf, wxString inputbuf, int parmnum) {
+ int a;
+ int p;
+
+ outputbuf = inputbuf;
+
+ for (a=0; a<parmnum; ++a) {
+ p = outputbuf.First('|');
+ if (p >= 0) {
+ outputbuf = outputbuf.Mid(p+1, 32767);
+ }
+ }
+
+ p = outputbuf.First('|');
+ if (p > 0) {
+ outputbuf = outputbuf.Mid(0, p);
+ }
+}
+
+
+
+// Load a tree with a room list
+//
+void load_roomlist(wxTreeCtrl *tree, CitClient *citsock) {
+
+ // First, clear it out.
+ tree->DeleteAllItems();
+
+ // Set the root with the name of the Citadel server.
+ tree->AddRoot(
+ citsock->HumanNode,
+ -1, // FIX use an "earth" pixmap here
+ -1,
+ NULL);
+
+}
+++ /dev/null
-void ListToMultiline(wxString& outputbuf, wxStringList inputlist);
-void MultilineToList(wxStringList& outputlist, wxString inputbuf);
-void extract(wxString& outputbuf, wxString inputbuf, int parmnum);