* prefer the actual session id
authorWilfried Göesgens <willi@citadel.org>
Sun, 2 Mar 2008 17:05:20 +0000 (17:05 +0000)
committerWilfried Göesgens <willi@citadel.org>
Sun, 2 Mar 2008 17:05:20 +0000 (17:05 +0000)
* configure now will find iconv and friends in non-libc situations if its present in the LDFLAGS provided directories (i.e. -L /usr/local/lib/)

webcit/configure.ac
webcit/who.c

index 548f68ce76888219cfdfc0b5cad215a9b88e63c4..2017d692faca681fb2b25004b3eab3ac0e83956e 100644 (file)
@@ -84,7 +84,6 @@ AC_SEARCH_LIBS(connect, socket)
 dnl Checks for header files.
 AC_HEADER_STDC
 dnl AC_HEADER_SYS_WAIT
-AC_CHECK_HEADERS(fcntl.h limits.h sys/time.h unistd.h)
 
 
 
@@ -99,6 +98,67 @@ dnl Checks for library functions.
 AC_TYPE_SIGNAL
 dnl AC_FUNC_VPRINTF
 AC_REPLACE_FUNCS(snprintf)
+AC_CHECK_HEADERS(fcntl.h limits.h sys/time.h unistd.h iconv.h)
+
+
+dnl Here is the check for a libc integrated iconv
+AC_ARG_ENABLE(iconv,
+       [  --disable-iconv         do not use iconv charset conversion],
+       ok_iconv=no, ok_iconv=yes)
+
+AC_MSG_CHECKING(Checking to see if your system supports iconv)
+AC_TRY_RUN([
+       #include <iconv.h>
+       main() {
+               iconv_t ic = (iconv_t)(-1) ;
+               ic = iconv_open("UTF-8", "us-ascii");
+               iconv_close(ic);
+               exit(0);
+       }
+ ],
+               [
+                 ok_iconv=yes
+                 AC_MSG_RESULT([yes])
+               ],
+               [ 
+                 ok_iconv=no
+                 AC_MSG_RESULT([no])
+               ]
+)
+
+dnl Check for iconv in external libiconv
+if test "$ok_iconv" = no; then
+       AC_MSG_CHECKING(Checking for an external libiconv)
+       OLD_LDFLAGS=$LDFLAGS
+       LDFLAGS="$LDFLAGS -liconv"
+       AC_TRY_RUN([
+                       #include <iconv.h>
+                       main() {
+                               iconv_t ic = (iconv_t)(-1) ;
+                               ic = iconv_open("UTF-8", "us-ascii");
+                               iconv_close(ic);
+                       }
+               ],
+                       [
+                         ok_iconv=yes
+                         AC_MSG_RESULT([yes])
+                       ],
+                       [ 
+                         ok_iconv=no
+                         LDFLAGS=$OLDLDFLAGS
+                         AC_MSG_RESULT([no])
+                       ]
+               )
+fi     
+if test "$ok_iconv" != "no"; then
+       AC_MSG_RESULT(WebCit will be built with character set conversion.)
+       AC_DEFINE(HAVE_ICONV,[],[whether we have iconv for charset conversion])
+else
+       AC_MSG_RESULT(WebCit will be built without character set conversion.)
+fi
+
+AC_CHECK_LIB(intl, libintl_bindtextdomain, [LDFLAGS="$LDFLAGS -lintl"])
+
 
 
 dnl Check for libcitadel
@@ -297,86 +357,11 @@ AC_ARG_WITH(ssldir,
 )
 AC_DEFINE_UNQUOTED(SSL_DIR, "$ssl_dir", [were should we put our keys?])
 
-dnl Here is the check for a usable iconv
 
-AC_ARG_ENABLE(iconv,
-       [  --disable-iconv         do not use iconv charset conversion],
-       ok_iconv=no, ok_iconv=yes)
 
-if test "$ok_nls" != "no"; then
-       AC_MSG_RESULT(Checking to see if your system supports iconv...)
-       AC_TRY_RUN([
-               #include <iconv.h>
-               main() {
-                       iconv_t ic = (iconv_t)(-1) ;
-                       ic = iconv_open("UTF-8", "us-ascii");
-                       iconv_close(ic);
-                       exit(0);
-               }
-       ],
-               ok_iconv=yes,
-               ok_iconv=no
-       )
-fi
 
-dnl Check for iconv in external libiconv
-if test "$ok_nls" != "no"; then
-       if test "$ok_nls" == "no" ; then
-               AC_MSG_RESULT(Checking for an external libiconv...)
-               AC_CHECK_HEADER(iconv.h,
-                       [
-                               AC_CHECK_LIB(iconv, iconv_open,
-                                       [
-                                               LIBS="-liconv $LIBS"
-                                               ok_iconv=yes
-                                       ]
-                               )
-                       ]
-               )
-       fi
-fi
-
-if test "$ok_iconv" != "no"; then
-       AC_MSG_RESULT(WebCit will be built with character set conversion.)
-       AC_DEFINE(HAVE_ICONV,[],[whether we have iconv for charset conversion])
-else
-       AC_MSG_RESULT(WebCit will be built without character set conversion.)
-fi
-
-
-
-dnl Here is the check for libintl etc.
 AC_CHECK_FUNCS(strftime_l uselocale gettext)
 
-AC_ARG_ENABLE(nls,
-       [  --disable-nls           do not use Native Language Support],
-       ok_nls=no, ok_nls=yes)
-
-dnl if test "$ok_nls" != "no"; then
-dnl    AC_MSG_RESULT(Checking for per-thread NLS support...)
-dnl    AC_TRY_RUN([
-dnl                 #define _GNU_SOURCE
-dnl                 #include <libintl.h>
-dnl                 #include <locale.h>
-dnl                 #include <time.h>
-dnl                 main() {
-dnl                         char *foo = NULL;
-dnl                         char baz[32];
-dnl                    struct tm *tm;
-dnl                         uselocale(LC_GLOBAL_LOCALE);
-dnl                         foo = gettext("bar");
-dnl                    if (0) {
-dnl                            strftime_l(baz, sizeof baz, "%c", tm, LC_GLOBAL_LOCALE);
-dnl                    }
-dnl                         exit(0);
-dnl            }
-dnl    ],
-dnl            ok_uselocale=yes,
-dnl            ok_uselocale=no
-dnl    )
-dnl    ok_nls=$ok_uselocale
-dnl fi
-
 if test "$ok_nls" != "no"; then
        AC_CHECK_PROG(ok_xgettext, xgettext, yes, no)
        ok_nls=$ok_xgettext
index 95ba557cd715d7e74ad471314d1a6ac36fd0efa4..ea197868dcc8b491c008eed4266e8f7d3eb2fbe3 100644 (file)
@@ -50,6 +50,7 @@ int CompareUserStruct(const void *VUser1, const void *VUser2)
 
 int GetWholistSection(HashList *List, time_t now)
 {
+       struct wcsession *WCC = WC;     /* This is done to make it run faster; WC is a function */
        UserStateStruct *User, *OldUser;
        char buf[SIZ], user[SIZ], room[SIZ], host[SIZ],
                realroom[SIZ], realhost[SIZ];
@@ -89,6 +90,9 @@ int GetWholistSection(HashList *List, time_t now)
                        if (GetHash(List, User->UserName, User->UserNameLen, (void**)&OldUser)) {
                                OldUser->SessionCount++;
                                if (!User->Idle) {
+                                       if (User->Session == WCC->ctdl_pid) 
+                                               OldUser->Session = User->Session;
+
                                        OldUser->Idle = User->Idle;
                                        OldUser->LastActive = User->LastActive;
                                }
@@ -115,7 +119,6 @@ void who_inner_div(void) {
        HashPos  *it;
        char *UserName;
        long len;
-       int sess;
        time_t now;
        int bg = 0;
 
@@ -151,11 +154,11 @@ void who_inner_div(void) {
 
                        wprintf("<td class=\"edit_col\">");
                        if ((WCC->is_aide) &&
-                           (sess != WCC->ctdl_pid)) {
-                               wprintf(" <a href=\"terminate_session?which_session=%d", sess);
+                           (User->Session != WCC->ctdl_pid)) {
+                               wprintf(" <a href=\"terminate_session?which_session=%d", User->Session);
                                wprintf("\" onClick=\"return ConfirmKill();\">%s</a>", _("(kill)"));
                        }
-                       if (sess == WCC->ctdl_pid) {
+                       if (User->Session == WCC->ctdl_pid) {
                                wprintf(" <a href=\"edit_me\">%s</a>", _("(edit)"));
                        }
                        wprintf("</td>");