From 5332c415ad54cf9d3748b80a0d417dccc093a854 Mon Sep 17 00:00:00 2001 From: Art Cancro Date: Tue, 11 Jan 2011 11:47:30 -0500 Subject: [PATCH] Got rid of all of the .m.html templates and is_mobile cruft --- webcit/context_loop.c | 36 ------------------------------ webcit/messages.c | 17 -------------- webcit/roomtokens.c | 4 ---- webcit/static/t/beginbox.m.html | 5 ----- webcit/static/t/endbox.m.html | 1 - webcit/static/t/head.m.html | 14 ------------ webcit/static/t/login.m.html | 22 ------------------ webcit/static/t/msgcontrols.m.html | 20 ----------------- webcit/static/t/richedit.m.html | 1 - webcit/static/t/roombanner.m.html | 7 ------ webcit/static/t/trailing.m.html | 4 ---- webcit/subst.c | 10 ++------- webcit/webcit.c | 1 - webcit/webcit.h | 3 --- 14 files changed, 2 insertions(+), 143 deletions(-) delete mode 100644 webcit/static/t/beginbox.m.html delete mode 100644 webcit/static/t/endbox.m.html delete mode 100644 webcit/static/t/head.m.html delete mode 100644 webcit/static/t/login.m.html delete mode 100644 webcit/static/t/msgcontrols.m.html delete mode 100644 webcit/static/t/richedit.m.html delete mode 100644 webcit/static/t/roombanner.m.html delete mode 100644 webcit/static/t/trailing.m.html diff --git a/webcit/context_loop.c b/webcit/context_loop.c index 01f797c01..35e6ee7b3 100644 --- a/webcit/context_loop.c +++ b/webcit/context_loop.c @@ -210,7 +210,6 @@ wcsession *CreateSession(int Lockable, int Static, wcsession **wclist, ParsedHtt TheSession->Hdr = Hdr; TheSession->SessionKey = Hdr->HR.SessionKey; TheSession->serv_sock = (-1); - TheSession->is_mobile = -1; pthread_setspecific(MyConKey, (void *)TheSession); @@ -247,25 +246,6 @@ wcsession *CreateSession(int Lockable, int Static, wcsession **wclist, ParsedHtt } -/* - * Detects a 'mobile' user agent - */ -int is_mobile_ua(char *user_agent) { - if (strstr(user_agent,"iPhone OS") != NULL) { - return 1; - } else if (strstr(user_agent,"Windows CE") != NULL) { - return 1; - } else if (strstr(user_agent,"SymbianOS") != NULL) { - return 1; - } else if (strstr(user_agent, "Opera Mobi") != NULL) { - return 1; - } else if (strstr(user_agent, "Firefox/2.0.0 Opera 9.51 Beta") != NULL) { - /* For some reason a new install of Opera 9.51beta decided to spoof. */ - return 1; - } - return 0; -} - /* If it's a "force 404" situation then display the error and bail. */ void do_404(void) { @@ -649,21 +629,6 @@ void Header_HandleContentType(StrBuf *Line, ParsedHttpHdrs *hdr) hdr->HR.ContentType = Line; } -void Header_HandleUserAgent(StrBuf *Line, ParsedHttpHdrs *hdr) -{ - hdr->HR.user_agent = Line; -#ifdef TECH_PREVIEW -/* TODO: do this later on session creating - if ((WCC->is_mobile < 0) && is_mobile_ua(&buf[12])) { - WCC->is_mobile = 1; - } - else { - WCC->is_mobile = 0; - } -*/ -#endif -} - void Header_HandleHost(StrBuf *Line, ParsedHttpHdrs *hdr) { @@ -789,7 +754,6 @@ InitModule_CONTEXT { RegisterHeaderHandler(HKEY("CONTENT-LENGTH"), Header_HandleContentLength); RegisterHeaderHandler(HKEY("CONTENT-TYPE"), Header_HandleContentType); - RegisterHeaderHandler(HKEY("USER-AGENT"), Header_HandleUserAgent); RegisterHeaderHandler(HKEY("X-FORWARDED-HOST"), Header_HandleXFFHost); /* Apache way... */ RegisterHeaderHandler(HKEY("X-REAL-IP"), Header_HandleXFFHost); /* NGinX way... */ RegisterHeaderHandler(HKEY("HOST"), Header_HandleHost); diff --git a/webcit/messages.c b/webcit/messages.c index a6cfc33d7..812e438f9 100644 --- a/webcit/messages.c +++ b/webcit/messages.c @@ -491,22 +491,6 @@ void print_message(void) { wDumpContent(0); } -/* - * Mobile browser view of message - */ -void mobile_message_view(void) -{ - long msgnum = 0L; - const StrBuf *Mime; - - msgnum = StrBufExtract_long(WC->Hdr->HR.ReqLine, 0, '/'); - output_headers(1, 0, 0, 0, 0, 1); - begin_burst(); - do_template("msgcontrols", NULL); - read_message(WC->WBuf, HKEY("view_message"), msgnum, NULL, &Mime); - wDumpContent(0); -} - /* * Display a message's headers */ @@ -1853,7 +1837,6 @@ InitModule_MSG WebcitAddUrlHandler(HKEY("msg"), "", 0, embed_message, NEED_URL); WebcitAddUrlHandler(HKEY("message"), "", 0, handle_one_message, NEED_URL|XHTTP_COMMANDS|COOKIEUNNEEDED|FORCE_SESSIONCLOSE); WebcitAddUrlHandler(HKEY("printmsg"), "", 0, print_message, NEED_URL); - WebcitAddUrlHandler(HKEY("mobilemsg"), "", 0, mobile_message_view, NEED_URL); WebcitAddUrlHandler(HKEY("msgheaders"), "", 0, display_headers, NEED_URL); WebcitAddUrlHandler(HKEY("mimepart"), "", 0, view_mimepart, NEED_URL); diff --git a/webcit/roomtokens.c b/webcit/roomtokens.c index 66f498c7f..df6b1581a 100644 --- a/webcit/roomtokens.c +++ b/webcit/roomtokens.c @@ -55,10 +55,6 @@ void tmplput_roombanner(StrBuf *Target, WCTemplputParams *TP) do_template("roombanner", NULL); - /* roombanner contains this for mobile */ - if (WC->is_mobile) - return; - do_template("navbar", NULL); wc_printf("\n"); } diff --git a/webcit/static/t/beginbox.m.html b/webcit/static/t/beginbox.m.html deleted file mode 100644 index 2d9cc609d..000000000 --- a/webcit/static/t/beginbox.m.html +++ /dev/null @@ -1,5 +0,0 @@ - -
-
-
- diff --git a/webcit/static/t/endbox.m.html b/webcit/static/t/endbox.m.html deleted file mode 100644 index e04ad1b9c..000000000 --- a/webcit/static/t/endbox.m.html +++ /dev/null @@ -1 +0,0 @@ -
diff --git a/webcit/static/t/head.m.html b/webcit/static/t/head.m.html deleted file mode 100644 index 52d22ee4a..000000000 --- a/webcit/static/t/head.m.html +++ /dev/null @@ -1,14 +0,0 @@ - - - - <?CURRENT_USER> - <?SERV:HUMANNODE> - - - - - - - -
- diff --git a/webcit/static/t/login.m.html b/webcit/static/t/login.m.html deleted file mode 100644 index a5b71f86f..000000000 --- a/webcit/static/t/login.m.html +++ /dev/null @@ -1,22 +0,0 @@ - - -
- - - - - -
-
- - - - - -
-
-
- - - - diff --git a/webcit/static/t/msgcontrols.m.html b/webcit/static/t/msgcontrols.m.html deleted file mode 100644 index 462efed22..000000000 --- a/webcit/static/t/msgcontrols.m.html +++ /dev/null @@ -1,20 +0,0 @@ - - - - <?CURRENT_USER> - <?SERV:HUMANNODE> - - - - - - - - -
-
- - -
-
-
diff --git a/webcit/static/t/richedit.m.html b/webcit/static/t/richedit.m.html deleted file mode 100644 index 8b1378917..000000000 --- a/webcit/static/t/richedit.m.html +++ /dev/null @@ -1 +0,0 @@ - diff --git a/webcit/static/t/roombanner.m.html b/webcit/static/t/roombanner.m.html deleted file mode 100644 index 963186b8c..000000000 --- a/webcit/static/t/roombanner.m.html +++ /dev/null @@ -1,7 +0,0 @@ - - - diff --git a/webcit/static/t/trailing.m.html b/webcit/static/t/trailing.m.html deleted file mode 100644 index b1730c0fb..000000000 --- a/webcit/static/t/trailing.m.html +++ /dev/null @@ -1,4 +0,0 @@ - -
- - diff --git a/webcit/subst.c b/webcit/subst.c index 8bc65275f..67d5de314 100644 --- a/webcit/subst.c +++ b/webcit/subst.c @@ -1681,14 +1681,8 @@ const StrBuf *DoTemplate(const char *templatename, long len, StrBuf *Target, WCT TP = &LocalTP; } - if (WC->is_mobile > 0) { - Static = WirelessTemplateCache; - StaticLocal = WirelessLocalTemplateCache; - } - else { - Static = TemplateCache; - StaticLocal = LocalTemplateCache; - } + Static = TemplateCache; + StaticLocal = LocalTemplateCache; if (len == 0) { diff --git a/webcit/webcit.c b/webcit/webcit.c index 5d213a5f0..5fbe26169 100644 --- a/webcit/webcit.c +++ b/webcit/webcit.c @@ -654,7 +654,6 @@ void session_loop(void) WCC= WC; WCC->upload_length = 0; WCC->upload = NULL; - WCC->is_mobile = 0; WCC->Hdr->nWildfireHeaders = 0; if (WCC->Hdr->HR.Handler != NULL) Flags = WCC->Hdr->HR.Handler->Flags; /* so we can temporarily add our own... */ diff --git a/webcit/webcit.h b/webcit/webcit.h index bced028b6..9a30bede6 100644 --- a/webcit/webcit.h +++ b/webcit/webcit.h @@ -474,7 +474,6 @@ struct wcsession { pthread_mutex_t SessionMutex; /* mutex for exclusive access */ int wc_session; /* WebCit session ID */ int killthis; /* Nonzero == purge this session */ - int is_mobile; /* Client is a handheld browser */ int ctdl_pid; /* Session ID on the Citadel server */ int nonce; /* session nonce (to prevent session riding) */ int SessionKey; @@ -830,8 +829,6 @@ HashList *GetRoomListHashLKRA(StrBuf *Target, WCTemplputParams *TP); void webcit_fmt_date(char *buf, size_t siz, time_t thetime, int Format); void summary(void); -int is_mobile_ua(char *user_agent); - /* actual supported locales */ void TmplGettext(StrBuf *Target, WCTemplputParams *TP); void offer_languages(StrBuf *Target, int nArgs, WCTemplateToken *Token, void *Context, int ContextType); -- 2.30.2