]> code.citadel.org Git - citadel.git/commitdiff
Give 'em a choice.
authorArt Cancro <ajc@citadel.org>
Sat, 8 May 1999 01:22:42 +0000 (01:22 +0000)
committerArt Cancro <ajc@citadel.org>
Sat, 8 May 1999 01:22:42 +0000 (01:22 +0000)
daphne/enter.cpp
daphne/includes.hpp
daphne/roomview.cpp

index a13b2bbd6a5a04ce901db4c87f005c83e2b73ae6..b77b8b53fb751b18eb7cd27a7abf1f17140ca671 100644 (file)
@@ -16,7 +16,8 @@ END_EVENT_TABLE()
 
 // frame constructor
 EnterMessage::EnterMessage(
-       CitClient *sock, wxMDIParentFrame *MyMDI, wxString roomname)
+       CitClient *sock, wxMDIParentFrame *MyMDI,
+       wxString roomname, unsigned int roomflags)
        : wxMDIChildFrame(MyMDI,        //parent
                        -1,     //window id
                        roomname + ": enter message",
@@ -61,6 +62,9 @@ EnterMessage::EnterMessage(
 
 
 
+
+       // If the user has a choice of several posting names, present them.
+
        wxStaticText *fromlabel = new wxStaticText(this, -1, "From: ");
 
        wxLayoutConstraints *c6 = new wxLayoutConstraints;
@@ -70,11 +74,24 @@ EnterMessage::EnterMessage(
        c6->height.AsIs();
        fromlabel->SetConstraints(c6);
 
-       wxString posting_name_choices[] = {
-               citsock->curr_user
-               };
+       wxString posting_name_choices[2];
+       int num_choices;
+
+       if (roomflags & QR_ANONONLY) {
+               posting_name_choices[0] = "****";
+               num_choices = 1;
+       } else {
+               posting_name_choices[0] = citsock->curr_user;
+               num_choices = 1;
+       }
+       
+       if (roomflags & QR_ANONOPT) {
+               posting_name_choices[num_choices++] = "Anonymous";
+       }
+
        fromname = new wxChoice(this, -1,
-               wxDefaultPosition, wxSize(150,25), 1, posting_name_choices);
+               wxDefaultPosition, wxSize(150,25),
+                       num_choices, posting_name_choices);
 
        wxLayoutConstraints *c7 = new wxLayoutConstraints;
        c7->centreY.SameAs(fromlabel, wxCentreY);
@@ -83,6 +100,11 @@ EnterMessage::EnterMessage(
        c7->height.AsIs();
        fromname->SetConstraints(c7);
 
+
+
+       // There may also be the opportunity to present a recipient.
+       // FIX ... disable this if we're not in a mail room
+
        wxStaticText *tolabel = new wxStaticText(this, -1, "To: ");
 
        wxLayoutConstraints *c8 = new wxLayoutConstraints;
@@ -117,6 +139,9 @@ EnterMessage::EnterMessage(
 
 
 
+
+       // The main portion of this screen is a text entry box.
+
        TheMessage = new wxTextCtrl(this, -1, "",
                wxDefaultPosition, wxDefaultSize,
                wxTE_MULTILINE);
@@ -128,6 +153,8 @@ EnterMessage::EnterMessage(
        d9->right.SameAs(this, wxRight, 2);
        TheMessage->SetConstraints(d9);
 
+
+
        SetAutoLayout(TRUE);
        Show(TRUE);
         Layout();
index ee64cdd9f6f86a48fde47c88d30d0fda37ec3ea9..9d208d366dee47f36a8e80422d1d35b67876c58c 100644 (file)
 #define DEFAULT_HOST   "uncnsrd.mt-kisco.ny.us"
 #define DEFAULT_PORT   "504"
 
+
+// Room flags (from ipcdef.h in the main Citadel distribution)
+
+#define QR_PERMANENT   1               /* Room does not purge              */
+#define QR_INUSE       2               /* Set if in use, clear if avail    */
+#define QR_PRIVATE     4               /* Set for any type of private room */
+#define QR_PASSWORDED  8               /* Set if there's a password too    */
+#define QR_GUESSNAME   16              /* Set if it's a guessname room     */
+#define QR_DIRECTORY   32              /* Directory room                   */
+#define QR_UPLOAD      64              /* Allowed to upload                */
+#define QR_DOWNLOAD    128             /* Allowed to download              */
+#define QR_VISDIR      256             /* Visible directory                */
+#define QR_ANONONLY    512             /* Anonymous-Only room              */
+#define QR_ANONOPT     1024            /* Anonymous-Option room            */
+#define QR_NETWORK     2048            /* Shared network room              */
+#define QR_PREFONLY    4096            /* Preferred status needed to enter */
+#define QR_READONLY    8192            /* Aide status required to post     */
+#define QR_MAILBOX     16384           /* Set if this is a private mailbox */
+
+
+
+
 // TCPsocket represents a socket-level TCP connection to a server.
 class TCPsocket {
 public:
@@ -299,7 +321,7 @@ private:
 class EnterMessage : public wxMDIChildFrame {
 public:
        EnterMessage(CitClient *sock, wxMDIParentFrame *MyMDI,
-               wxString roomname);
+               wxString roomname, unsigned int roomflags);
 private:
        void OnCancel(wxCommandEvent& whichbutton);
        void OnSave(wxCommandEvent& whichbutton);
index 1096a60a6bb7cbfe79de59c8b52426de64cf69ef..323d58d4f4946ecf099b575bb9834391bd999bdc 100644 (file)
@@ -50,6 +50,7 @@ RoomView::RoomView(
        extract(ThisRoom, recvcmd.Mid(4), 0);   // actual name of room
        new_messages = extract_int(recvcmd.Mid(4), 1);
        total_messages = extract_int(recvcmd.Mid(4), 2);
+       RoomFlags = extract_int(recvcmd.Mid(4), 4);
        is_roomaide = (extract_int(recvcmd.Mid(4), 8) ? TRUE : FALSE);
 
        SetTitle(ThisRoom);     // FIX why doesn't this work?
@@ -215,7 +216,7 @@ void RoomView::OnButtonPressed(wxCommandEvent& whichbutton) {
        } else if (whichbutton.GetId() == BUTTON_READALL) {
                do_readloop("MSGS ALL");
        } else if (whichbutton.GetId() == BUTTON_ENTER) {
-               new EnterMessage(citsock, citMyMDI, ThisRoom);
+               new EnterMessage(citsock, citMyMDI, ThisRoom, RoomFlags);
        } else if (whichbutton.GetId() == BUTTON_SKIP) {
                new RoomView(citsock, citMyMDI, RoomList->GetNextRoom());
                delete this;