* implement (INBOX) thing
authorWilfried Göesgens <willi@citadel.org>
Tue, 8 Sep 2009 19:48:38 +0000 (19:48 +0000)
committerWilfried Göesgens <willi@citadel.org>
Tue, 8 Sep 2009 19:48:38 +0000 (19:48 +0000)
webcit/roomlist.c
webcit/roomops.h
webcit/static/t/knrooms_rooms.html

index e085a1563415b6fd012ac7000dd6f3d9b1fb6494..ca32311fcf73022d3b4bd7219a197e33f2ab8978 100644 (file)
@@ -205,7 +205,16 @@ HashList *GetRoomListHash(StrBuf *Target, WCTemplputParams *TP)
                        /* Private mailboxes on the main floor get remapped to the personal folder */
                        if ((room->QRFlags & QR_MAILBOX) && 
                            (room->floorid == 0))
+                       {
                                room->floorid = VIRTUAL_MY_FLOOR;
+                               if ((room->nRoomNameParts == 1) && 
+                                   (StrLength(room->name) == 4) && 
+                                   (strcmp(ChrPtr(room->name), "Mail") == 0))
+                               {
+                                       room->is_inbox = 1;
+                               }
+
+                       }
                        /* get a pointer to the floor we're on: */
                        GetHash(WCC->Floors, IKEY(room->floorid), &vFloor);
                        room->Floor = (const floor*) vFloor;
@@ -570,6 +579,11 @@ int ConditionalRoomHas_UA_DELETEALLOWED(StrBuf *Target, WCTemplputParams *TP)
 }
 
 
+int ConditionalRoomIsInbox(StrBuf *Target, WCTemplputParams *TP)
+{
+       folder *Folder = (folder *)(TP->Context);
+       return Folder->is_inbox;
+}
 
 
 
@@ -621,6 +635,7 @@ InitModule_ROOMLIST
        RegisterNamespace("ROOM:INFO:FLOOR:NROOMS", 0, 0, tmplput_ROOM_FLOOR_NROOMS, CTX_ROOMS);
 
 
+       RegisterConditional(HKEY("COND:ROOM:INFO:IS_INBOX"), 0, ConditionalRoomIsInbox, CTX_ROOMS);
        RegisterConditional(HKEY("COND:ROOM:FLAGS:UA_KNOWN"), 0, ConditionalRoomHas_UA_KNOWN, CTX_ROOMS);
        RegisterConditional(HKEY("COND:ROOM:FLAGS:UA_GOTOALLOWED"), 0, ConditionalRoomHas_UA_GOTOALLOWED, CTX_ROOMS);
        RegisterConditional(HKEY("COND:ROOM:FLAGS:UA_HASNEWMSGS"), 0, ConditionalRoomHas_UA_HASNEWMSGS, CTX_ROOMS);
index ac2f607b7b7458cd5c665a96ecd307209e41bac0..19ceba3640080714fc8e7f0eba7151826e4fdcaa 100644 (file)
@@ -79,7 +79,7 @@ typedef struct _folder {
 
 
        int hasnewmsgs; /* are there unread messages inside */
-       int is_mailbox; /* is it a mailbox?  */
+       int is_inbox;   /* is it a mailbox?  */
        int selectable; /* can we select it ??? */
        int num_rooms;  /* If this is a floor, how many rooms does it have */
 
index e69d409394bd58cec33f607b4ed0cd475ce0a9dc..b5d0114223e7e6c874cef7f85acdcf663fff37c1 100644 (file)
@@ -7,5 +7,5 @@
 <?!("COND:ITERATE:ISGROUPCHANGE", 3, 2)></td><td valign=top> <?!("X", 3)>
 <?=("beginbox_1")><?ROOM:INFO:FLOOR:NAME><?=("beginbox_2")>
 <?!("X", 2)>
-&nbsp;<a href="dotgoto?room=<?ROOM:INFO:NAME("X")>"><span class="<?%("COND:ROOM:FLAGS:UA_HASNEWMSGS", 1, 0, 0, "roomlist_new", "roomlist_old")>"><?ROOM:INFO:LEVELNTIMES("&nbsp;&nbsp;&nbsp;")><?ROOM:INFO:BASENAME></span></a><br />
+&nbsp;<a href="dotgoto?room=<?ROOM:INFO:NAME("X")>"><span class="<?%("COND:ROOM:FLAGS:UA_HASNEWMSGS", 1, 0, 0, "roomlist_new", "roomlist_old")>"><?ROOM:INFO:LEVELNTIMES("&nbsp;&nbsp;&nbsp;")><?ROOM:INFO:BASENAME></span></a><?%("COND:ROOM:INFO:IS_INBOX", 1, 1, 1, _("(INBOX)"), "")><br />
 <?!("COND:ITERATE:LASTN", 2)><?=("endbox")></td></tr><??("X", 3)>