From fedora-directory-commits at redhat.com Tue Sep 5 14:58:58 2006 From: fedora-directory-commits at redhat.com (Robert Crittenden (rcritten)) Date: Tue, 5 Sep 2006 07:58:58 -0700 Subject: [Fedora-directory-commits] mod_nss/docs mod_nss.html,1.10,1.11 Message-ID: <200609051458.k85EwwZG032525@cvs-int.fedora.redhat.com> Author: rcritten Update of /cvs/dirsec/mod_nss/docs In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv32411 Modified Files: mod_nss.html Log Message: Add information about ECC including required versions of NSPR and NSS and the available ciphers. Clarify starting up Apache without requiring user intervention. Fix a few bad links to NSPR. Index: mod_nss.html =================================================================== RCS file: /cvs/dirsec/mod_nss/docs/mod_nss.html,v retrieving revision 1.10 retrieving revision 1.11 diff -u -r1.10 -r1.11 --- mod_nss.html 3 Oct 2005 14:59:26 -0000 1.10 +++ mod_nss.html 5 Sep 2006 14:58:56 -0000 1.11 @@ -50,7 +50,8 @@

Building

Refer to the README file included with the distribution.

-To build you'll need NSPR 4.4.1 or above and NSPR +4.4.1 or above and NSS 3.9.2 or above. It may work with earlier versions but these are recommended (or @@ -60,9 +61,15 @@ /usr/local/nspr, etc). It will look in this parent for include/ and lib/, etc.

+To build with ECC support you need NSPR 4.6.2 or higher +and NSS +3.11.2 or higher.
+
You will also need the NSS and NSPR directories in your library search + href="http://www.mozilla.org/projects/nspr/">NSPR directories in +your library search path (either /etc/ld.so.conf or LD_LIBRARY_PATH) to link and run the module.

@@ -134,6 +141,19 @@ tells us where the APR include files and libraries are located
+ + --enable-ssl2
+ + SSLv2 is disabled by default.
+ + + + --enable-ecc
+ + Enable Elliptical Curve +Cryptography. Disabled by default.
+ +
@@ -232,6 +252,22 @@ token password.

All other output will be written to the Apache log files.
+
+To avoid  being prompted for a startup password you can either:
+ +
% +modutil -dbdir /path/to/database/directory -changepw "NSS Certificate +DB"
+
+Enter the old password then press Enter twice for the new password to +blank it out.
+

Migration

A perl script, migrate,pl, is included to help migrate an existing mod_ssl configuration to work with mod_nss. There is one @@ -331,6 +367,22 @@
NSSCertificateDatabase /etc/httpd/conf/nss

+NSSDBPrefix
+
+Normally a certificate database consists of 3 files: cert8.db, key3.db +and secmod.db. This directive allows you to add a named prefix to the +filenames of cert8.db and key3.db so you can store multiple databases +in one directory.
+
+Example
+
+NSSDBPrefix my-prefix-
+
+You would then need: my-prefix-cert8.db, my-prefix-key3.db and secmod.db
+
+In order to work with files with a prefix using the NSS command-line +tools use the -P flag.
+

NSSSessionCacheSize

Specifies the number of SSL sessions that can be cached.
@@ -386,7 +438,7 @@ If the number of bytes to read is specified it just reads that amount. Be aware that some operating systems block on /dev/random if not enough entropy is available. This means that the server will wait until that -data is available to continue startup. These systems generally offer a +/data is available to continue startup. These systems generally offer a non-blocking device as well, /dev/urandom.
  • exec:/path/to/program: Executes the given program and takes the stdout of it as the entryop. If the bytes argument is included it @@ -459,7 +511,7 @@
    Available ciphers are:

    - @@ -630,6 +682,147 @@

    +Additionally there are a number of ECC ciphers:
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Cipher Name
    +
    NSS Cipher +Definition
    +
    Protocol
    +
    ecdh_ecdsa_null_shaTLS_ECDH_ECDSA_WITH_NULL_SHATLSv1
    ecdh_ecdsa_rc4_128_shaTLS_ECDH_ECDSA_WITH_RC4_128_SHATLSv1
    ecdh_ecdsa_3des_shaTLS_ECDH_ECDSA_WITH_3DES_EDE_CBC_SHATLSv1
    ecdh_ecdsa_aes_128_shaTLS_ECDH_ECDSA_WITH_AES_128_CBC_SHATLSv1
    ecdh_ecdsa_aes_256_shaTLS_ECDH_ECDSA_WITH_AES_256_CBC_SHATLSv1
    ecdhe_ecdsa_null_shaTLS_ECDHE_ECDSA_WITH_NULL_SHATLSv1
    ecdhe_ecdsa_rc4_128_shaTLS_ECDHE_ECDSA_WITH_RC4_128_SHATLSv1
    ecdhe_ecdsa_3des_shaTLS_ECDHE_ECDSA_WITH_3DES_EDE_CBC_SHATLSv1
    ecdhe_ecdsa_aes_128_shaTLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHATLSv1
    ecdhe_ecdsa_aes_256_shaTLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHATLSv1
    ecdh_rsa_null_shaTLS_ECDH_RSA_WITH_NULL_SHATLSv1
    ecdh_rsa_128_shaTLS_ECDH_RSA_WITH_RC4_128_SHATLSv1
    ecdh_rsa_3des_shaTLS_ECDH_RSA_WITH_3DES_EDE_CBC_SHATLSv1
    ecdh_rsa_aes_128_shaTLS_ECDH_RSA_WITH_AES_128_CBC_SHATLSv1
    ecdh_rsa_aes_256_shaTLS_ECDH_RSA_WITH_AES_256_CBC_SHATLSv1
    echde_rsa_nullTLS_ECDHE_RSA_WITH_NULL_SHATLSv1
    ecdhe_rsa_rc4_128_shaTLS_ECDHE_RSA_WITH_RC4_128_SHATLSv1
    ecdhe_rsa_3des_shaTLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHATLSv1
    ecdhe_rsa_aes_128_shaTLS_ECDHE_RSA_WITH_AES_128_CBC_SHATLSv1
    ecdhe_rsa_aes_256_shaTLS_ECDHE_RSA_WITH_AES_256_CBC_SHATLSv1
    ecdh_anon_null_shaTLS_ECDH_anon_WITH_NULL_SHATLSv1
    ecdh_anon_rc4_128shaTLS_ECDH_anon_WITH_RC4_128_SHATLSv1
    ecdh_anon_3des_shaTLS_ECDH_anon_WITH_3DES_EDE_CBC_SHATLSv1
    ecdh_anon_aes_128_shaTLS_ECDH_anon_WITH_AES_128_CBC_SHATLSv1
    ecdh_anon_aes_256_shaTLS_ECDH_anon_WITH_AES_256_CBC_SHATLSv1
    +
    Example

    NSSCipherSuite @@ -651,7 +844,7 @@ Note that this differs from mod_ssl in that you can't add or subtract protocols.
    -SSLv2 is not supported at this time.
    +SSLv2 is not supported by default at this time.

    Example

    @@ -670,7 +863,23 @@ style="font-weight: bold;">
    NSSNickname Server-Cert
    -NSSNickname "This contains a space"
    +NSSNickname "This contains a space"
    +
    +NOTE: There is nothing magical about the string "Server-Cert." A +nickname can be anything. Historically this was Server-Cert in the +Netscape server products that used NSS.
    +
    +
    NSSECCNickname
    +
    +Similar to NSSNickname but designed for use with ECC certificates. This +allows you to have both an RSA certificate and an ECC certificate +available on the same listening port. This allows newer clients that +support ECC to connect with those ciphers but also allows older clients +to connect with an RSA cipher.
    +
    +Example
    +
    +NSSNickname Server-Cert-ECC

    NSSEnforceValidCerts

    @@ -930,6 +1139,13 @@ time + SSL_CLIENT_V_REMAIN
    + + Number of days that the +certificate is valid
    + + + SSL_CLIENT_M_VERSION
    X.509 version of the client From fedora-directory-commits at redhat.com Tue Sep 5 19:57:57 2006 From: fedora-directory-commits at redhat.com (Robert Crittenden (rcritten)) Date: Tue, 5 Sep 2006 12:57:57 -0700 Subject: [Fedora-directory-commits] mod_revocator/docs - New directory Message-ID: <200609051957.k85Jvvw1029134@cvs-int.fedora.redhat.com> Author: rcritten Update of /cvs/dirsec/mod_revocator/docs In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv29119/docs Log Message: Directory /cvs/dirsec/mod_revocator/docs added to the repository From fedora-directory-commits at redhat.com Tue Sep 5 19:58:29 2006 From: fedora-directory-commits at redhat.com (Robert Crittenden (rcritten)) Date: Tue, 5 Sep 2006 12:58:29 -0700 Subject: [Fedora-directory-commits] mod_revocator/docs mod_revocator.html, NONE, 1.1 Message-ID: <200609051958.k85JwTE6029208@cvs-int.fedora.redhat.com> Author: rcritten Update of /cvs/dirsec/mod_revocator/docs In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv29154 Added Files: mod_revocator.html Log Message: HTML documentation for mod_revocator --- NEW FILE mod_revocator.html --- mod_revocator

    mod_revocator


    Table of Contents

    Introduction
    Building
    Package Requirements
    Configuration Directives
    Developer Information

    Introduction

    This Apache module lets the user configure remote Certificate Revocation Lists (CRLs) to be downloaded and installed automatically on a regular basis without restarting the server. This helps ensure that the CRLs are kept up-to-date with minimal effort. The module can also bring the server down if the CRL expires and a new one cannot be obtained. This module requires that mod_nss also be installed.

    Building

    Refer to the README file included with the distribution for the latest information.

    Package Requirements

    To build this you'll need:
    • NSPR 4.4.1 or higher
    • NSS 3.9.3 or higher
    • Mozilla LDAP SDK 5.15 or higher
    • Apache development package(s)
    • mod_nss
    mod_revocator will not work with earlier versions of NSS due to an API change.

    Option
    Description
    --with-apr-config Use apr-config to determine the APR directory
    --with-apxs=PATH Path to apxs
    --with-nspr=PATH Netscape Portable Runtime (NSPR) directory
    --with-nspr-inc=PATH Netscape Portable Runtime (NSPR) include file directory
    --with-nspr-lib=PATH Netscape Portable Runtime (NSPR) library directory
    --with-nss=PATH Network Security Services (NSS) directory
    --with-nss-inc=PATH Network Security Services (NSS) include directory
    --with-nss-lib=PATH Network Security Services (NSS) library directory
    --with-ldapsdk=PATH LDAP SDK directory
    --with-ldapsdk-inc=PATH Mozilla LDAP SDK include directory
    --with-ldapsdk-lib=PATH Mozilla LDAP SDK library directory


    The --with-nspr, --with-nss and --with-ldapsdk tags require that the package be installed in the same parent directory (e.g. /opt/nspr, /usr/local/nspr, etc). It will look in this parent for include/, lib/, etc. Alternatively you can use -inc and -lib to specify separate locations for each one (--with-nspr-inc, --with-nspr-lib, --with-nss-inc, etc).

    If --with-nss or --with-nspr and/or --with-ldapsdk are not passed configure will look for the [nss|nspr|mozldap]-devel packages and use the libraries with that if found.

    A sample configure might look something like:

    % ./configure --with-apxs[=/path/to/apxs/] --with-nspr=/path/to/nspr/ --with-nss=/path/to/nss/ --with-ldapsdk=/path/to/ldapsdk
    % gmake all install

    You only need to use =/path/to/apxs if apxs isn't in your path or if you want to install into a specific Apache installation.

    This just installs the library librevocation.so. You will need to manually install the Apache module at this point.  A sample configuration file is provided in revocator.conf.

    NSPR and NSS are both included with Fedora Core 5 but it doesn't ship the Mozilla LDAP SDK.

    Configuration Directives

    CRLEngine

    This boolean turns on/off CRL revocation. This actives the automatic CRL retrieval for this server.

    CRLUpdateCritical

    Shut down server if CRL updates fail (for example, if the remote URL is not accessible).

    CRLAgeCheck

    Boolean that when enabled will shut down server if CRLs are too old. The server will shut down if the age of a downloaded CRL exceeds the time specified in its Next Update field. This condition indicates that the CRL may not contain the most recent information available. To avoid the possibility of users authenticating with compromised certificates that would have been added to an up-to-date CRL, you can choose to have the server shut down automatically when a CRL is considered too old.

    This check is performed when the CRL is downloaded. Therefore, an already downloaded CRL can become older than its Next Update time in the interval between updates and still be considered valid. This feature does not apply to CRLs that do not have a Next Update field.

    CRLFile

    A space-delimited list of protocol://urldata;update_interval;max_age If multiple remote locations are listed then the value will need to be enclosed in double-quotes.

    urldata specifies the URL(s) of remote CRLs to retrieve and install. mod_revocator can download CRLs over HTTP, HTTP over SSL, LDAP, and LDAP over SSL. You can also specify a binary executable to retrieve the data. This executable must return the data via stdout. The executable option is primarily to work around LDAP library resolution problem but any executable may be used. For LDAP you may only retrieve one attribute. Valid URL formats are:

    • ldap[s]://hostname:port/base_dn?attributes?scope?filter
    For example:

    ldap://ldap.example.com:5000/o=example.net?usercertificate%3binary telephoneNumber?sub?(sn=Jensen)??
    • http[s]://username:password at hostname:port/path[?query_string]
    For example:

    https://ca.example.com:1025/getCRL?op=getCRL&issuepoint=MasterCRL
    • exec://path/to/program|argument1|...|argumentn
    For example:

    exec:///opt/fortitude/bin/ldapget|ldap://ldap.example.com:3389/ o=example.com?userCertificate%3bbinary?sub?(uid=crl)??

    The ldapget program is supplied to demonstrate how this works and to provide LDAP/S support. The usage for ldapget is:

    /path/to/ldapget [/path/to/certdatabase] ldap://...

    update_interval specifies the maximum amount of time in minutes to allow between CRL downloads.

    At startup, mod_revocator downloads all CRLs configured for automatic downloading. To determine the time of the next download, mod_revocator uses this value or the time specified in the Next Update field of the CRL, whichever is sooner. Not all CRLs have a Next Update field, however, so you must specify an update interval for each CRL.

    To determine an appropriate update interval, consider the network connectivity and available bandwidth at your site and how often the CRL is updated. If you it is critcal to have up-to-date revocation information then OCSP is probably a better way to go.

    max_age specifies the time in minutes you want mod_revocator to wait past the time indicated in the CRL's Next Update field before determining that the CRL is too old to be valid.

    To avoid unnecessary shutdowns it is recommended that you set this value no lower than 5 minutes and take into account possible system time differences between the server host and the CA's CRL download server.

    If you have not enabled the option CRLUpdateCritical then the value specified in this field has no impact. A good starting value is 60 minutes.

    A sample configuration might look like:

    CRLEngine on
    CRLFile http://somehost.example.com/MasterCRL.crl;60;60
    CRLAgeCheck off
    CRLUpdateCritical off

    Developer Information

    This module uses some internals from NSS. This is normally a big no-no but there was no other way to get around it. As such a private copy of some of the NSS include files can be found in the mozilla subdirectory. If you use a version of NSS other than 3.9.3 then you should replace the files in this directory with appropriate files from whatever version you are using. NSS 3.9.3 introduced a new locking mechanism for PKCS#11 modules. As such the CKFW interface changed slightly so the nsprstub.cpp in this module will not work with previous versions of NSS.
    From fedora-directory-commits at redhat.com Thu Sep 7 20:57:23 2006 From: fedora-directory-commits at redhat.com (Robert Relyea (rrelyea)) Date: Thu, 7 Sep 2006 13:57:23 -0700 Subject: [Fedora-directory-commits] coolkey/src/coolkey machdep.cpp,1.2,1.3 Message-ID: <200609072057.k87KvNut016767@cvs-int.fedora.redhat.com> Author: rrelyea Update of /cvs/dirsec/coolkey/src/coolkey In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv16750 Modified Files: machdep.cpp Log Message: create separate cache files for each user. Set permissions so all users can share the directory. Index: machdep.cpp =================================================================== RCS file: /cvs/dirsec/coolkey/src/coolkey/machdep.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- machdep.cpp 13 Jul 2006 21:32:39 -0000 1.2 +++ machdep.cpp 7 Sep 2006 20:57:20 -0000 1.3 @@ -177,6 +177,7 @@ #define FULL_CLEANUP #else /* if we can't lock on open, don't use locking for now */ +#undef FULL_CLEANUP #define O_EXLOCK 0 #endif @@ -207,9 +208,11 @@ #ifdef FULL_CLEANUP flock(fd,LOCK_EX); unsigned long ref = --(*(unsigned long *)addr); +#ifdef notdef if (ref == 0) { unlink(path); } +#endif flock(fd, LOCK_UN); #endif munmap(addr,size+RESERVED_OFFSET); @@ -228,6 +231,14 @@ SHMem::initSegment(const char *name, int size, bool &init) { bool needInit = true; + /* big enough to hold a uid_t value in decimal */ + /* decimal digits = ceiling(log10(uid_t_max)); */ + /* log10(uid_t_max) = log256(uid_t_max)/log256(10); */ + /* log256(uid_t_max) = sizeof(uid_t); */ + /* log10(256) just greater than .41 */ + /* so decimal_digits = (sizeof(uid_t)*100 +40)/41 */ +#define UID_DIGITS (((sizeof(uid_t)*100)+40)/41) + char uid_str[UID_DIGITS+2]; /* 1 for '-', 1 for null */ init = 0; SHMemData *shmemData = new SHMemData; @@ -236,12 +247,13 @@ // from getSHMemAddr. return NULL; } - int ret = mkdir (MEMSEGPATH, 0755); + int ret = mkdir (MEMSEGPATH, 0777); if ((ret == -1) && (errno != EEXIST)) { delete shmemData; return NULL; } - shmemData->path = new char [sizeof(MEMSEGPATH)+strlen(name)+2]; + /* 1 for the '/', one for the '-' and one for the null */ + shmemData->path = new char [sizeof(MEMSEGPATH)+strlen(name)+UID_DIGITS+3]; if (shmemData->path == NULL) { delete shmemData; return NULL; @@ -249,11 +261,19 @@ memcpy(shmemData->path,MEMSEGPATH, sizeof(MEMSEGPATH)); shmemData->path[sizeof(MEMSEGPATH)-1] = '/'; strcpy(&shmemData->path[sizeof(MEMSEGPATH)],name); + + int mode = 0777; + if (strcmp(name,"token_names") != 0) { + /* each user gets his own uid array */ + sprintf(uid_str, "-%u",getuid()); + strcat(shmemData->path,uid_str); + mode = 0700; + } shmemData->fd = open(shmemData->path, - O_CREAT|O_RDWR|O_EXCL|O_APPEND|O_EXLOCK, 0700); + O_CREAT|O_RDWR|O_EXCL|O_APPEND|O_EXLOCK, mode); if (shmemData->fd < 0) { needInit = false; - shmemData->fd = open(shmemData->path,O_RDWR|O_EXLOCK, 0700); + shmemData->fd = open(shmemData->path,O_RDWR|O_EXLOCK, mode); } else { char *buf; int len = size+RESERVED_OFFSET; From fedora-directory-commits at redhat.com Wed Sep 13 17:43:56 2006 From: fedora-directory-commits at redhat.com (Jack Magne (jmagne)) Date: Wed, 13 Sep 2006 10:43:56 -0700 Subject: [Fedora-directory-commits] esc Makefile,1.1.1.1,1.2 Message-ID: <200609131743.k8DHhu5i012483@cvs-int.fedora.redhat.com> Author: jmagne Update of /cvs/dirsec/esc In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv12466 Modified Files: Makefile Log Message: Cleanup unneeded code for importing NSS. Index: Makefile =================================================================== RCS file: /cvs/dirsec/esc/Makefile,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- Makefile 12 Jun 2006 23:39:49 -0000 1.1.1.1 +++ Makefile 13 Sep 2006 17:43:54 -0000 1.2 @@ -19,29 +19,6 @@ include $(CORE_DEPTH)/coreconf/config.mk -all:: importnss include $(CORE_DEPTH)/coreconf/rules.mk -# only build the card applet on Windows, and if the tools are setup - -ifeq ($(findstring WIN,$(OS_TARGET)),WIN) -ifneq (,$(JAVACARD_KIT_DIR)) -ifneq (,$(JAVA_HOME)) -ifneq (,$(SLB_DIR)) -DIRS += applet -endif -endif -endif -endif - -# import xulrunner to get the gdk - - -IMPORTS += src/xulrunner/v1.8.0.1/xulrunner-1.8.0.1-source.tar.gz -importnss: -ifeq ($(IMPORT_NSS),1) -ifneq ($(wildcard $(NSSDIR)/$(OBJDIR)/include/prtypes.h),$(NSSDIR)/$(OBJDIR)/include/prtypes.h) - $(MAKE) import -endif -endif From fedora-directory-commits at redhat.com Wed Sep 13 17:44:54 2006 From: fedora-directory-commits at redhat.com (Jack Magne (jmagne)) Date: Wed, 13 Sep 2006 10:44:54 -0700 Subject: [Fedora-directory-commits] esc manifest.mn,1.1.1.1,1.2 Message-ID: <200609131744.k8DHisDl012518@cvs-int.fedora.redhat.com> Author: jmagne Update of /cvs/dirsec/esc In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv12501 Modified Files: manifest.mn Log Message: Remove uneeded code to import NSS. Index: manifest.mn =================================================================== RCS file: /cvs/dirsec/esc/manifest.mn,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- manifest.mn 12 Jun 2006 23:39:49 -0000 1.1.1.1 +++ manifest.mn 13 Sep 2006 17:44:51 -0000 1.2 @@ -15,21 +15,11 @@ # All rights reserved. # END COPYRIGHT BLOCK -CORE_DEPTH = . - -REQUIRES = nss nspr +CORE_DEPTH = ./ DIRS = coreconf \ - clib \ - zlib \ - pkcs11 \ - esc \ + src \ $(NULL) -# egate \ -# lib \ -# cmd \ -IMPORTS = nspr20/v4.4.1 \ - nss/NSS_3_9_3_RTM \ - $(NULL) +IMPORTS = $(NULL) From fedora-directory-commits at redhat.com Wed Sep 13 17:45:51 2006 From: fedora-directory-commits at redhat.com (Jack Magne (jmagne)) Date: Wed, 13 Sep 2006 10:45:51 -0700 Subject: [Fedora-directory-commits] esc/coreconf rules.mk,1.1.1.1,1.2 Message-ID: <200609131745.k8DHjpKM012553@cvs-int.fedora.redhat.com> Author: jmagne Update of /cvs/dirsec/esc/coreconf In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv12536 Modified Files: rules.mk Log Message: Minor cleanup. Index: rules.mk =================================================================== RCS file: /cvs/dirsec/esc/coreconf/rules.mk,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- rules.mk 12 Jun 2006 23:39:53 -0000 1.1.1.1 +++ rules.mk 13 Sep 2006 17:45:49 -0000 1.2 @@ -749,7 +749,7 @@ -include $(DEPENDENCIES) -ifneq (,$(filter-out OpenVMS OS2 WIN%,$(OS_TARGET))) +ifneq (,$(filter-out Linux OpenVMS OS2 WIN%,$(OS_TARGET))) # Can't use sed because of its 4000-char line length limit, so resort to perl .DEFAULT: @perl -e ' \ From fedora-directory-commits at redhat.com Wed Sep 13 17:46:55 2006 From: fedora-directory-commits at redhat.com (Jack Magne (jmagne)) Date: Wed, 13 Sep 2006 10:46:55 -0700 Subject: [Fedora-directory-commits] esc/src Makefile, 1.1.1.1, 1.2 manifest.mn, 1.1.1.1, 1.2 Message-ID: <200609131746.k8DHktHx012593@cvs-int.fedora.redhat.com> Author: jmagne Update of /cvs/dirsec/esc/src In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv12574 Modified Files: Makefile manifest.mn Log Message: Minor code cleanup. Index: Makefile =================================================================== RCS file: /cvs/dirsec/esc/src/Makefile,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- Makefile 12 Jun 2006 23:39:49 -0000 1.1.1.1 +++ Makefile 13 Sep 2006 17:46:53 -0000 1.2 @@ -23,14 +23,25 @@ ifeq ($(OS_ARCH), WINNT) -DIRS += mozilla app/xpcom/tray app/xpcom win32 +DIRS += xulrunner app/xpcom/tray app/xpcom win32 endif ifeq ($(OS_ARCH), Darwin) -DIRS += mozilla app/xpcom/tray app/xpcom mac +DIRS += xulrunner app/xpcom/tray app/xpcom mac endif ifeq ($(OS_ARCH), Linux) -DIRS += mozilla lib/docklet app/xpcom/tray app/xpcom +DIRS += xulrunner lib/notifytray app/xpcom/tray app/xpcom +endif + + +ifneq ($(OS_ARCH),Linux) +IMPORTS += src/xulrunner/v1.8.0.1/xulrunner-1.8.0.1-source.tar.gz +importnss: +ifeq ($(IMPORT_NSS),1) +ifneq ($(wildcard $(NSSDIR)/$(OBJDIR)/include/prtypes.h),$(NSSDIR)/$(OBJDIR)/include/prtypes.h) + $(MAKE) import +endif +endif endif Index: manifest.mn =================================================================== RCS file: /cvs/dirsec/esc/src/manifest.mn,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- manifest.mn 12 Jun 2006 23:39:49 -0000 1.1.1.1 +++ manifest.mn 13 Sep 2006 17:46:53 -0000 1.2 @@ -15,7 +15,7 @@ # All rights reserved. # END COPYRIGHT BLOCK -CORE_DEPTH = .. +CORE_DEPTH = ../ DIRS = \ lib/NssHttpClient \ From fedora-directory-commits at redhat.com Wed Sep 13 17:47:29 2006 From: fedora-directory-commits at redhat.com (Jack Magne (jmagne)) Date: Wed, 13 Sep 2006 10:47:29 -0700 Subject: [Fedora-directory-commits] esc/src/xulrunner - New directory Message-ID: <200609131747.k8DHlTTa012619@cvs-int.fedora.redhat.com> Author: jmagne Update of /cvs/dirsec/esc/src/xulrunner In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv12604/xulrunner Log Message: Directory /cvs/dirsec/esc/src/xulrunner added to the repository From fedora-directory-commits at redhat.com Wed Sep 13 17:48:08 2006 From: fedora-directory-commits at redhat.com (Jack Magne (jmagne)) Date: Wed, 13 Sep 2006 10:48:08 -0700 Subject: [Fedora-directory-commits] esc/src/xulrunner Makefile,NONE,1.1 Message-ID: <200609131748.k8DHm8dN012646@cvs-int.fedora.redhat.com> Author: jmagne Update of /cvs/dirsec/esc/src/xulrunner In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv12630 Added Files: Makefile Log Message: Initial revision. --- NEW FILE Makefile --- #! gmake # # BEGIN COPYRIGHT BLOCK # This Program is free software; you can redistribute it and/or modify it under # the terms of the GNU General Public License as published by the Free Software # Foundation; version 2 of the License. # # This Program is distributed in the hope that it will be useful, but WITHOUT # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS # FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.# # You should have received a copy of the GNU General Public License along with # this Program; if not, write to the Free Software Foundation, Inc., 59 Temple # Place, Suite 330, Boston, MA 02111-1307 USA. # # Copyright (C) 2005 Red Hat, Inc. # All rights reserved. # END COPYRIGHT BLOCK CORE_DEPTH = ../.. include $(CORE_DEPTH)/coreconf/config.mk include $(CORE_DEPTH)/coreconf/rules.mk #This just builds Xulrunner if necessary TYPE=Debug ifdef BUILD_OPT TYPE=Release endif MOZ_SRCDIR=$(SOURCE_XP_DIR)/src/mozilla MOZ_OBJDIR=$(DIST)/xulrunner_build MOZ_RELOBJDIR=$(shell pwd)/$(MOZ_OBJDIR) default: $(MOZ_OBJDIR) #use the dependencies to know if we need to rebuild or not export:: $(MOZ_OBJDIR) lib:: $(MOZ_OBJDIR) install:: $(MOZ_OBJDIR) clean:: $(MOZ_OBJDIR): $(MOZ_SRCDIR)/.mozconfig $(MOZ_SRCDIR)/client.mk (cd $(MOZ_SRCDIR) ; make -f client.mk build ) (cd $(MOZ_OBJDIR)/xulrunner/installer ; make ) touch $(MOZ_OBJDIR) $(MOZ_SRCDIR)/.mozconfig: $(SOURCE_XP_DIR)/target.$(TYPE) echo $@ rm -f $@ echo "mk_add_options MOZ_CO_PROJECT=xulrunner" > $@.$(TYPE) echo "mk_add_options MOZ_OBJDIR=$(MOZ_RELOBJDIR)" >> $@.$(TYPE) echo "ac_add_options --enable-application=xulrunner" >> $@.$(TYPE) echo "ac_add_options --disable-tests" >> $@.$(TYPE) echo "ac_cv_visibility_pragma=no" >> $@.$(TYPE) ifdef BUILD_OPT echo "ac_add_options --enable-optimize" >> $@.$(TYPE) echo "ac_add_options --disable-debug" >> $@.$(TYPE) else echo "ac_add_options --disable-optimize" >> $@.$(TYPE) echo "ac_add_options --enable-debug" >> $@.$(TYPE) endif ifeq ($(OS_ARCH),Linux) echo "ac_add_options --disable-javaxpcom" >> $@.$(TYPE) echo "ac_add_options --enable-default-toolkit=gtk2" >> $@.$(TYPE) echo "ac_add_options --enable-xft" >> $@.$(TYPE) echo "ac_add_options --disable-freetype2" >> $@.$(TYPE) echo "ac_add_options --with-system-nspr" >> $@.$(TYPE) echo "ac_add_options --with-system-nss" >> $@.$(TYPE) endif ifeq ($(OS_ARCH), WINNT) echo "ac_add_options --disable-javaxpcom" >> $@.$(TYPE) endif cp $@.$(TYPE) $@ cat $@ #detect changes in .mozconfig and restart mozilla builds if necessary # we can only do a debug or a release build at one time. if we # try to run concurrent builds in the same tree, we will fail. #NOTE: This also means we can't do multiple builds on different platforms # at the same time in the mozilla tree $(SOURCE_XP_DIR)/target.Debug: rm -f $(SOURCE_XP_DIR)/target.Release # release is 'out of date' now touch $(SOURCE_XP_DIR)/target.Debug $(SOURCE_XP_DIR)/target.Release: rm -f $(SOURCE_XP_DIR)/target.Debug # debug is 'out of date' now touch $(SOURCE_XP_DIR)/target.Release From fedora-directory-commits at redhat.com Wed Sep 13 17:49:43 2006 From: fedora-directory-commits at redhat.com (Jack Magne (jmagne)) Date: Wed, 13 Sep 2006 10:49:43 -0700 Subject: [Fedora-directory-commits] esc/src/app/xpcom/tray icon.png, NONE, 1.1 Message-ID: <200609131749.k8DHnhkb012688@cvs-int.fedora.redhat.com> Author: jmagne Update of /cvs/dirsec/esc/src/app/xpcom/tray In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv12672 Added Files: icon.png Log Message: Initial revision. From fedora-directory-commits at redhat.com Wed Sep 13 17:50:15 2006 From: fedora-directory-commits at redhat.com (Jack Magne (jmagne)) Date: Wed, 13 Sep 2006 10:50:15 -0700 Subject: [Fedora-directory-commits] esc/src/app/xpcom/tray Makefile, 1.1.1.1, 1.2 Makefile.in, 1.1.1.1, 1.2 Makefile.moz, 1.1.1.1, 1.2 rhITray.idl, 1.1.1.1, 1.2 rhITrayWindNotify.idl, 1.1.1.1, 1.2 rhLinuxTray.cpp, 1.1.1.1, 1.2 rhMacTray.cpp, 1.1.1.1, 1.2 rhTray.cpp, 1.1.1.1, 1.2 rhTray.h, 1.1.1.1, 1.2 Message-ID: <200609131750.k8DHoFVd012743@cvs-int.fedora.redhat.com> Author: jmagne Update of /cvs/dirsec/esc/src/app/xpcom/tray In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv12696/tray Modified Files: Makefile Makefile.in Makefile.moz rhITray.idl rhITrayWindNotify.idl rhLinuxTray.cpp rhMacTray.cpp rhTray.cpp rhTray.h Log Message: Update to latest Index: Makefile =================================================================== RCS file: /cvs/dirsec/esc/src/app/xpcom/tray/Makefile,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- Makefile 12 Jun 2006 23:39:50 -0000 1.1.1.1 +++ Makefile 13 Sep 2006 17:50:07 -0000 1.2 @@ -29,14 +29,18 @@ #MOZ_OBJDIR=$(MOZ_SRCDIR) endif +ifeq ($(OS_ARCH),Linux) +endif + all export install clean deploy args:: echo "***** Dropping into the Mozilla build environment ***** $(MOZ_OBJDIR) $@" + echo $(DIST) $(MAKE) -f Makefile.moz $@ \ OBJDIR=$(OBJDIR) \ CORE_DIST=$(DIST) \ CORE_INC=$(CORE_INC) \ MOZ_SRCDIR=$(MOZ_SRCDIR) \ - MOZ_OBJDIR=$(MOZ_OBJDIR) + MOZ_OBJDIR=$(MOZ_OBJDIR) \ libs:: @@ -45,13 +49,13 @@ CORE_DIST=$(DIST) \ CORE_INC=$(CORE_INC) \ MOZ_SRCDIR=$(MOZ_SRCDIR) \ - MOZ_OBJDIR=$(MOZ_OBJDIR) + MOZ_OBJ_DIR=$(MOZ_OBJDIR) \ $(MAKE) -f Makefile.moz deploy \ OBJDIR=$(OBJDIR) \ CORE_DIST=$(DIST) \ CORE_INC=$(CORE_INC) \ MOZ_SRCDIR=$(MOZ_SRCDIR) \ - MOZ_OBJDIR=$(MOZ_OBJDIR) + MOZ_OBJ_DIR=$(MOZ_OBJDIR) Index: Makefile.in =================================================================== RCS file: /cvs/dirsec/esc/src/app/xpcom/tray/Makefile.in,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- Makefile.in 12 Jun 2006 23:39:50 -0000 1.1.1.1 +++ Makefile.in 13 Sep 2006 17:50:07 -0000 1.2 @@ -23,18 +23,39 @@ CORE_INC=$(SOURCE_XP_DIR)/public MOZ_SRCDIR=$(SOURCE_XP_DIR)/src/mozilla -MOZ_OBJDIR=$(DIST)/xulrunner_build/mozilla +MOZ_OBJDIR=$(DIST)/xulrunner_build ifeq ($(OS_ARCH), Darwin) #MOZ_OBJDIR=$(MOZ_SRCDIR) endif -all export libs install clean args:: - echo "***** Dropping into the Mozilla build environment ***** $(MOZ_OBJDIR)" +ifeq ($(OS_ARCH),Linux) +endif + +all export install clean deploy args:: + echo "***** Dropping into the Mozilla build environment ***** $(MOZ_OBJDIR) $@" + echo $(DIST) $(MAKE) -f Makefile.moz $@ \ OBJDIR=$(OBJDIR) \ CORE_DIST=$(DIST) \ CORE_INC=$(CORE_INC) \ - MOZ_SRCDIR=$(MOZ_OBJDIR) \ - MOZ_OBJDIR=$(MOZ_OBJDIR) + MOZ_SRCDIR=$(MOZ_SRCDIR) \ + MOZ_OBJDIR=$(MOZ_OBJDIR) \ + +libs:: + + $(MAKE) -f Makefile.moz libs \ + OBJDIR=$(OBJDIR) \ + CORE_DIST=$(DIST) \ + CORE_INC=$(CORE_INC) \ + MOZ_SRCDIR=$(MOZ_SRCDIR) \ + MOZ_OBJ_DIR=$(MOZ_OBJDIR) \ + + $(MAKE) -f Makefile.moz deploy \ + OBJDIR=$(OBJDIR) \ + CORE_DIST=$(DIST) \ + CORE_INC=$(CORE_INC) \ + MOZ_SRCDIR=$(MOZ_SRCDIR) \ + MOZ_OBJ_DIR=$(MOZ_OBJDIR) + Index: Makefile.moz =================================================================== RCS file: /cvs/dirsec/esc/src/app/xpcom/tray/Makefile.moz,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- Makefile.moz 12 Jun 2006 23:39:50 -0000 1.1.1.1 +++ Makefile.moz 13 Sep 2006 17:50:07 -0000 1.2 @@ -28,12 +28,20 @@ MDDEPDIR := $(OBJDIR)/.deps DESTDIR = $(MOZ_OBJDIR)/install +NOTIFY_DEPTH = $(CORE_DEPTH)/src/lib/notifytray +NOTIFY_CXX_FLAGS = -I$(NOTIFY_DEPTH) $(shell pkg-config --cflags glib-2.0) +NOTIFY_LDFLAGS = $(shell pkg-config --libs libnotify) + +NO_DIST_INSTALL = 1 +ifeq ($(OS_ARCH),Linux) + +endif -include $(MOZ_OBJDIR)/config/autoconf.mk OS_CXXFLAGS += $(HOST_CXXFLAGS) -MODULE = rhTray +#MODULE = rhTray XPIDL_MODULE = rhTray LIBRARY_NAME = rhTray @@ -44,13 +52,19 @@ RESFILE=cool.res endif +ifeq ($(OS_ARCH),Linux) + +COOLKEY_LIBS+= -L $(CORE_DIST)/lib -ltraynotify -L/usr/lib $(NOTIFY_LDFLAGS) + +endif + IS_COMPONENT = 1 MODULE_NAME = rhTray # Ensure that the xpcom classes that we build # do not export themselves -DEFINES += -DXPCOM_GLUE $(GECKO_INCLUDES) +DEFINES += -DXPCOM_GLUE $(GECKO_INCLUDES) -I./_xpidlgen REQUIRES = string \ @@ -71,9 +85,8 @@ ifeq ($(OS_ARCH),Linux) CPPSRCS = \ - rhLinuxTray.cpp \ - $(NULL) - + rhLinuxTray.cpp \ + $(NULL) endif ifeq ($(OS_ARCH),Darwin) @@ -93,7 +106,7 @@ INSTALL_STUFF = ifeq ($(OS_ARCH),Linux) -INSTALL_STUFF += CoolKeyLogo.gif +INSTALL_STUFF += icon.png endif ifeq ($(OS_ARCH),WINNT) @@ -104,16 +117,14 @@ ifeq ($(OS_ARCH),Linux) - -CXXFLAGS += $(MOZ_GTK_CFLAGS) $(MOZ_GTK2_CFLAGS) - +CXXFLAGS += $(MOZ_GTK_CFLAGS) $(MOZ_GTK2_CFLAGS) $(NOTIFY_CXX_FLAGS) endif all:: export libs deploy libs:: $(INSTALL_STUFF) rhTray.h - $(NSINSTALL) rhTray.h $(DIST)/include/rhTray + $(NSINSTALL) rhTray.h $(CORE_INC)/rhTray clean:: @@ -122,8 +133,8 @@ deploy:: echo "Deploying" echo $(IMPORT_LIBRARY) - $(NSINSTALL) ./$(LIB_PREFIX)rhTray$(DLL_SUFFIX) $(CORE_DEPTH)/esc/app/xul/esc/components - $(NSINSTALL) ./_xpidlgen/*.xpt $(INSTALL_STUFF) $(CORE_DEPTH)/esc/app/xul/esc/components + $(NSINSTALL) ./$(LIB_PREFIX)rhTray$(DLL_SUFFIX) $(CORE_DEPTH)/src/app/xul/esc/components + $(NSINSTALL) ./_xpidlgen/*.xpt $(INSTALL_STUFF) $(CORE_DEPTH)/src/app/xul/esc/components # separate libraries linked in. Index: rhITray.idl =================================================================== RCS file: /cvs/dirsec/esc/src/app/xpcom/tray/rhITray.idl,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- rhITray.idl 12 Jun 2006 23:39:50 -0000 1.1.1.1 +++ rhITray.idl 13 Sep 2006 17:50:07 -0000 1.2 @@ -1,22 +1,5 @@ -/** BEGIN COPYRIGHT BLOCK - * This Program is free software; you can redistribute it and/or modify it under - * the terms of the GNU General Public License as published by the Free Software - * Foundation; version 2 of the License. - * - * This Program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with - * this Program; if not, write to the Free Software Foundation, Inc., 59 Temple - * Place, Suite 330, Boston, MA 02111-1307 USA. - * - * Copyright (C) 2005 Red Hat, Inc. - * All rights reserved. - * END COPYRIGHT BLOCK **/ - #include "nsISupports.idl" - +#include "rhITrayWindNotify.idl" interface nsIBaseWindow; [scriptable,uuid(18100a23-0e0f-4201-8378-c9625d09be39)] @@ -31,7 +14,16 @@ void hideall(); void showall(); boolean isInitializedAlready(); - void sendnotification(in string aMessage); + void sendnotification(in string aTitle, in string aMessage,in unsigned long aSeverity,in unsigned long aTimeout,in string aIcon); + + void settooltipmsg(in string aMessage); + void seticonimage(in string aIcon); + + void hideicon(); + void showicon(); + + void setwindnotifycallback(in rhITrayWindNotify jsNotify); + void unsetwindnotifycallback(in rhITrayWindNotify jsNotify); }; Index: rhITrayWindNotify.idl =================================================================== RCS file: /cvs/dirsec/esc/src/app/xpcom/tray/rhITrayWindNotify.idl,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- rhITrayWindNotify.idl 12 Jun 2006 23:39:50 -0000 1.1.1.1 +++ rhITrayWindNotify.idl 13 Sep 2006 17:50:07 -0000 1.2 @@ -1,20 +1,3 @@ -/** BEGIN COPYRIGHT BLOCK - * This Program is free software; you can redistribute it and/or modify it under - * the terms of the GNU General Public License as published by the Free Software - * Foundation; version 2 of the License. - * - * This Program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with - * this Program; if not, write to the Free Software Foundation, Inc., 59 Temple - * Place, Suite 330, Boston, MA 02111-1307 USA. - * - * Copyright (C) 2005 Red Hat, Inc. - * All rights reserved. - * END COPYRIGHT BLOCK **/ - #include "nsISupports.idl" Index: rhLinuxTray.cpp =================================================================== RCS file: /cvs/dirsec/esc/src/app/xpcom/tray/rhLinuxTray.cpp,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- rhLinuxTray.cpp 12 Jun 2006 23:39:50 -0000 1.1.1.1 +++ rhLinuxTray.cpp 13 Sep 2006 17:50:07 -0000 1.2 @@ -15,18 +15,23 @@ * All rights reserved. * END COPYRIGHT BLOCK **/ +#define FORCE_PR_LOG 1 + #include "rhTray.h" #include "nsIGenericFactory.h" #include +#include "notifytray.h" +#include "intl/nsIStringBundle.h" NS_IMPL_ISUPPORTS1(rhTray, rhITray) - GtkWidget* rhTray::mWnd = NULL; GtkWidget* rhTray::mIconMenu = NULL; int rhTray::mInitialized = 0; +std::list< nsCOMPtr > rhTray::gTrayWindNotifyListeners; + map< nsIBaseWindow *, rhTrayWindowListener *> rhTray::mWindowMap; @@ -35,18 +40,45 @@ rhTray::rhTray() { /* member initializers and constructor code */ + } rhTray::~rhTray() { - PR_LOG( trayLog, 5, ("rhTray::~rhTray\n")); + PR_LOG( trayLog, PR_LOG_DEBUG, ("rhTray::~rhTray\n")); Cleanup(); /* destructor code */ } +NS_IMETHODIMP rhTray::Setwindnotifycallback(rhITrayWindNotify *jsNotify) +{ + + PR_LOG( trayLog, PR_LOG_DEBUG, ("rhTray::Setwindnotifycallback\n")); + + if(jsNotify) + AddTrayWindNotifyListener(jsNotify); + + + return NS_OK; + +} + /* void unsetwindnotifycallback (in rhITrayWindNotify jsNotify); */ + +NS_IMETHODIMP rhTray::Unsetwindnotifycallback(rhITrayWindNotify *jsNotify) +{ + + + PR_LOG( trayLog, PR_LOG_DEBUG, ("rhTray::Unsetwindnotifycallback\n")); + + if(jsNotify) + RemoveTrayWindNotifyListener(jsNotify); + + return NS_OK; +} + /* void add (); */ NS_IMETHODIMP rhTray::Add(nsIBaseWindow *aWindow) { @@ -54,7 +86,7 @@ NS_ENSURE_ARG(aWindow); - PR_LOG( trayLog, 5, ("rhTray::Add %p \n",aWindow)); + PR_LOG( trayLog, PR_LOG_DEBUG, ("rhTray::Add %p \n",aWindow)); HRESULT res = Initialize(); if(res != S_OK) { @@ -72,7 +104,7 @@ /* void remove (); */ NS_IMETHODIMP rhTray::Remove(nsIBaseWindow *aWindow) { - PR_LOG( trayLog, 5, ("rhTray::Remove window %p \n",aWindow)); + PR_LOG( trayLog, PR_LOG_DEBUG, ("rhTray::Remove window %p \n",aWindow)); if(!aWindow) return NS_OK; @@ -133,9 +165,11 @@ } -NS_IMETHODIMP rhTray::Sendnotification(const char *aMessage) +NS_IMETHODIMP rhTray::Sendnotification(const char *aTitle,const char *aMessage,PRUint32 aSeverity,PRUint32 aTimeout, const char *aIcon) { + if(aMessage) + notify_icon_send_tooltip_msg(aTitle,aMessage,aSeverity,aTimeout,aIcon); return NS_OK; @@ -156,7 +190,42 @@ return NS_OK; } +/* void settooltipmsg (in string aMessage); */ +NS_IMETHODIMP rhTray::Settooltipmsg(const char *aMessage) +{ + + if(aMessage) + notify_icon_set_static_tooltip(aMessage); + + return NS_OK; +} + +/* void seticonimage (in string aIcon); */ +NS_IMETHODIMP rhTray::Seticonimage(const char *aIcon) +{ + + + return NS_OK; +} + +/* void hideicon (); */ +NS_IMETHODIMP rhTray::Hideicon(void) +{ + + notify_icon_hide(); + + return NS_OK; +} + +/* void showicon (); */ +NS_IMETHODIMP rhTray::Showicon(void) +{ + + notify_icon_show(); + + return NS_OK; +} HRESULT rhTray::Initialize() { @@ -166,21 +235,32 @@ return S_OK; } - PR_LOG( trayLog, 5, ("rhTray::Initialize \n")); + PR_LOG( trayLog, PR_LOG_DEBUG, ("rhTray::Initialize \n")); g_set_print_handler(rhTray::TrayPrintHandler); - - HRESULT res = E_FAIL; + + notify_icon_create_with_image_file(COOLKEY_ICON); + + HRESULT res = notify_icon_created_ok(); if(res != S_OK) { return E_FAIL; } + + GtkWidget *icon_widget = notify_icon_get_box_widget(); + + if(icon_widget) + { + g_signal_connect(G_OBJECT(icon_widget), "button-press-event", G_CALLBACK(rhTray::IconCBProc), NULL); + + } + res = CreateEventWindow(); - PR_LOG( trayLog, 5, ("rhTray::Initialize result of CreateIconMenu %d \n",res)); + PR_LOG( trayLog, PR_LOG_DEBUG, ("rhTray::Initialize result of CreateIconMenu %d \n",res)); if(res != S_OK) { @@ -189,6 +269,8 @@ mInitialized = 1; + notify_icon_hide(); + return S_OK; } @@ -199,7 +281,7 @@ HRESULT rhTray::Cleanup() { - PR_LOG( trayLog, 5, ("rhTray::Cleanup.\n")); + PR_LOG( trayLog, PR_LOG_DEBUG, ("rhTray::Cleanup.\n")); RemoveAllListeners(); DestroyEventWindow(); @@ -211,7 +293,7 @@ void rhTray::ShowAllListeners() { - PR_LOG( trayLog, 5, ("rhTray::ShowAllListeners.\n")); + PR_LOG( trayLog, PR_LOG_DEBUG, ("rhTray::ShowAllListeners.\n")); map< nsIBaseWindow *, rhTrayWindowListener *>::iterator i; rhTrayWindowListener *cur = NULL; @@ -235,7 +317,7 @@ void rhTray::HideAllListeners() { - PR_LOG( trayLog, 5, ("rhTray::HideAllListeners.\n")); + PR_LOG( trayLog, PR_LOG_DEBUG, ("rhTray::HideAllListeners.\n")); map< nsIBaseWindow *, rhTrayWindowListener *>::iterator i; @@ -258,7 +340,7 @@ HRESULT rhTray::DestroyEventWindow() { - PR_LOG( trayLog, 5, ("rhTray::DestroyEventWindow \n")); + PR_LOG( trayLog, PR_LOG_DEBUG, ("rhTray::DestroyEventWindow \n")); rhTray::mWnd = 0; @@ -268,7 +350,7 @@ void rhTray::IconMenuCBProc(GtkWidget *widget, gpointer data) { - PR_LOG( trayLog, 5, ("rhTray::IconMenuCBProc data %s \n",data)); + PR_LOG( trayLog, PR_LOG_DEBUG, ("rhTray::IconMenuCBProc data %s \n",data)); if(!strcmp((char *)data,"icon.min")) @@ -278,6 +360,7 @@ if(!strcmp((char *)data,"icon.max")) { + NotifyTrayWindListeners(MENU_EVT,MENU_SHOW); rhTray::ShowAllListeners(); } @@ -290,7 +373,7 @@ HRESULT rhTray::CreateIconMenu() { - PR_LOG( trayLog, 5, ("rhTray::CreateIconMenu \n")); + PR_LOG( trayLog, PR_LOG_DEBUG, ("rhTray::CreateIconMenu \n")); if(mIconMenu) return E_FAIL; @@ -298,11 +381,11 @@ mIconMenu = gtk_menu_new (); GtkWidget *min_item = gtk_menu_item_new_with_label ("Hide"); - GtkWidget *max_item = gtk_menu_item_new_with_label ("Show"); + GtkWidget *max_item = gtk_menu_item_new_with_label ("Manage Keys"); GtkWidget *exit_item = gtk_menu_item_new_with_label ("Exit"); gtk_menu_shell_append (GTK_MENU_SHELL (mIconMenu), max_item); - gtk_menu_shell_append (GTK_MENU_SHELL (mIconMenu), min_item); + //gtk_menu_shell_append (GTK_MENU_SHELL (mIconMenu), min_item); gtk_menu_shell_append (GTK_MENU_SHELL (mIconMenu), exit_item); g_signal_connect(G_OBJECT (min_item), "activate", @@ -326,7 +409,7 @@ void rhTray::IconCBProc(GtkWidget *button, GdkEventButton *event, void *data) { - PR_LOG( trayLog, 5, ("rhTray::IconCBProc \n")); + PR_LOG( trayLog, PR_LOG_DEBUG, ("rhTray::IconCBProc \n")); if(event->type != GDK_BUTTON_PRESS) @@ -364,7 +447,7 @@ HRESULT rhTray::CreateEventWindow() { - PR_LOG( trayLog, 5, ("rhTray::CreateEventWindow \n")); + PR_LOG( trayLog, PR_LOG_DEBUG, ("rhTray::CreateEventWindow \n")); HRESULT res = CreateIconMenu(); return res; @@ -376,7 +459,7 @@ nsresult rv; - PR_LOG( trayLog, 5, ("rhTray::AddListener %p \n",aWindow)); + PR_LOG( trayLog, PR_LOG_DEBUG, ("rhTray::AddListener %p \n",aWindow)); NS_ENSURE_ARG(aWindow); nativeWindow aNativeWindow; @@ -394,7 +477,7 @@ gdk_window_get_user_data (gWnd,(void **)&hWnd); - PR_LOG(trayLog,5, ("rhTray::AddListener is widget %p .\n",hWnd)); + PR_LOG(trayLog,PR_LOG_DEBUG, ("rhTray::AddListener is widget %p .\n",hWnd)); if(!hWnd) { return E_FAIL; @@ -407,20 +490,20 @@ if(already) { - PR_LOG( trayLog, 5, ("rhTray::AddWindowListener Window already registered %p \n",aWindow)); + PR_LOG( trayLog, PR_LOG_DEBUG, ("rhTray::AddWindowListener Window already registered %p \n",aWindow)); return S_OK; } - PR_LOG( trayLog, 5, ("rhTray::AddWindowListener current level widget %p \n",hWnd)); + PR_LOG( trayLog, PR_LOG_DEBUG, ("rhTray::AddWindowListener current level widget %p \n",hWnd)); hWnd = gtk_widget_get_toplevel( hWnd); - PR_LOG( trayLog, 5, ("rhTray::AddWindowListener top level widget %p \n",hWnd)); + PR_LOG( trayLog, PR_LOG_DEBUG, ("rhTray::AddWindowListener top level widget %p \n",hWnd)); if (GTK_WIDGET_TOPLEVEL (hWnd)) { - PR_LOG( trayLog, 5, ("rhTray::AddWindowListener is really a top level widget %p \n",hWnd)); + PR_LOG( trayLog, PR_LOG_DEBUG, ("rhTray::AddWindowListener is really a top level widget %p \n",hWnd)); } rhTrayWindowListener *create = new rhTrayWindowListener(hWnd); @@ -450,7 +533,7 @@ HRESULT rhTray::RemoveListener(nsIBaseWindow *aBaseWindow) { - PR_LOG( trayLog, 5, ("rhTray::RemoveWindowListener %p \n",aBaseWindow)); + PR_LOG( trayLog, PR_LOG_DEBUG, ("rhTray::RemoveWindowListener %p \n",aBaseWindow)); if(!aBaseWindow) return S_OK; @@ -478,7 +561,7 @@ HRESULT rhTray::RemoveAllListeners() { - PR_LOG( trayLog, 5, ("rhTray::RemoveAllListenesr\n")); + PR_LOG( trayLog, PR_LOG_DEBUG, ("rhTray::RemoveAllListenesr\n")); map< nsIBaseWindow *, rhTrayWindowListener *>::iterator i; rhTrayWindowListener *cur = NULL; @@ -503,11 +586,109 @@ } +//rhTrayWindNotify methods + +rhITrayWindNotify* rhTray::GetTrayWindNotifyListener(rhITrayWindNotify *listener) +{ + + std::list >::const_iterator it; + + for(it=gTrayWindNotifyListeners.begin(); it!=gTrayWindNotifyListeners.end(); ++it) { + + if((*it) == listener) + { + return (*it); + } +} + + PR_LOG( trayLog, PR_LOG_DEBUG, ("rhCoolKey::GetNotifyKeyListener: looking for %p returning NULL. \n",listener)); + + return nsnull; + + + +} + +int rhTray::GetTrayWindNotifyListSize() +{ + return gTrayWindNotifyListeners.size(); + +} + + +void rhTray::AddTrayWindNotifyListener(rhITrayWindNotify *listener) +{ + + PR_LOG( trayLog, PR_LOG_DEBUG, ("rhTray::AddTrayWindNotifyListener: %p \n", +listener)); + + if(GetTrayWindNotifyListener(listener )) + { + + PR_LOG( trayLog, PR_LOG_DEBUG, ("rhTray::AddTrayWindNotifyListener: %p listener already in list. \n",listener)); + + return ; + + } + + gTrayWindNotifyListeners.push_back(listener); + + +} + +void rhTray::RemoveTrayWindNotifyListener(rhITrayWindNotify *listener) +{ + + if(!GetTrayWindNotifyListener(listener)) + { + return; + } + + gTrayWindNotifyListeners.remove(listener); + + + listener = NULL; +} + + +void rhTray::ClearTrayWindNotifyList() +{ + + while (gTrayWindNotifyListeners.size() > 0) { + rhITrayWindNotify * node = (gTrayWindNotifyListeners.front()).get(); + + node = NULL; + + gTrayWindNotifyListeners.pop_front(); + } + +} + +void rhTray::NotifyTrayWindListeners(PRUint32 aEvent, PRUint32 aEventData,PRUint32 aKeyData,PRUint32 aData1, PRUint32 aData2) +{ + + PR_LOG( trayLog, PR_LOG_DEBUG, ("rhTray::NotifyTrayWindListeners \n")); + + //Now notify all the listeners of the event + + std::list< nsCOMPtr >::const_iterator it; + for(it=gTrayWindNotifyListeners.begin(); it!=gTrayWindNotifyListeners.end(); ++it) { + + PRBool claimed = 0; + + PR_LOG( trayLog, PR_LOG_DEBUG, ("NotifyTrayWindListeners about to notify \n")); + ((rhITrayWindNotify *) (*it))->RhTrayWindEventNotify(aEvent,aEventData, aKeyData, aData1, aData2, &claimed); + + + } + +} + void rhTray::TrayPrintHandler(const gchar *string) { - PR_LOG( trayLog, 5, ("rhTray:TrayPrintHandler. : %s \n",(char *) string)); + PR_LOG( trayLog, PR_LOG_DEBUG, ("rhTray:TrayPrintHandler. : %s \n",(char *) string)); } //rhTrayWindowListener Methods @@ -519,12 +700,12 @@ rhTrayWindowListener::~rhTrayWindowListener() { - PR_LOG( trayLog, 5, ("rhTrayWindowListener::rhTrayWindowListener.\n")); + PR_LOG( trayLog, PR_LOG_DEBUG, ("rhTrayWindowListener::rhTrayWindowListener.\n")); } HRESULT rhTrayWindowListener::Initialize() { - PR_LOG( trayLog, 5, ("rhTrayWindowListener::Initialize \n")); + PR_LOG( trayLog, PR_LOG_DEBUG, ("rhTrayWindowListener::Initialize \n")); if(mWnd) { @@ -548,7 +729,7 @@ gtk_window_deiconify(GTK_WINDOW(mWnd)); - PR_LOG( trayLog, 5, ("rhTrayWindowListener:: ShowWindow \n")); + PR_LOG( trayLog, PR_LOG_DEBUG, ("rhTrayWindowListener:: ShowWindow \n")); } } @@ -558,7 +739,7 @@ if(mWnd) { gtk_widget_hide(mWnd); - PR_LOG( trayLog, 5, ("rhTrayWindowListener:: Hide Window %p\n",mWnd)); + PR_LOG( trayLog, PR_LOG_DEBUG, ("rhTrayWindowListener:: Hide Window %p\n",mWnd)); } } @@ -568,7 +749,7 @@ g_print("WndDestroyCBProc \n"); - PR_LOG( trayLog, 5, ("rhTrayWindowListener::WndDestroyCBProc \n")); + PR_LOG( trayLog, PR_LOG_DEBUG, ("rhTrayWindowListener::WndDestroyCBProc \n")); } @@ -578,7 +759,7 @@ { g_print("WndDeleteCBProc\n"); - PR_LOG( trayLog, 5, ("rhTrayWindowListener::WndDeleteCBProc \n")); + PR_LOG( trayLog, PR_LOG_DEBUG, ("rhTrayWindowListener::WndDeleteCBProc \n")); rhTrayWindowListener *me = (rhTrayWindowListener *) data; Index: rhMacTray.cpp =================================================================== RCS file: /cvs/dirsec/esc/src/app/xpcom/tray/rhMacTray.cpp,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- rhMacTray.cpp 12 Jun 2006 23:39:50 -0000 1.1.1.1 +++ rhMacTray.cpp 13 Sep 2006 17:50:07 -0000 1.2 @@ -15,6 +15,8 @@ * All rights reserved. * END COPYRIGHT BLOCK **/ +#define FORCE_PR_LOG 1 + #include "rhTray.h" #include "nsIGenericFactory.h" #include @@ -30,6 +32,8 @@ map< nsIBaseWindow *, rhTrayWindowListener *> rhTray::mWindowMap; +std::list< nsCOMPtr > rhTray::gTrayWindNotifyListeners; + static PRLogModuleInfo *trayLog = PR_NewLogModule("tray"); rhTray::rhTray() @@ -40,13 +44,39 @@ rhTray::~rhTray() { - PR_LOG( trayLog, 5, ("rhTray::~rhTray\n")); + PR_LOG( trayLog, PR_LOG_DEBUG, ("rhTray::~rhTray\n")); Cleanup(); /* destructor code */ } +NS_IMETHODIMP rhTray::Setwindnotifycallback(rhITrayWindNotify *jsNotify) +{ + + PR_LOG( trayLog, PR_LOG_DEBUG, ("rhTray::Setwindnotifycallback\n")); + + if(jsNotify) + AddTrayWindNotifyListener(jsNotify); + + + return NS_OK; + +} + /* void unsetwindnotifycallback (in rhITrayWindNotify jsNotify); */ + +NS_IMETHODIMP rhTray::Unsetwindnotifycallback(rhITrayWindNotify *jsNotify) +{ + + + PR_LOG( trayLog, PR_LOG_DEBUG, ("rhTray::Unsetwindnotifycallback\n")); + + if(jsNotify) + RemoveTrayWindNotifyListener(jsNotify); + + return NS_OK; +} + /* void add (); */ NS_IMETHODIMP rhTray::Add(nsIBaseWindow *aWindow) { @@ -54,7 +84,7 @@ NS_ENSURE_ARG(aWindow); - PR_LOG( trayLog, 5, ("rhTray::Add %p \n",aWindow)); + PR_LOG( trayLog, PR_LOG_DEBUG, ("rhTray::Add %p \n",aWindow)); HRESULT res = Initialize(); if(res != S_OK) @@ -73,7 +103,7 @@ /* void remove (); */ NS_IMETHODIMP rhTray::Remove(nsIBaseWindow *aWindow) { - PR_LOG( trayLog, 5, ("rhTray::Remove window %p \n",aWindow)); + PR_LOG( trayLog, PR_LOG_DEBUG, ("rhTray::Remove window %p \n",aWindow)); if(!aWindow) return NS_OK; @@ -150,17 +180,46 @@ } -NS_IMETHODIMP rhTray::Sendnotification(const char *aMessage) +NS_IMETHODIMP rhTray::Sendnotification(const char *aTitle,const char *aMessage,PRUint32 aSeverity,PRUint32 aTimeout, const char *aIcon) +{ + return NS_OK; + +} + +/* void settooltipmsg (in string aMessage); */ +NS_IMETHODIMP rhTray::Settooltipmsg(const char *aMessage) +{ + return NS_OK; +} + +/* void seticonimage (in string aIcon); */ +NS_IMETHODIMP rhTray::Seticonimage(const char *aIcon) +{ + + + return NS_OK; +} + +/* void hideicon (); */ +NS_IMETHODIMP rhTray::Hideicon(void) { + return NS_OK; +} + +/* void showicon (); */ +NS_IMETHODIMP rhTray::Showicon(void) +{ + + return NS_OK; } void rhTray::ShowApp() { - PR_LOG( trayLog, 5, ("rhTray::Show app! \n")); + PR_LOG( trayLog, PR_LOG_DEBUG, ("rhTray::Show app! \n")); ::ShowHideProcess(&rhTray::mPSN,TRUE); ::SetFrontProcess(&rhTray::mPSN); @@ -181,19 +240,19 @@ if(mInitialized) return S_OK; - PR_LOG( trayLog, 5, ("rhTray::Initialize dock: \n")); + PR_LOG( trayLog, PR_LOG_DEBUG, ("rhTray::Initialize dock: \n")); OSErr pRes = GetCurrentProcess ( &mPSN ); - PR_LOG( trayLog, 5, ("rhTray::Initialize App PID result %d \n",pRes)); + PR_LOG( trayLog, PR_LOG_DEBUG, ("rhTray::Initialize App PID result %d \n",pRes)); HRESULT res = CreateApplicationListener(); - PR_LOG( trayLog, 5, ("rhTray::Initialize result of CreateApplicationListener %d \n",res)); + PR_LOG( trayLog, PR_LOG_DEBUG, ("rhTray::Initialize result of CreateApplicationListener %d \n",res)); if(res != S_OK) { @@ -207,7 +266,7 @@ HRESULT rhTray::RemoveIcon() { - PR_LOG( trayLog, 5, ("rhTray::RemoveIcon. \n")); + PR_LOG( trayLog, PR_LOG_DEBUG, ("rhTray::RemoveIcon. \n")); @@ -216,7 +275,7 @@ HRESULT rhTray::Cleanup() { - PR_LOG( trayLog, 5, ("rhTray::Cleanup.\n")); + PR_LOG( trayLog, PR_LOG_DEBUG, ("rhTray::Cleanup.\n")); RemoveAllListeners(); DestroyEventWindow(); @@ -244,7 +303,7 @@ if(!target) return E_FAIL; - PR_LOG( trayLog, 5, ("rhTray::CreateApplicationListener . app target %p\n",target)); + PR_LOG( trayLog, PR_LOG_DEBUG, ("rhTray::CreateApplicationListener . app target %p\n",target)); int numTypes = 4; @@ -265,7 +324,7 @@ { ShowApp(); - PR_LOG( trayLog, 5, ("rhTray::ShowAllListeners.\n")); + PR_LOG( trayLog, PR_LOG_DEBUG, ("rhTray::ShowAllListeners.\n")); map< nsIBaseWindow *, rhTrayWindowListener *>::iterator i; rhTrayWindowListener *cur = NULL; @@ -289,7 +348,7 @@ void rhTray::HideAllListeners() { - PR_LOG( trayLog, 5, ("rhTray::HideAllListeners.\n")); + PR_LOG( trayLog, PR_LOG_DEBUG, ("rhTray::HideAllListeners.\n")); map< nsIBaseWindow *, rhTrayWindowListener *>::iterator i; @@ -313,7 +372,7 @@ HRESULT rhTray::DestroyEventWindow() { - PR_LOG( trayLog, 5, ("rhTray::DestroyEventWindow \n")); + PR_LOG( trayLog, PR_LOG_DEBUG, ("rhTray::DestroyEventWindow \n")); return S_OK; @@ -326,7 +385,7 @@ nsresult rv; - PR_LOG( trayLog, 5, ("rhTray::AddListener %p \n",aWindow)); + PR_LOG( trayLog, PR_LOG_DEBUG, ("rhTray::AddListener %p \n",aWindow)); NS_ENSURE_ARG(aWindow); nativeWindow aNativeWindow; @@ -357,13 +416,13 @@ if(already) { - PR_LOG( trayLog, 5, ("rhTray::AddWindowListener Window already registered %p \n",aWindow)); + PR_LOG( trayLog, PR_LOG_DEBUG, ("rhTray::AddWindowListener Window already registered %p \n",aWindow)); return S_OK; } - PR_LOG( trayLog, 5, ("rhTray::AddWindowListener top level widget %p \n",hWnd)); + PR_LOG( trayLog, PR_LOG_DEBUG, ("rhTray::AddWindowListener top level widget %p \n",hWnd)); rhTrayWindowListener *create = new rhTrayWindowListener(hWnd); @@ -391,7 +450,7 @@ HRESULT rhTray::RemoveListener(nsIBaseWindow *aBaseWindow) { - PR_LOG( trayLog, 5, ("rhTray::RemoveWindowListener %p \n",aBaseWindow)); + PR_LOG( trayLog, PR_LOG_DEBUG, ("rhTray::RemoveWindowListener %p \n",aBaseWindow)); if(!aBaseWindow) return S_OK; @@ -419,7 +478,7 @@ HRESULT rhTray::RemoveAllListeners() { - PR_LOG( trayLog, 5, ("rhTray::RemoveAllListenesr\n")); + PR_LOG( trayLog, PR_LOG_DEBUG, ("rhTray::RemoveAllListenesr\n")); map< nsIBaseWindow *, rhTrayWindowListener *>::iterator i; rhTrayWindowListener *cur = NULL; @@ -444,18 +503,111 @@ } +//rhTrayWindNotify methods + +rhITrayWindNotify* rhTray::GetTrayWindNotifyListener(rhITrayWindNotify *listener) +{ + + std::list >::const_iterator it; + + for(it=gTrayWindNotifyListeners.begin(); it!=gTrayWindNotifyListeners.end(); ++it) { + + if((*it) == listener) + { + return (*it); + } +} + + PR_LOG( trayLog, PR_LOG_DEBUG, ("rhCoolKey::GetNotifyKeyListener: looking for %p returning NULL. \n",listener)); + + return nsnull; + + + +} + +int rhTray::GetTrayWindNotifyListSize() +{ + return gTrayWindNotifyListeners.size(); + +} + +void rhTray::AddTrayWindNotifyListener(rhITrayWindNotify *listener) +{ + + PR_LOG( trayLog, PR_LOG_DEBUG, ("rhTray::AddTrayWindNotifyListener: %p \n", +listener)); + + if(GetTrayWindNotifyListener(listener )) + { + + PR_LOG( trayLog, PR_LOG_DEBUG, ("rhTray::AddTrayWindNotifyListener: %p listener already in list. \n",listener)); + + return ; + + } + + gTrayWindNotifyListeners.push_back(listener); + + +} + +void rhTray::RemoveTrayWindNotifyListener(rhITrayWindNotify *listener) +{ + + if(!GetTrayWindNotifyListener(listener)) + { + return; + } + + gTrayWindNotifyListeners.remove(listener); + + + listener = NULL; +} + +void rhTray::ClearTrayWindNotifyList() +{ + + while (gTrayWindNotifyListeners.size() > 0) { + rhITrayWindNotify * node = (gTrayWindNotifyListeners.front()).get(); + + node = NULL; + + gTrayWindNotifyListeners.pop_front(); + } + +} + +void rhTray::NotifyTrayWindListeners(PRUint32 aEvent, PRUint32 aEventData,PRUint32 aKeyData,PRUint32 aData1, PRUint32 aData2) +{ + + //Now notify all the listeners of the event + + std::list< nsCOMPtr >::const_iterator it; + for(it=gTrayWindNotifyListeners.begin(); it!=gTrayWindNotifyListeners.end(); ++it) { + + PRBool claimed = 0; + + ((rhITrayWindNotify *) (*it))->RhTrayWindEventNotify(aEvent,aEventData, aKeyData, aData1, aData2, &claimed); + + + } + +} + pascal OSStatus rhTray::ApplicationProc(EventHandlerCallRef nextHandler, EventRef aEvent, void *userData) { OSStatus result = eventNotHandledErr; - PR_LOG( trayLog, 5, ("rhTray::ApplicationProc .\n")); + PR_LOG( trayLog, PR_LOG_DEBUG, ("rhTray::ApplicationProc .\n")); int theEvent = GetEventKind(aEvent); int theClass = GetEventClass(aEvent); - PR_LOG( trayLog, 5, ("rhTray::ApplicationProc class %d event: %d \n",theClass,theEvent)); + PR_LOG( trayLog, PR_LOG_DEBUG, ("rhTray::ApplicationProc class %d event: %d \n",theClass,theEvent)); switch(theClass) { @@ -466,12 +618,12 @@ { case kEventAppActivated: - PR_LOG( trayLog, 5, ("rhTray::ApplicationProc App activated! \n")); + PR_LOG( trayLog, PR_LOG_DEBUG, ("rhTray::ApplicationProc App activated! \n")); break; case kEventAppDeactivated: - PR_LOG( trayLog, 5, ("rhTray::ApplicationProc App deactivated! \n")); + PR_LOG( trayLog, PR_LOG_DEBUG, ("rhTray::ApplicationProc App deactivated! \n")); result = noErr; break; @@ -482,7 +634,7 @@ case kEventClassCommand: - PR_LOG( trayLog, 5, ("rhTray::ApplicationProc App kEventClassCommand! \n")); + PR_LOG( trayLog, PR_LOG_DEBUG, ("rhTray::ApplicationProc App kEventClassCommand! \n")); HICommand commandStruct; @@ -494,19 +646,19 @@ switch(commandStruct.commandID) { case kHICommandHide: - PR_LOG( trayLog, 5, ("rhTray::ApplicationProc App kHICommandHide! \n")); + PR_LOG( trayLog, PR_LOG_DEBUG, ("rhTray::ApplicationProc App kHICommandHide! \n")); break; case kHICommandSelectWindow: - PR_LOG( trayLog, 5, ("rhTray::ApplicationProc App kHICommandSelectWindow! \n")); + PR_LOG( trayLog, PR_LOG_DEBUG, ("rhTray::ApplicationProc App kHICommandSelectWindow! \n")); break; case kHICommandClose: - PR_LOG( trayLog, 5, ("rhTray::ApplicationProc App kHICommandClose! \n")); + PR_LOG( trayLog, PR_LOG_DEBUG, ("rhTray::ApplicationProc App kHICommandClose! \n")); break; case kHICommandQuit: - PR_LOG( trayLog, 5, ("rhTray::ApplicationProc App kHICommandQuit! \n")); + PR_LOG( trayLog, PR_LOG_DEBUG, ("rhTray::ApplicationProc App kHICommandQuit! \n")); break; }; @@ -532,14 +684,14 @@ rhTrayWindowListener::~rhTrayWindowListener() { - PR_LOG( trayLog, 5, ("rhTrayWindowListener::~rhTrayWindowListener.\n")); + PR_LOG( trayLog, PR_LOG_DEBUG, ("rhTrayWindowListener::~rhTrayWindowListener.\n")); Cleanup(); } HRESULT rhTrayWindowListener::Initialize() { - PR_LOG( trayLog, 5, ("rhTrayWindowListener::Initialize \n")); + PR_LOG( trayLog, PR_LOG_DEBUG, ("rhTrayWindowListener::Initialize \n")); mEventHandlerUPP = NewEventHandlerUPP(rhTrayWindowListener::WindowProc); @@ -564,24 +716,24 @@ if(mWnd) { - PR_LOG( trayLog, 5, ("rhTrayWindowListener:: ShowWindow \n")); + PR_LOG( trayLog, PR_LOG_DEBUG, ("rhTrayWindowListener:: ShowWindow \n")); if(IsWindowCollapsed(mWnd)) { - PR_LOG( trayLog, 5, ("rhTrayWindowListener:: ShowWindow : uncollapsing collapsed window. \n")); + PR_LOG( trayLog, PR_LOG_DEBUG, ("rhTrayWindowListener:: ShowWindow : uncollapsing collapsed window. \n")); ::CollapseWindow(mWnd,FALSE); } if(!IsWindowVisible(mWnd)) { - PR_LOG( trayLog, 5, ("rhTrayWindowListener:: ShowWindow : Window not visible showing... \n")); + PR_LOG( trayLog, PR_LOG_DEBUG, ("rhTrayWindowListener:: ShowWindow : Window not visible showing... \n")); ::ShowWindow(mWnd); } //::BringToFront(mWnd); - PR_LOG( trayLog, 5, ("rhTrayWindowListener:: ShowWindow : \n")); + PR_LOG( trayLog, PR_LOG_DEBUG, ("rhTrayWindowListener:: ShowWindow : \n")); rhTray::ShowApp(); @@ -593,7 +745,7 @@ if(mWnd) { - PR_LOG( trayLog, 5, ("rhTrayWindowListener:: HideWindow \n")); + PR_LOG( trayLog, PR_LOG_DEBUG, ("rhTrayWindowListener:: HideWindow \n")); //OSStatus res = ::CollapseWindow(mWnd,TRUE); @@ -601,7 +753,7 @@ rhTray::HideApp(); - PR_LOG( trayLog, 5, ("rhTrayWindowListener:: HideWindow \n")); + PR_LOG( trayLog, PR_LOG_DEBUG, ("rhTrayWindowListener:: HideWindow \n")); } @@ -616,13 +768,13 @@ int theEvent = GetEventKind(aEvent); - PR_LOG( trayLog, 5, ("rhTrayWindowListener::WindowProc event: %d \n",theEvent)); + PR_LOG( trayLog, PR_LOG_DEBUG, ("rhTrayWindowListener::WindowProc event: %d \n",theEvent)); switch(theEvent) { case kEventWindowClose: - PR_LOG( trayLog, 5, ("rhTrayWindowListener::WindowProc attempting Window close! \n")); + PR_LOG( trayLog, PR_LOG_DEBUG, ("rhTrayWindowListener::WindowProc attempting Window close! \n")); if(self) self->HideWindow(); @@ -631,17 +783,17 @@ case kEventWindowHidden: - PR_LOG( trayLog, 5, ("rhTrayWindowListener::WindowProc attempting Window hide! \n")); + PR_LOG( trayLog, PR_LOG_DEBUG, ("rhTrayWindowListener::WindowProc attempting Window hide! \n")); break; case kEventWindowClosed: - PR_LOG( trayLog, 5, ("rhTrayWindowListener::WindowProc Window closed! \n")); + PR_LOG( trayLog, PR_LOG_DEBUG, ("rhTrayWindowListener::WindowProc Window closed! \n")); break; case kEventMouseDown: - PR_LOG( trayLog, 5, ("rhTrayWindowListener::WindowProc mouse down! \n")); + PR_LOG( trayLog, PR_LOG_DEBUG, ("rhTrayWindowListener::WindowProc mouse down! \n")); break; } @@ -652,7 +804,7 @@ HRESULT rhTrayWindowListener::Cleanup() { - PR_LOG( trayLog, 5, ("rhTrayWindowListener::Cleanup. \n")); + PR_LOG( trayLog, PR_LOG_DEBUG, ("rhTrayWindowListener::Cleanup. \n")); if(mEventHandlerRef) { Index: rhTray.cpp =================================================================== RCS file: /cvs/dirsec/esc/src/app/xpcom/tray/rhTray.cpp,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- rhTray.cpp 12 Jun 2006 23:39:50 -0000 1.1.1.1 +++ rhTray.cpp 13 Sep 2006 17:50:07 -0000 1.2 @@ -15,6 +15,8 @@ * All rights reserved. * END COPYRIGHT BLOCK **/ +#define FORCE_PR_LOG 1 + #include "rhTray.h" #include "nsIGenericFactory.h" #include @@ -28,6 +30,8 @@ ATOM rhTray::mWndClass = 0; +std::list< nsCOMPtr > rhTray::gTrayWindNotifyListeners; + map< nsIBaseWindow *, rhTrayWindowListener *> rhTray::mWindowMap; NOTIFYICONDATA rhTray::mIconData; @@ -50,13 +54,36 @@ rhTray::~rhTray() { - PR_LOG( trayLog, 5, ("rhTray::~rhTray\n")); + PR_LOG( trayLog, PR_LOG_DEBUG, ("rhTray::~rhTray\n")); Cleanup(); /* destructor code */ } +NS_IMETHODIMP rhTray::Setwindnotifycallback(rhITrayWindNotify *jsNotify) +{ + PR_LOG( trayLog, PR_LOG_DEBUG, ("rhTray::Setwindnotifycallback\n")); + + if(jsNotify) + AddTrayWindNotifyListener(jsNotify); + + return NS_OK; + +} + /* void unsetwindnotifycallback (in rhITrayWindNotify jsNotify); */ + +NS_IMETHODIMP rhTray::Unsetwindnotifycallback(rhITrayWindNotify *jsNotify) +{ + + PR_LOG( trayLog, PR_LOG_DEBUG, ("rhTray::Unsetwindnotifycallback\n")); + + if(jsNotify) + RemoveTrayWindNotifyListener(jsNotify); + + return NS_OK; +} + /* void add (); */ NS_IMETHODIMP rhTray::Add(nsIBaseWindow *aWindow) { @@ -64,7 +91,7 @@ NS_ENSURE_ARG(aWindow); - PR_LOG( trayLog, 5, ("rhTray::Add %p \n",aWindow)); + PR_LOG( trayLog, PR_LOG_DEBUG, ("rhTray::Add %p \n",aWindow)); HRESULT res = Initialize(); if(res != S_OK) { @@ -82,8 +109,7 @@ /* void remove (); */ NS_IMETHODIMP rhTray::Remove(nsIBaseWindow *aWindow) { - PR_LOG( trayLog, 5, ("rhTray::Remove window %p \n",aWindow)); - + PR_LOG( trayLog, PR_LOG_DEBUG, ("rhTray::Remove window %p \n",aWindow)); return NS_OK; } @@ -150,7 +176,7 @@ return NS_OK; } -NS_IMETHODIMP rhTray::Sendnotification(const char *aMessage) +NS_IMETHODIMP rhTray::Sendnotification(const char *aTitle,const char *aMessage,PRUint32 aSeverity,PRUint32 aTimeout, const char *aIcon) { if(aMessage) @@ -163,6 +189,38 @@ } +/* void settooltipmsg (in string aMessage); */ +NS_IMETHODIMP rhTray::Settooltipmsg(const char *aMessage) +{ + return NS_OK; +} + +/* void seticonimage (in string aIcon); */ +NS_IMETHODIMP rhTray::Seticonimage(const char *aIcon) +{ + + + return NS_OK; +} + +/* void hideicon (); */ +NS_IMETHODIMP rhTray::Hideicon(void) +{ + + + return NS_OK; +} + +/* void showicon (); */ +NS_IMETHODIMP rhTray::Showicon(void) +{ + + + return NS_OK; +} + + + HRESULT rhTray::SendBalloonTooltipMessage(char *aMessage) { @@ -189,9 +247,8 @@ return S_OK; } - PR_LOG( trayLog, 5, ("rhTray::Initialize \n")); + PR_LOG( trayLog, PR_LOG_DEBUG, ("rhTray::Initialize \n")); - //MessageBox(NULL,"Inside rhTray::Initialize!",NULL,NULL); HRESULT res = CreateEventWindow(); @@ -227,7 +284,7 @@ rhTray::mIconData.uTimeout = 1000; - PR_LOG(trayLog,5,("rhTray::Initialize tray icon handle %d \n",icon)); + PR_LOG(trayLog,PR_LOG_DEBUG,("rhTray::Initialize tray icon handle %d \n",icon)); ::Shell_NotifyIcon( NIM_ADD, &rhTray::mIconData); @@ -238,7 +295,7 @@ HRESULT rhTray::RemoveIcon() { - PR_LOG( trayLog, 5, ("rhTray::RemoveIcon. \n")); + PR_LOG( trayLog, PR_LOG_DEBUG, ("rhTray::RemoveIcon. \n")); ::Shell_NotifyIcon(NIM_DELETE,&rhTray::mIconData); @@ -248,7 +305,7 @@ HRESULT rhTray::Cleanup() { - PR_LOG( trayLog, 5, ("rhTray::Cleanup.\n")); + PR_LOG( trayLog, PR_LOG_DEBUG, ("rhTray::Cleanup.\n")); RemoveAllListeners(); DestroyEventWindow(); @@ -260,7 +317,7 @@ void rhTray::ShowAllListeners() { - PR_LOG( trayLog, 5, ("rhTray::ShowAllListeners.\n")); + PR_LOG( trayLog, PR_LOG_DEBUG, ("rhTray::ShowAllListeners.\n")); map< nsIBaseWindow *, rhTrayWindowListener *>::iterator i; rhTrayWindowListener *cur = NULL; @@ -284,7 +341,7 @@ void rhTray::HideAllListeners() { - PR_LOG( trayLog, 5, ("rhTray::HideAllListeners.\n")); + PR_LOG( trayLog, PR_LOG_DEBUG, ("rhTray::HideAllListeners.\n")); map< nsIBaseWindow *, rhTrayWindowListener *>::iterator i; @@ -307,7 +364,7 @@ HRESULT rhTray::DestroyEventWindow() { - PR_LOG( trayLog, 5, ("rhTray::DestroyEventWindow \n")); + PR_LOG( trayLog, PR_LOG_DEBUG, ("rhTray::DestroyEventWindow \n")); ::DestroyWindow(rhTray::mWnd); rhTray::mWnd = 0; @@ -318,7 +375,7 @@ HRESULT rhTray::CreateEventWindow() { - PR_LOG( trayLog, 5, ("rhTray::CreateEventWindow \n")); + PR_LOG( trayLog, PR_LOG_DEBUG, ("rhTray::CreateEventWindow \n")); ::SetLastError(0); HINSTANCE hInst = ::GetModuleHandle(NULL); @@ -388,13 +445,13 @@ { case WM_LBUTTONDBLCLK: - PR_LOG( trayLog, 5, ("rhTray::WindowProc: WM_LBUTTONDBLCLK \n")); + PR_LOG( trayLog, PR_LOG_DEBUG, ("rhTray::WindowProc: WM_LBUTTONDBLCLK \n")); ShowAllListeners(); break; case WM_RBUTTONDOWN: - PR_LOG( trayLog, 5, ("rhTray::WindowProc: WM_RBUTTONDOWN \n")); + PR_LOG( trayLog, PR_LOG_DEBUG, ("rhTray::WindowProc: WM_RBUTTONDOWN \n")); HRESULT res = rhTray::ShowPopupMenu (IDR_MENU1); @@ -424,7 +481,7 @@ break; case WM_CREATE: - PR_LOG( trayLog, 5, ("rhTray::WindowProc: WM_CREATE \n")); + PR_LOG( trayLog, PR_LOG_DEBUG, ("rhTray::WindowProc: WM_CREATE \n")); break; default: break; @@ -444,7 +501,7 @@ nsresult rv; - PR_LOG( trayLog, 5, ("rhTray::AddListener %p \n",aWindow)); + PR_LOG( trayLog, PR_LOG_DEBUG, ("rhTray::AddListener %p \n",aWindow)); NS_ENSURE_ARG(aWindow); nativeWindow aNativeWindow; @@ -470,7 +527,7 @@ if(already) { - PR_LOG( trayLog, 5, ("rhTray::AddWindowListener Window already registered %p \n",aWindow)); + PR_LOG( trayLog, PR_LOG_DEBUG, ("rhTray::AddWindowListener Window already registered %p \n",aWindow)); return S_OK; } @@ -502,7 +559,7 @@ hMenu = ::LoadMenu (::GetModuleHandle("rhTray.dll"), MAKEINTRESOURCE (PopupMenuResource)); - PR_LOG( trayLog, 5, ("rhTray::ShowPopupMenu hMenu %d error %d\n",hMenu,GetLastError())); + PR_LOG( trayLog, PR_LOG_DEBUG, ("rhTray::ShowPopupMenu hMenu %d error %d\n",hMenu,GetLastError())); if (hMenu != 0) { POINT pt; @@ -526,7 +583,7 @@ HRESULT rhTray::RemoveListener(nsIBaseWindow *aBaseWindow) { - PR_LOG( trayLog, 5, ("rhTray::RemoveWindowListener %p \n",aBaseWindow)); + PR_LOG( trayLog, PR_LOG_DEBUG, ("rhTray::RemoveWindowListener %p \n",aBaseWindow)); if(!aBaseWindow) return S_OK; @@ -556,7 +613,7 @@ HRESULT rhTray::RemoveAllListeners() { - PR_LOG( trayLog, 5, ("rhTray::RemoveAllListenesr\n")); + PR_LOG( trayLog, PR_LOG_DEBUG, ("rhTray::RemoveAllListenesr\n")); map< nsIBaseWindow *, rhTrayWindowListener *>::iterator i; rhTrayWindowListener *cur = NULL; @@ -570,7 +627,7 @@ { - PR_LOG( trayLog, 5, ("rhTray::RemoveAllListeners deleting %p\n",cur)); + PR_LOG( trayLog, PR_LOG_DEBUG, ("rhTray::RemoveAllListeners deleting %p\n",cur)); delete cur; @@ -584,6 +641,96 @@ } +//rhTrayWindNotify methods + +rhITrayWindNotify* rhTray::GetTrayWindNotifyListener(rhITrayWindNotify *listener) +{ + + std::list >::const_iterator it; + + for(it=gTrayWindNotifyListeners.begin(); it!=gTrayWindNotifyListeners.end(); ++it) { + + if((*it) == listener) + { + return (*it); + } +} + + PR_LOG( trayLog, PR_LOG_DEBUG, ("rhCoolKey::GetNotifyKeyListener: looking for %p returning NULL. \n",listener)); + + return nsnull; + +} + +int rhTray::GetTrayWindNotifyListSize() +{ + return gTrayWindNotifyListeners.size(); + +} +void rhTray::AddTrayWindNotifyListener(rhITrayWindNotify *listener) +{ + + PR_LOG( trayLog, PR_LOG_DEBUG, ("rhTray::AddTrayWindNotifyListener: %p \n", +listener)); + + if(GetTrayWindNotifyListener(listener )) + { + + PR_LOG( trayLog, PR_LOG_DEBUG, ("rhTray::AddTrayWindNotifyListener: %p listener already in list. \n",listener)); + + return ; + + } + + gTrayWindNotifyListeners.push_back(listener); + + +} + +void rhTray::RemoveTrayWindNotifyListener(rhITrayWindNotify *listener) +{ + + if(!GetTrayWindNotifyListener(listener)) + { + return; + } + + gTrayWindNotifyListeners.remove(listener); + + + listener = NULL; +} + +void rhTray::ClearTrayWindNotifyList() +{ + + while (gTrayWindNotifyListeners.size() > 0) { + rhITrayWindNotify * node = (gTrayWindNotifyListeners.front()).get(); + + node = NULL; + + gTrayWindNotifyListeners.pop_front(); + } + +} + +void rhTray::NotifyTrayWindListeners(PRUint32 aEvent, PRUint32 aEventData,PRUint32 aKeyData,PRUint32 aData1, PRUint32 aData2) +{ + + //Now notify all the listeners of the event + + std::list< nsCOMPtr >::const_iterator it; + for(it=gTrayWindNotifyListeners.begin(); it!=gTrayWindNotifyListeners.end(); ++it) { + + PRBool claimed = 0; + + ((rhITrayWindNotify *) (*it))->RhTrayWindEventNotify(aEvent,aEventData, aKeyData, aData1, aData2, &claimed); + + + } + +} + //rhTrayWindowListener Methods @@ -597,7 +744,7 @@ rhTrayWindowListener::~rhTrayWindowListener() { - PR_LOG( trayLog, 5, ("rhTrayWindowListener::~rhTrayWindowListener.\n")); + PR_LOG( trayLog, PR_LOG_DEBUG, ("rhTrayWindowListener::~rhTrayWindowListener.\n")); Cleanup(); @@ -636,27 +783,25 @@ case WM_NCLBUTTONDOWN: switch(wParam) { - case HTMINBUTTON: if(me) { me->HideWindow(); - } - PR_LOG( trayLog, 5, ("rhTrayWindowListener Minimize\n")); + PR_LOG( trayLog, PR_LOG_DEBUG, ("rhTrayWindowListener Minimize\n")); eventClaimed = 1; break; case HTMAXBUTTON: - PR_LOG( trayLog, 5, ("rhTrayWindowListener:: Maximize \n")); + PR_LOG( trayLog, PR_LOG_DEBUG, ("rhTrayWindowListener:: Maximize \n")); eventClaimed = 1; break; case HTCLOSE: - PR_LOG( trayLog, 5, ("rhTrayWindowListener Close! \n")); + PR_LOG( trayLog, PR_LOG_DEBUG, ("rhTrayWindowListener Close! \n")); if(me) { @@ -677,7 +822,7 @@ case WA_ACTIVE: case WA_CLICKACTIVE: - PR_LOG( trayLog, 5, ("rhTrayWindowListener ACTIVATE! \n")); + PR_LOG( trayLog, PR_LOG_DEBUG, ("rhTrayWindowListener ACTIVATE! \n")); break; @@ -701,7 +846,7 @@ } - PR_LOG( trayLog, 5, ("rhTrayWindowListener WM_SHOWWINDOW wParam %d lParam %d! \n",wParam, lParam)); + PR_LOG( trayLog, PR_LOG_DEBUG, ("rhTrayWindowListener WM_SHOWWINDOW wParam %d lParam %d! \n",wParam, lParam)); show = (int) wParam; @@ -709,7 +854,7 @@ if(lParam == 0) { - PR_LOG( trayLog, 5, ("rhTrayWindowListener WM_SHOW called from ShowWindow or HideWindow \n")); + PR_LOG( trayLog, PR_LOG_DEBUG, ("rhTrayWindowListener WM_SHOW called from ShowWindow or HideWindow \n")); } @@ -721,7 +866,7 @@ { case SC_CLOSE: - PR_LOG( trayLog, 5, ("rhTrayWindowListener:: WM_SYSCOMMAND SC_CLOSE \n")); + PR_LOG( trayLog, PR_LOG_DEBUG, ("rhTrayWindowListener:: WM_SYSCOMMAND SC_CLOSE \n")); break; default: @@ -735,7 +880,7 @@ { case SIZE_MINIMIZED: - PR_LOG( trayLog, 5, ("rhTrayWindowListener:: WM_SIZE SIZE_MINIMIZE \n")); + PR_LOG( trayLog, PR_LOG_DEBUG, ("rhTrayWindowListener:: WM_SIZE SIZE_MINIMIZE \n")); break; default: @@ -751,7 +896,7 @@ if(eventClaimed) { - PR_LOG( trayLog, 5, ("rhTrayWindowListener:: Event claimed \n")); + PR_LOG( trayLog, PR_LOG_DEBUG, ("rhTrayWindowListener:: Event claimed \n")); return FALSE; } @@ -766,7 +911,7 @@ HRESULT rhTrayWindowListener::Cleanup() { - PR_LOG( trayLog, 5, ("rhTrayWindowListener::Cleanup. \n")); + PR_LOG( trayLog, PR_LOG_DEBUG, ("rhTrayWindowListener::Cleanup. \n")); return S_OK; @@ -790,7 +935,7 @@ { if(mWnd) { - PR_LOG( trayLog, 5, ("rhTrayWindowListener:: ShowWindow \n")); + PR_LOG( trayLog, PR_LOG_DEBUG, ("rhTrayWindowListener:: ShowWindow \n")); ::ShowWindow(mWnd,SW_SHOW); ::ShowWindow(mWnd,SW_RESTORE); @@ -804,7 +949,7 @@ if(mWnd) { - PR_LOG( trayLog, 5, ("rhTrayWindowListener:: Hide Window \n")); + PR_LOG( trayLog, PR_LOG_DEBUG, ("rhTrayWindowListener:: Hide Window \n")); ::ShowWindow(mWnd,SW_MINIMIZE); ::ShowWindow(mWnd,SW_HIDE); Index: rhTray.h =================================================================== RCS file: /cvs/dirsec/esc/src/app/xpcom/tray/rhTray.h,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- rhTray.h 12 Jun 2006 23:39:50 -0000 1.1.1.1 +++ rhTray.h 13 Sep 2006 17:50:07 -0000 1.2 @@ -26,6 +26,20 @@ #include "widget/nsIBaseWindow.h" #include "widget/nsIWidget.h" + +// Event Defines +#define MENU_EVT 1 +#define APP_EVT 2 +#define WINDOW_EVT 3 + +#define SHOW_ALL_WINDOWS 4 +#define HIDE_ALL_WINDOWS 5 + +#define MENU_SHOW 6 +#define APP_SHOW 7 + + + #ifdef XP_WIN32 #define _WIN32_IE 0x0500 @@ -46,8 +60,11 @@ #include +extern "C" { +#include "notifytray.h" +} -#define COOLKEY_ICON "components/CoolKeyLogo.gif" +#define COOLKEY_ICON "components/icon.png" #endif #include @@ -151,6 +168,20 @@ HRESULT DestroyEventWindow(); HRESULT RemoveIcon(); + + // rhTrayWindNotify content + + static std::list< nsCOMPtr > gTrayWindNotifyListeners; + + + rhITrayWindNotify* GetTrayWindNotifyListener(rhITrayWindNotify *listener); + + int GetTrayWindNotifyListSize(); + void AddTrayWindNotifyListener(rhITrayWindNotify *listener); + void RemoveTrayWindNotifyListener(rhITrayWindNotify *listener); + void ClearTrayWindNotifyList(); + + static void NotifyTrayWindListeners(PRUint32 aEvent, PRUint32 aEventData =0,PRUint32 aKeyData=0, PRUint32 aData1=0, PRUint32 aData2=0); }; #endif @@ -240,6 +271,21 @@ //Gtk print handler static void TrayPrintHandler(const gchar *string); + + + // rhTrayWindNotify content + + static std::list< nsCOMPtr > gTrayWindNotifyListeners; + + + rhITrayWindNotify* GetTrayWindNotifyListener(rhITrayWindNotify *listener); + + int GetTrayWindNotifyListSize(); + void AddTrayWindNotifyListener(rhITrayWindNotify *listener); + void RemoveTrayWindNotifyListener(rhITrayWindNotify *listener); + void ClearTrayWindNotifyList(); + + static void NotifyTrayWindListeners(PRUint32 aEvent, PRUint32 aEventData =0,PRUint32 aKeyData=0, PRUint32 aData1=0, PRUint32 aData2=0); }; #endif @@ -331,6 +377,21 @@ HRESULT RemoveIcon(); + + // rhTrayWindNotify content + + static std::list< nsCOMPtr > gTrayWindNotifyListeners; + + + rhITrayWindNotify* GetTrayWindNotifyListener(rhITrayWindNotify *listener); + + int GetTrayWindNotifyListSize(); + void AddTrayWindNotifyListener(rhITrayWindNotify *listener); + void RemoveTrayWindNotifyListener(rhITrayWindNotify *listener); + void ClearTrayWindNotifyList(); + + static void NotifyTrayWindListeners(PRUint32 aEvent, PRUint32 aEventData =0,PRUint32 aKeyData=0, PRUint32 aData1=0, PRUint32 aData2=0); + }; #endif From fedora-directory-commits at redhat.com Wed Sep 13 17:50:09 2006 From: fedora-directory-commits at redhat.com (Jack Magne (jmagne)) Date: Wed, 13 Sep 2006 10:50:09 -0700 Subject: [Fedora-directory-commits] esc/src/app/xpcom CoolKeyCSP.cpp, 1.1.1.1, 1.2 Makefile, 1.1.1.1, 1.2 Makefile.moz, 1.1.1.1, 1.2 rhCoolKey.cpp, 1.1.1.1, 1.2 rhICoolKey.idl, 1.1.1.1, 1.2 Message-ID: <200609131750.k8DHodWE012754@cvs-int.fedora.redhat.com> Author: jmagne Update of /cvs/dirsec/esc/src/app/xpcom In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv12696 Modified Files: CoolKeyCSP.cpp Makefile Makefile.moz rhCoolKey.cpp rhICoolKey.idl Log Message: Update to latest Index: CoolKeyCSP.cpp =================================================================== RCS file: /cvs/dirsec/esc/src/app/xpcom/CoolKeyCSP.cpp,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- CoolKeyCSP.cpp 12 Jun 2006 23:39:50 -0000 1.1.1.1 +++ CoolKeyCSP.cpp 13 Sep 2006 17:50:07 -0000 1.2 @@ -15,6 +15,8 @@ * All rights reserved. * END COPYRIGHT BLOCK **/ +#define FORCE_PR_LOG 1 + #include #include //#include @@ -384,7 +386,7 @@ - PR_LOG( coolKeyCSPLog, 5, ("CoolKeyCSPListener::RhNotifyStateChange state %d \n",aKeyState)); + PR_LOG( coolKeyCSPLog, PR_LOG_DEBUG, ("CoolKeyCSPListener::RhNotifyStateChange state %d \n",aKeyState)); AutoCoolKey key(aKeyType, aKeyID); Index: Makefile =================================================================== RCS file: /cvs/dirsec/esc/src/app/xpcom/Makefile,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- Makefile 12 Jun 2006 23:39:50 -0000 1.1.1.1 +++ Makefile 13 Sep 2006 17:50:07 -0000 1.2 @@ -26,6 +26,9 @@ MOZ_SRCDIR=$(SOURCE_XP_DIR)/src/mozilla MOZ_OBJDIR=$(DIST)/xulrunner_build +ifeq ($(OS_ARCH),Linux) +endif + all export install clean deploy args:: echo "***** Dropping into the Mozilla build environment ***** $(MOZ_OBJDIR)" @@ -34,7 +37,8 @@ CORE_DIST=$(DIST) \ CORE_INC=$(CORE_INC) \ MOZ_SRCDIR=$(MOZ_SRCDIR) \ - MOZ_OBJDIR=$(MOZ_OBJDIR) + MOZ_OBJDIR=$(MOZ_OBJDIR) \ + libs:: echo "***** Dropping into the Mozilla build environment ***** $(MOZ_OBJDIR)" @@ -43,12 +47,14 @@ CORE_DIST=$(DIST) \ CORE_INC=$(CORE_INC) \ MOZ_SRCDIR=$(MOZ_SRCDIR) \ - MOZ_OBJDIR=$(MOZ_OBJDIR) + MOZ_OBJDIR=$(MOZ_OBJDIR) \ + $(MAKE) -f Makefile.moz deploy \ OBJDIR=$(OBJDIR) \ CORE_DIST=$(DIST) \ CORE_INC=$(CORE_INC) \ MOZ_SRCDIR=$(MOZ_SRCDIR) \ - MOZ_OBJDIR=$(MOZ_OBJDIR) + MOZ_OBJDIR=$(MOZ_OBJDIR) \ + Index: Makefile.moz =================================================================== RCS file: /cvs/dirsec/esc/src/app/xpcom/Makefile.moz,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- Makefile.moz 12 Jun 2006 23:39:49 -0000 1.1.1.1 +++ Makefile.moz 13 Sep 2006 17:50:07 -0000 1.2 @@ -1,4 +1,4 @@ -# ***** BEGIN COPYRIGHT BLOCK ***** + # This Program is free software; you can redistribute it and/or modify it under # the terms of the GNU General Public License as published by the Free Software # Foundation; version 2 of the License. @@ -28,29 +28,25 @@ MDDEPDIR := $(OBJDIR)/.deps DESTDIR = $(MOZ_OBJDIR)/install +NO_DIST_INSTALL = 1 -include $(MOZ_OBJDIR)/config/autoconf.mk -#include $(CORE_DEPTH)/esc/mozilla/config.mk - #XULRUNNER release bundle, taken from ftp site DEPLOY_OBJDIR = $(CORE_DEPTH)/dist/$(OBJDIR)/esc_build +XULRUNNER_ZIP_NAME = xulrunner-1.8.0.1.*.tar.gz +XULRUNNER_BIN_PATH = $(MOZ_OBJDIR)/dist/xulrunner +XULRUNNER_EXEC = xulrunner ifeq ($(OS_ARCH), Darwin) XULRUNNER_BIN_PATH = /Library/Frameworks/XUL.framework XULRUNNER_EXEC = xulrunner-bin XULRUNNER_FRAME_DEST = ESC.app/Contents/Frameworks/XUL.framework XULRUNNER_FRAME_BASE = ESC.app/Contents/Frameworks -else -XULRUNNER_BIN_PATH = /opt/xulrunner/1.8.0.1/xulrunner -DEPLOY_OBJDIR = $(CORE_DEPTH)/dist/$(OBJDIR)/esc_build -XULRUNNER_EXEC = xulrunner -XULRUNNER_FRAME_DEST = esc endif ifeq ($(OS_ARCH), WINNT) -XULRUNNER_BIN_PATH = C:/"Program Files"/"Mozilla XULRunner"/1.8.0.1/xulrunner OS_LIBS += crypt32.lib CSPSRCS = CoolKeyCSP.cpp endif @@ -75,7 +71,7 @@ # Ensure that the xpcom classes that we build # do not export themselves -DEFINES += -DXPCOM_GLUE $(GECKO_INCLUDES) -I$(CORE_INC)/ckymanager -I$(CORE_INC)/httpchuncked +DEFINES += -DXPCOM_GLUE $(GECKO_INCLUDES) -I$(CORE_INC)/ckymanager -I$(CORE_INC)/httpchuncked -I./_xpidlgen REQUIRES = string \ @@ -99,24 +95,26 @@ XPCOM_EXTRA = $(CORE_DIST)/lib/coolkeypk11.dll ifeq ($(OS_ARCH),Linux) -INSTALL_STUFF += $(CORE_DEPTH)/esc/app/gtk/CoolKeyLogo.gif +INSTALL_STUFF += endif -include $(topsrcdir)/config/config.mk - -all:: export libs deploy +install:: +ifdef DESTDIR + $(NSINSTALL) $(DEPLOY_OBJDIR)/esc/* $(DESTDIR) +endif +all:: export libs libs:: $(INSTALL_STUFF) rhCoolKey.h #$(NSINSTALL) $(INSTALL_STUFF) $(DIST)/bin - $(NSINSTALL) rhCoolKey.h $(DIST)/include/rhCoolKey + $(NSINSTALL) rhCoolKey.h $(CORE_INC)/include/rhCoolKey clean:: rm -f Makefile.in rm -rf $(DEPLOY_OBJDIR) - rm -f $(CORE_DEPTH)/esc/app/xul/esc/test.zip - rm -rf $(CORE_DEPTH)/esc/app/xul/esc/esc + rm -rf $(CORE_DEPTH)/src/app/xul/esc/esc deploy: $(DEPLOY_OBJDIR) echo "deploy! on $(OS_ARCH)" @@ -161,28 +159,35 @@ $(DEPLOY_OBJDIR): echo "Installing!" - $(NSINSTALL) ./$(LIB_PREFIX)rhCoolKey$(DLL_SUFFIX) $(CORE_DEPTH)/esc/app/xul/esc/components - $(NSINSTALL) ./_xpidlgen/*.xpt $(CORE_DEPTH)/esc/app/xul/esc/components + $(NSINSTALL) ./$(LIB_PREFIX)rhCoolKey$(DLL_SUFFIX) $(CORE_DEPTH)/src/app/xul/esc/components + $(NSINSTALL) ./_xpidlgen/*.xpt $(CORE_DEPTH)/src/app/xul/esc/components echo "Creating $(DEPLOY_OBJDIR)" mkdir $(DEPLOY_OBJDIR) - cd $(CORE_DEPTH)/esc/app/xul/esc; zip -r test.zip * -x *\CVS\*; unzip -d esc test.zip - $(XULRUNNER_BIN_PATH)/$(XULRUNNER_EXEC) --install-app $(CORE_DEPTH)/esc/app/xul/esc/esc $(DEPLOY_OBJDIR) + cd $(CORE_DEPTH)/src/app/xul/esc; zip -r test.zip * -x *\CVS\* \*.fix*; unzip -d esc test.zip ; rm -f test.zip + $(XULRUNNER_BIN_PATH)/$(XULRUNNER_EXEC) --install-app $(CORE_DEPTH)/src/app/xul/esc/esc $(DEPLOY_OBJDIR) ifeq ($(OS_ARCH), Darwin) mkdir $(DEPLOY_OBJDIR)/$(XULRUNNER_FRAME_BASE) + cp -Rf -v $(XULRUNNER_BIN_PATH) $(DEPLOY_OBJDIR)/$(XULRUNNER_FRAME_DEST) # mkdir $(DEPLOY_OBJDIR)/$(XULRUNNER_FRAME_BASE)/XUL.framework endif - cp -Rf -v $(XULRUNNER_BIN_PATH) $(DEPLOY_OBJDIR)/$(XULRUNNER_FRAME_DEST) + #cp -Rf -v $(XULRUNNER_BIN_PATH) $(DEPLOY_OBJDIR)/$(XULRUNNER_FRAME_DEST) + + tar -xzvf $(MOZ_OBJDIR)/dist/$(XULRUNNER_ZIP_NAME) -C $(DEPLOY_OBJDIR)/$(XULRUNNER_FRAME_DEST)/esc ifeq ($(OS_ARCH),WINNT) cp -f $(XPCOM_EXTRA) $(DEPLOY_OBJDIR)/ESC/components endif +ifdef DESTDIR + $(NSINSTALL) $(DEPLOY_OBJDIR) $(DESTDIR) +endif -include $(topsrcdir)/config/rules.mk ifeq ($(OS_ARCH),WINNT) IMPORT_LIBRARY= endif + Index: rhCoolKey.cpp =================================================================== RCS file: /cvs/dirsec/esc/src/app/xpcom/rhCoolKey.cpp,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- rhCoolKey.cpp 12 Jun 2006 23:39:50 -0000 1.1.1.1 +++ rhCoolKey.cpp 13 Sep 2006 17:50:07 -0000 1.2 @@ -15,10 +15,11 @@ * All rights reserved. * END COPYRIGHT BLOCK **/ +#define FORCE_PR_LOG 1 + #include #include "rhCoolKey.h" #include "CoolKey.h" -#include "CoolKeyPref.h" #include "nsMemory.h" #include "nsXPCOM.h" @@ -95,7 +96,7 @@ CoolKeyShutdownObserver::~CoolKeyShutdownObserver() { - PR_LOG( coolKeyLog, 5, ("CoolKeyShutdownObserver::~CoolKeyShutdownObserver \n")); + PR_LOG( coolKeyLog, PR_LOG_DEBUG, ("CoolKeyShutdownObserver::~CoolKeyShutdownObserver \n")); } @@ -108,7 +109,7 @@ if (!strcmp(aTopic, NS_XPCOM_SHUTDOWN_OBSERVER_ID)) { - PR_LOG( coolKeyLog, 5, ("CoolKeyShutdownObserver::Observe shutting down")); + PR_LOG( coolKeyLog, PR_LOG_DEBUG, ("CoolKeyShutdownObserver::Observe shutting down")); if(single) { @@ -167,7 +168,7 @@ rhCoolKey::rhCoolKey() :mJsNotify(nsnull),mProxy(nsnull) { - PR_LOG( coolKeyLog, 5, ("rhCoolKey::rhCoolKey: %p \n",this)); + PR_LOG( coolKeyLog, PR_LOG_DEBUG, ("rhCoolKey::rhCoolKey: %p \n",this)); if(!single) { @@ -187,7 +188,7 @@ if(res == PR_FALSE) { - PR_LOG( coolKeyLog, 5, ("rhCoolKey::rhCoolKey: InitInstance failed. coolKey_instance %p\n",coolKey_instance)); + PR_LOG( coolKeyLog, PR_LOG_ERROR, ("ESC InitInstance failed,exiting. CoolKey instance %p\n",coolKey_instance)); exit(1); } @@ -199,17 +200,17 @@ { /* destructor code */ - PR_LOG( coolKeyLog, 5, ("rhCoolKey::~rhCoolKey: %p \n",this)); + PR_LOG( coolKeyLog, PR_LOG_DEBUG, ("rhCoolKey::~rhCoolKey: %p \n",this)); } void rhCoolKey::ShutDownInstance() { - PR_LOG( coolKeyLog, 5, ("rhCoolKey::ShutDownInstance. %p \n",this)); + PR_LOG( coolKeyLog, PR_LOG_DEBUG, ("rhCoolKey::ShutDownInstance. %p \n",this)); if (mProxy) { - PR_LOG( coolKeyLog, 5, ("rhCoolKey::ShutDownInstance: About to dereference Proxy Object. Proxy %p \n",mProxy)); + PR_LOG( coolKeyLog, PR_LOG_DEBUG, ("rhCoolKey::ShutDownInstance: About to dereference Proxy Object. Proxy %p \n",mProxy)); CoolKeyUnregisterListener(mProxy); @@ -307,11 +308,11 @@ { PRBool ret = PR_TRUE; - PR_LOG( coolKeyLog, 5, ("rhCoolKey::InitInstance %p \n",this)); + PR_LOG( coolKeyLog, PR_LOG_DEBUG, ("rhCoolKey::InitInstance %p \n",this)); char *path = (char *) GRE_GetXPCOMPath(); - PR_LOG( coolKeyLog, 5, ("rhCoolKey::GREPath %s \n",path)); + PR_LOG( coolKeyLog, PR_LOG_DEBUG, ("rhCoolKey::GREPath %s \n",path)); char xpcom_path[512]; @@ -326,7 +327,7 @@ sprintf(xpcom_path,"%s/%s",path,lib_name); #endif - PR_LOG( coolKeyLog, 5, ("rhCoolKey::xpcom_path %s \n",xpcom_path)); + PR_LOG( coolKeyLog, PR_LOG_DEBUG, ("rhCoolKey::xpcom_path %s \n",xpcom_path)); XPCOMGlueStartup(xpcom_path); @@ -346,7 +347,7 @@ } else { - PR_LOG( coolKeyLog, 5, ("rhCoolKey::InitInstance:Can't create proxy. \n")); + PR_LOG( coolKeyLog, PR_LOG_ERROR, ("Can't create Proxy Object for ESC. \n")); } @@ -402,7 +403,7 @@ observerService->AddObserver(observer, NS_XPCOM_SHUTDOWN_OBSERVER_ID, PR_FALSE); } else { - PR_LOG(coolKeyLog,5,("Could not get an observer service. We will leak on shutdown.")); + PR_LOG(coolKeyLog,PR_LOG_ERROR,("Could not get an observer service. We will leak on shutdown.")); } return ret; @@ -414,7 +415,7 @@ rhICoolKey *proxyObject = NULL; - PR_LOG( coolKeyLog, 5, ("rhCoolKey::CreateProxyObject: \n")); + PR_LOG( coolKeyLog, PR_LOG_DEBUG, ("rhCoolKey::CreateProxyObject: \n")); nsCOMPtr manager = do_GetService(NS_XPCOMPROXY_CONTRACTID); @@ -424,7 +425,7 @@ manager->GetProxyForObject(NS_UI_THREAD_EVENTQ, NS_GET_IID(rhICoolKey), this, PROXY_SYNC | PROXY_ALWAYS, (void**)&proxyObject); - PR_LOG( coolKeyLog, 5, ("rhCoolKey::CreateProxyObject: original: %p proxy %p \n",this,proxyObject)); + PR_LOG( coolKeyLog, PR_LOG_DEBUG, ("rhCoolKey::CreateProxyObject: original: %p proxy %p \n",this,proxyObject)); return proxyObject; @@ -433,12 +434,12 @@ CoolKeyNode* rhCoolKey::GetCoolKeyInfo(unsigned long aKeyType, const char * aKeyID) { - PR_LOG( coolKeyLog, 5, ("rhCoolKey::GetCoolKeyInfo: gASCAvailableKeys %p looking for key %s type %d \n",&gASCAvailableKeys,aKeyID,aKeyType)); + PR_LOG( coolKeyLog, PR_LOG_DEBUG, ("rhCoolKey::GetCoolKeyInfo: gASCAvailableKeys %p looking for key %s type %d \n",&gASCAvailableKeys,aKeyID,aKeyType)); std::list::const_iterator it; for(it=gASCAvailableKeys.begin(); it!=gASCAvailableKeys.end(); ++it) { - PR_LOG( coolKeyLog, 5, ("rhCoolKey::GetCoolKeyInfo: current key %s type %d, looking for key %s type %d \n",(*it)->mKeyID.get(),(*it)->mKeyType,aKeyID,aKeyType)); + PR_LOG( coolKeyLog, PR_LOG_DEBUG, ("rhCoolKey::GetCoolKeyInfo: current key %s type %d, looking for key %s type %d \n",(*it)->mKeyID.get(),(*it)->mKeyType,aKeyID,aKeyType)); if ((*it)->mKeyType == aKeyType && !strcmp((*it)->mKeyID.get(), aKeyID)) return *it; @@ -451,7 +452,7 @@ PRBool rhCoolKey::ASCCoolKeyIsAvailable(unsigned long aKeyType, char * aKeyID) { - PR_LOG( coolKeyLog, 5, ("rhCoolKey::ASCCoolKeyIsAvailable type %d id %s \n",aKeyType,aKeyID)); + PR_LOG( coolKeyLog, PR_LOG_DEBUG, ("rhCoolKey::ASCCoolKeyIsAvailable type %d id %s \n",aKeyType,aKeyID)); return GetCoolKeyInfo(aKeyType, aKeyID) ? PR_TRUE : PR_FALSE; } @@ -461,7 +462,7 @@ nsEmbedCString *aKeyID) { - PR_LOG( coolKeyLog, 5, ("rhCoolKey::ASCGetAvailableCoolKeyAt: index %d type %d id %s \n",aIndex,aKeyType,aKeyID)); + PR_LOG( coolKeyLog, PR_LOG_DEBUG, ("rhCoolKey::ASCGetAvailableCoolKeyAt: index %d type %d id %s \n",aIndex,aKeyType,aKeyID)); if (!aKeyType || !aKeyID) return E_FAIL; @@ -488,7 +489,7 @@ { int size = (int) gASCAvailableKeys.size(); - PR_LOG( coolKeyLog, 5, ("rhCoolKey::ASCGetNumAvailableCoolKeys %d \n",size)); + PR_LOG( coolKeyLog, PR_LOG_DEBUG, ("rhCoolKey::ASCGetNumAvailableCoolKeys %d \n",size)); return size; } @@ -501,21 +502,21 @@ rhIKeyNotify* rhCoolKey::GetNotifyKeyListener(rhIKeyNotify *listener){ - PR_LOG( coolKeyLog, 5, ("rhCoolKey::GetNotifyKeyListener: %p size %d \n",listener,gNotifyListeners.size() )); + PR_LOG( coolKeyLog, PR_LOG_DEBUG, ("rhCoolKey::GetNotifyKeyListener: %p size %d \n",listener,gNotifyListeners.size() )); std::list >::const_iterator it; for(it=gNotifyListeners.begin(); it!=gNotifyListeners.end(); ++it) { - PR_LOG( coolKeyLog, 5, ("rhCoolKey::GetNotifyKeyListener: cur %p looking for %p \n",(*it).get(),listener)); + PR_LOG( coolKeyLog, PR_LOG_DEBUG, ("rhCoolKey::GetNotifyKeyListener: cur %p looking for %p \n",(*it).get(),listener)); if((*it) == listener) { - PR_LOG( coolKeyLog, 5, ("rhCoolKey::GetNotifyKeyListener: looking for %p returning %p \n",listener,(*it).get())); + PR_LOG( coolKeyLog, PR_LOG_DEBUG, ("rhCoolKey::GetNotifyKeyListener: looking for %p returning %p \n",listener,(*it).get())); return (*it); } } - PR_LOG( coolKeyLog, 5, ("rhCoolKey::GetNotifyKeyListener: looking for %p returning NULL. \n",listener)); + PR_LOG( coolKeyLog, PR_LOG_DEBUG, ("rhCoolKey::GetNotifyKeyListener: looking for %p returning NULL. \n",listener)); return nsnull; } @@ -587,23 +588,19 @@ if (!node) { - PR_LOG( coolKeyLog, PR_LOG_DEBUG, ("rhCoolKey::InsertKeyIntoAvailableList: Can't create CoolKeyNode \n")); + PR_LOG( coolKeyLog, PR_LOG_ERROR, ("Can't create new CoolKey Data Structure. \n")); return; - } - - PR_LOG( coolKeyLog, PR_LOG_DEBUG, ("rhCoolKey::InsertKeyIntoAvailableList: about to add node to available key list.\n")); gASCAvailableKeys.push_back(node); - } void rhCoolKey::RemoveKeyFromAvailableList(unsigned long aKeyType, const char * aKeyID) { - PR_LOG( coolKeyLog, 5, ("rhCoolKey::RemoveKeyFromAvailableList type %d id %s \n",aKeyType,aKeyID)); + PR_LOG( coolKeyLog, PR_LOG_DEBUG, ("rhCoolKey::RemoveKeyFromAvailableList type %d id %s \n",aKeyType,aKeyID)); CoolKeyNode *node = GetCoolKeyInfo(aKeyType, aKeyID); if (!node) @@ -615,7 +612,7 @@ void rhCoolKey::ClearAvailableList() { - PR_LOG( coolKeyLog, 5, ("rhCoolKey::ClearAvailableList \n")); + PR_LOG( coolKeyLog, PR_LOG_DEBUG, ("rhCoolKey::ClearAvailableList \n")); while (gASCAvailableKeys.size() > 0) { CoolKeyNode *node = gASCAvailableKeys.front(); delete node; @@ -625,7 +622,7 @@ HRESULT rhCoolKey::ASCSetCoolKeyPin(unsigned long aKeyType, const char * aKeyID, const char * aPin) { - PR_LOG( coolKeyLog, 5, ("rhCoolKey::ASCSetCoolKeyPin type %d id %s pin %s \n",aKeyType,aKeyID,aPin)); + PR_LOG( coolKeyLog, PR_LOG_DEBUG, ("rhCoolKey::ASCSetCoolKeyPin type %d id %s pin %s \n",aKeyType,aKeyID,aPin)); CoolKeyNode *node = GetCoolKeyInfo(aKeyType, aKeyID); if (!node) return E_FAIL; @@ -639,7 +636,7 @@ NS_IMETHODIMP rhCoolKey::RhNotifyKeyStateChange(PRUint32 aKeyType,const char *aKeyID, PRUint32 aKeyState, PRUint32 aData,const char* strData) { - PR_LOG( coolKeyLog, 5, ("rhCoolKey::RhNotifyKeyStateChange: id: %s type: %d state %d data: %d \n",aKeyID,aKeyType, aKeyState,aData)); + PR_LOG( coolKeyLog, PR_LOG_DEBUG, ("rhCoolKey::RhNotifyKeyStateChange: id: %s type: %d state %d data: %d \n",aKeyID,aKeyType, aKeyState,aData)); CoolKeyNode tempKey(aKeyType, aKeyID,(CoolKeyStatus) aKeyState); CoolKeyNode *node = NULL; @@ -657,12 +654,12 @@ if (CoolKeyIsEnrolled(&key)) keyStatus = eAKS_Available; else if (CoolKeyHasApplet(&key)) keyStatus = eAKS_Uninitialized; - PR_LOG( coolKeyLog, PR_LOG_DEBUG, ("rhCoolKey::RhNotifyKeyStateChange: Key Inserted. keyStatus %d \n",keyStatus)); + PR_LOG( coolKeyLog, PR_LOG_ALWAYS, ("Key Inserted. ID %s \n",aKeyID)); InsertKeyIntoAvailableList(tempKey.mKeyType,aKeyID ,(CoolKeyStatus) keyStatus); break; } case eCKState_KeyRemoved: - PR_LOG( coolKeyLog, PR_LOG_DEBUG, ("rhCoolKey::RhNotifyKeyStateChange: Key Removed. \n")); + PR_LOG( coolKeyLog, PR_LOG_ALWAYS, ("Key Removed. ID %s \n",aKeyID)); RemoveKeyFromAvailableList(tempKey.mKeyType, aKeyID); break; case eCKState_EnrollmentComplete: @@ -700,8 +697,6 @@ std::list< nsCOMPtr >::const_iterator it; for(it=gNotifyListeners.begin(); it!=gNotifyListeners.end(); ++it) { - PR_LOG( coolKeyLog, PR_LOG_DEBUG, ("rhCoolKey::RhNotifyKeyStateChange about to call RhNotifyKeyStateChange listener: %p",(*it).get())); - ((rhIKeyNotify *) (*it))->RhNotifyKeyStateChange(aKeyType,aKeyID,aKeyState,aData,strData); PR_LOG( coolKeyLog, PR_LOG_DEBUG, ("rhCoolKey::RhNotifyKeyStateChange after call to RhNotifyKeyStateChange listener: %p",(*it).get())); @@ -709,100 +704,33 @@ } - // Do any post processing: - - switch (aKeyState) - { - case eCKState_KeyInserted: - if (gAutoEnrollBlankTokens && !CoolKeyIsEnrolled(&key)) - //ASCEnrollCoolKey(aKey->mKeyType, keyID, "housekey"), NULL, NULL,NULL,NULL); - break; - } - - return NS_OK; - + return NS_OK; } NS_IMETHODIMP rhCoolKey::RhCoolKeyUnSetNotifyCallback(rhIKeyNotify *jsNotify) { - PR_LOG( coolKeyLog, 5, ("rhCoolKey::RhCoolKeyUnSetNotifyCallback Object: input %p this %p \n",jsNotify,this)); + PR_LOG( coolKeyLog, PR_LOG_DEBUG, ("rhCoolKey::RhCoolKeyUnSetNotifyCallback Object: input %p this %p \n",jsNotify,this)); RemoveNotifyKeyListener(jsNotify); - PR_LOG( coolKeyLog, 5, ("rhCoolKey::RhCoolKeyUnSetNotifyCallback Object: removed listener, size now %d \n",GetNotifyKeyListenerListSize())); + PR_LOG( coolKeyLog, PR_LOG_DEBUG, ("rhCoolKey::RhCoolKeyUnSetNotifyCallback Object: removed listener, size now %d \n",GetNotifyKeyListenerListSize())); if(GetNotifyKeyListenerListSize() == 0) { - PR_LOG( coolKeyLog, 5, ("rhCoolKey::RhCoolKeyUnSetNotifyCallback Object: input %p this %p Listener size 0. \n",jsNotify,this)); - - /* if(mProxy) - { - - CoolKeyUnregisterListener(mProxy); - NS_RELEASE(mProxy); - mProxy = nsnull; - - } -*/ + PR_LOG( coolKeyLog, PR_LOG_DEBUG, ("rhCoolKey::RhCoolKeyUnSetNotifyCallback Object: input %p this %p Listener size 0. \n",jsNotify,this)); } - -/* - if(!jsNotify || !mJsNotify) - { - PR_LOG( coolKeyLog, 5, ("rhCoolKey::RhCoolKeyUnSetNotifyCallback: KeyNotify already unset. \n")); - return NS_OK; - - } - - if(jsNotify == mJsNotify) - { - mJsNotify = nsnull; - - if(mProxy) - { - PR_LOG( coolKeyLog, 5, ("rhCoolKey::RhCoolKeyUnSetNotifyCallback: About to dereference Proxy Object. Proxy %p \n",mProxy)); - - CoolKeyUnregisterListener(mProxy); - - NS_RELEASE(mProxy); - - mProxy = nsnull; - } - - } - else - { - PR_LOG( coolKeyLog, 5, ("rhCoolKey::RhCoolKeyUnSetNotifyCallback: Input Notify Object not equal to member property. \n")); - } - -*/ - return NS_OK; } NS_IMETHODIMP rhCoolKey::RhCoolKeySetNotifyCallback(rhIKeyNotify *jsNotify) { + PR_LOG( coolKeyLog, PR_LOG_DEBUG, ("rhCoolKey::RhCoolKeySetNotifyCallback Object: %p this %p\n",jsNotify,this)); - PR_LOG( coolKeyLog, 5, ("rhCoolKey::RhCoolKeySetNotifyCallback Object: %p this %p\n",jsNotify,this)); - - - AddNotifyKeyListener(jsNotify); - - - /* if(!jsNotify || mJsNotify) - { - PR_LOG( coolKeyLog, 5, ("rhCoolKey::RhCoolKeySetNotifyCallback: returning error. \n")); - return NS_ERROR_FAILURE; - - } - - mJsNotify = jsNotify; - -*/ + AddNotifyKeyListener(jsNotify); return NS_OK; @@ -817,14 +745,12 @@ if (!node) { - PR_LOG( coolKeyLog, 5, ("rhCoolKey::RhBlinkCoolKey: GetCoolKeyInfo failed. \n")); + PR_LOG( coolKeyLog, PR_LOG_DEBUG, ("rhCoolKey::RhBlinkCoolKey: GetCoolKeyInfo failed. \n")); return NS_ERROR_FAILURE; } - if (!aKeyID) { - PR_LOG( coolKeyLog, 5, ("rhCoolKey::RhBlinkCoolKey: aKeyID is null. \n")); return NS_ERROR_FAILURE ; } @@ -846,7 +772,7 @@ NS_IMETHODIMP rhCoolKey::EnrollCoolKey(PRUint32 aKeyType, const char *aKeyID, const char *aEnrollmentType, const char *aScreenName, const char *aPin, const char *aScreenNamePWord, const char *aTokenCode) { - PR_LOG( coolKeyLog, PR_LOG_DEBUG, ("rhCoolKey::RhEnrollCoolKey thread: %p \n",PR_GetCurrentThread())); + PR_LOG( coolKeyLog, PR_LOG_ALWAYS, ("Attempting to Enroll Key ,ID: %s \n",aKeyID)); CoolKeyNode *node = GetCoolKeyInfo(aKeyType, aKeyID); @@ -870,7 +796,6 @@ return NS_OK; } - return NS_OK; } @@ -879,7 +804,7 @@ NS_IMETHODIMP rhCoolKey::ResetCoolKeyPIN(PRUint32 aKeyType, const char *aKeyID, const char *aScreenName, const char *aPIN, const char *aScreenNamePwd) { - PR_LOG( coolKeyLog, PR_LOG_DEBUG, ("rhCoolKey::RhResetCoolKeyPIN thread: %p \n",PR_GetCurrentThread())); + PR_LOG( coolKeyLog, PR_LOG_ALWAYS, ("Attempting to Reset Key PIN, ID: %s \n",aKeyID)); CoolKeyNode *node = GetCoolKeyInfo(aKeyType, aKeyID); if (!node) @@ -923,7 +848,7 @@ NS_IMETHODIMP rhCoolKey::RenewCoolKey(PRUint32 aKeyType, const char *aKeyID) { - PR_LOG( coolKeyLog, PR_LOG_DEBUG, ("rhCoolKey::RhRenewCoolKey (not implemented) thread: %p \n",PR_GetCurrentThread())); + PR_LOG( coolKeyLog, PR_LOG_ERROR, ("rhCoolKey::RhRenewCoolKey (not implemented) thread: %p \n",PR_GetCurrentThread())); return NS_ERROR_NOT_IMPLEMENTED; } @@ -932,7 +857,7 @@ NS_IMETHODIMP rhCoolKey::FormatCoolKey(PRUint32 aKeyType, const char *aKeyID, const char *aEnrollmentType, const char *aScreenName, const char *aPIN, const char *aScreenNamePWord, const char *aTokenCode) { - PR_LOG( coolKeyLog, PR_LOG_DEBUG, ("rhCoolKey::RhFormatCoolKey thread: %p \n",PR_GetCurrentThread())); + PR_LOG( coolKeyLog, PR_LOG_ALWAYS, ("Attempting to Format Key, ID: %s. ",aKeyID)); CoolKeyNode *node = GetCoolKeyInfo(aKeyType, aKeyID); if (!node) @@ -975,7 +900,6 @@ NS_IMETHODIMP rhCoolKey::CancelCoolKeyOperation(PRUint32 aKeyType, const char *aKeyID) { - PR_LOG( coolKeyLog, PR_LOG_DEBUG, ("rhCoolKey::RhCancelCoolKeyOperation thread: %p \n",PR_GetCurrentThread())); CoolKeyNode *node = GetCoolKeyInfo(aKeyType, aKeyID); if (!node) @@ -983,14 +907,14 @@ PR_LOG( coolKeyLog, PR_LOG_DEBUG, ("rhCoolKey::RhCancelCoolKeyOperation type %d id %s status %d: \n",aKeyType,aKeyID,node->mStatus)); + // If the key isn't busy, then there's nothing to do. if (node->mStatus != eAKS_EnrollmentInProgress && node->mStatus != eAKS_UnblockInProgress && node->mStatus != eAKS_PINResetInProgress && node->mStatus != eAKS_RenewInProgress && - node->mStatus != eAKS_FormatInProgress) // && - // node->mStatus != eAKS_BlinkInProgress) + node->mStatus != eAKS_FormatInProgress) return NS_OK; AutoCoolKey key(aKeyType, aKeyID); @@ -1008,7 +932,6 @@ NS_IMETHODIMP rhCoolKey::GetCoolKeyCertNicknames(PRUint32 aKeyType, const char *aKeyID, PRUint32 *count, char ***str) { - if(!aKeyID || !count) { return NS_ERROR_FAILURE; @@ -1065,7 +988,6 @@ NS_IMETHODIMP rhCoolKey::GetAvailableCoolKeys(PRUint32 *count, char ***str) { - PR_LOG( coolKeyLog, PR_LOG_DEBUG, ("rhCoolKey::RhGetAvailableCoolKeys thread: %p \n",PR_GetCurrentThread())); if(!count || !str) @@ -1077,12 +999,11 @@ long numKeys = ASCGetNumAvailableCoolKeys(); - PR_LOG( coolKeyLog, PR_LOG_DEBUG, ("rhCoolKey::RhGetAvailableCoolKeys num keys found: %d \n",numKeys)); + PR_LOG( coolKeyLog, PR_LOG_ALWAYS, ("Attempting to get number of keys. Value: %d \n",numKeys)); if(numKeys == 0) { return NS_OK; - } array = (char **) nsMemory::Alloc((sizeof(char *) * numKeys)); @@ -1103,8 +1024,6 @@ const char *id = keyID.get(); - PR_LOG( coolKeyLog, PR_LOG_DEBUG, ("rhCoolKey::RhGetAvailableCoolKeys iter %d id %s\n",i,id)); - array[i] = NULL; if(id) @@ -1141,7 +1060,6 @@ *_retval = eAKS_Unavailable; } - PR_LOG( coolKeyLog, PR_LOG_DEBUG, ("rhCoolKey::RhGetCoolKeyStatus retval: %d \n",*_retval)); @@ -1185,15 +1103,38 @@ { char *info = (char *) certInfo.c_str(); - char *temp = (char *) nsMemory::Clone(info,sizeof(char) * strlen(info) + 1); - *aCertInfo = temp; - } return NS_OK; } + + +/* string GetCoolKeyIssuerInfo (in unsigned long aKeyType, in string aKeyID); */ NS_IMETHODIMP rhCoolKey::GetCoolKeyIssuerInfo(PRUint32 aKeyType, const char *aKeyID, char **_retval) + { + + *_retval = NULL; + + AutoCoolKey key(aKeyType, aKeyID); + + char issuerInfo[256]; + + HRESULT res = CoolKeyGetIssuerInfo(&key, (char *)&issuerInfo,256); + + PR_LOG( coolKeyLog, PR_LOG_ALWAYS, ("Attempting to get the key's Issuer: Key: %s, Issuer %s. \n",aKeyID, (char *) issuerInfo)); + + if(res == S_OK) + { + char *temp = (char *) nsMemory::Clone(issuerInfo,sizeof(char) * strlen((char *)issuerInfo) + 1); + *_retval = temp; + + } + return NS_OK; + + } + + /* void rhGetCoolKeyPolicy (in unsigned long aKeyType, in string aKeyID, out string policy); */ NS_IMETHODIMP rhCoolKey::GetCoolKeyPolicy(PRUint32 aKeyType, const char *aKeyID, char **policy) { @@ -1207,7 +1148,6 @@ char policyChar[MAX_STR_LEN] ; policyChar[0] = 0; - AutoCoolKey key(aKeyType, aKeyID); HRESULT hres = CoolKeyGetPolicy(&key, policyChar, MAX_STR_LEN); @@ -1226,12 +1166,45 @@ return NS_OK; } + +/* string GetCoolKeyIssuedTo (in unsigned long aKeyType, in string aKeyID); */ +NS_IMETHODIMP rhCoolKey::GetCoolKeyIssuedTo(PRUint32 aKeyType, const char *aKeyID, char **issuedTo) +{ + if (!aKeyID) { + return NS_ERROR_FAILURE; + } + + AutoCoolKey key(aKeyType, ( char *)aKeyID); + + // const char *keyName = CoolKeyGetTokenName(&key); + + char buff[512]; + int bufLength = 512; + buff[0] = 0; + + CoolKeyGetIssuedTo(&key, (char *) buff, bufLength); + + + if(!buff[0]) + { + return NS_OK; + } + + PR_LOG(coolKeyLog,PR_LOG_DEBUG,("rhCoolKey::RhGetCoolKeyGetIssuedTo %s \n",(char *) buff)); + + char *temp = (char *) nsMemory::Clone(buff,sizeof(char) * strlen(buff) + 1); + + *issuedTo = temp; + + return NS_OK; + +} /* boolean SetCoolKeyConfigValue (in string aName, in string aValue); */ NS_IMETHODIMP rhCoolKey::SetCoolKeyConfigValue(const char *aName, const char *aValue, PRBool *_retval) { + PR_LOG( coolKeyLog, PR_LOG_DEBUG, ("rhCoolKey::SetCoolKeyConfigValue thread: %p \n",PR_GetCurrentThread())); if(!aName || !aValue) { - *_retval = 0; return NS_ERROR_FAILURE; } @@ -1244,6 +1217,7 @@ /* string GetCoolKeyConfigValue (in string aName); */ NS_IMETHODIMP rhCoolKey::GetCoolKeyConfigValue(const char *aName, char **_retval) { + PR_LOG( coolKeyLog, PR_LOG_DEBUG, ("rhCoolKey::GetCoolKeyConfigValue thread: %p \n",PR_GetCurrentThread())); if(!aName) { @@ -1252,7 +1226,6 @@ *_retval = (char *) doGetCoolKeyConfigValue(aName); - return NS_OK; } @@ -1344,7 +1317,7 @@ { PR_LOG( coolKeyLog, PR_LOG_DEBUG, ("rhCoolKey::GetCoolKeyVersion \n")); - char *version = "1.2.0"; + char *version = "1.0.0-10"; char *versionVal = (char *) nsMemory::Clone(version,sizeof(char) * strlen(version) + 1); @@ -1360,19 +1333,6 @@ // Implement full module and factory dance so we can see what is going on -//static const nsModuleComponentInfo components[] = -//{ -// { "CoolKey", -// COOLKEY_CID, -// "@redhat.com/rhcoolkey", -// rhCoolKeyConstructor -// } -//}; - -//NS_IMPL_NSGETMODULE(nsSampleModule, components) - - -// factory implementation class for component class rhCoolKeyFactory: public nsIFactory{ private: nsrefcnt mRefCnt; @@ -1501,7 +1461,7 @@ NS_IMETHODIMP_(nsrefcnt) rhCoolKeyModule::AddRef(void) { -PR_LOG( coolKeyLog, 5, ("rhCoolKeyModule::AddRef \n")); +PR_LOG( coolKeyLog, PR_LOG_DEBUG, ("rhCoolKeyModule::AddRef \n")); ++mRefCnt; return mRefCnt; } @@ -1510,7 +1470,7 @@ NS_IMETHODIMP_(nsrefcnt) rhCoolKeyModule::Release(void) { -PR_LOG( coolKeyLog, 5, ("rhCoolKeyModule::Release \n")); +PR_LOG( coolKeyLog, PR_LOG_DEBUG, ("rhCoolKeyModule::Release \n")); --mRefCnt; if (mRefCnt == 0) { mRefCnt = 1; /* stabilize */ @@ -1524,7 +1484,7 @@ NS_IMETHODIMP rhCoolKeyModule::QueryInterface(REFNSIID aIID, void** aInstancePtr) { -PR_LOG( coolKeyLog, 5, ("rhCoolKeyModule::QueryInterface \n")); +PR_LOG( coolKeyLog, PR_LOG_DEBUG, ("rhCoolKeyModule::QueryInterface \n")); if ( !aInstancePtr ) return NS_ERROR_NULL_POINTER; @@ -1558,7 +1518,7 @@ void** result) { -PR_LOG( coolKeyLog, 5, ("rhCoolKeyModule::GetClassObject \n")); +PR_LOG( coolKeyLog, PR_LOG_DEBUG, ("rhCoolKeyModule::GetClassObject \n")); if (!kCoolKeyCID.Equals(aClass)) return NS_ERROR_FACTORY_NOT_REGISTERED; @@ -1589,7 +1549,7 @@ nsIComponentRegistrar* compReg = nsnull; -PR_LOG( coolKeyLog, 5, ("rhCoolKeyModule::RegisterSelf \n")); +PR_LOG( coolKeyLog, PR_LOG_DEBUG, ("rhCoolKeyModule::RegisterSelf \n")); nsresult rv = aCompMgr->QueryInterface(kIComponentRegistrarIID, (void**)&compReg); if (NS_FAILED(rv)) return rv; @@ -1612,7 +1572,7 @@ const char* registryLocation) { -PR_LOG( coolKeyLog, 5, ("rhCoolKeyModule::UnregisterSelf \n")); +PR_LOG( coolKeyLog, PR_LOG_DEBUG, ("rhCoolKeyModule::UnregisterSelf \n")); nsIComponentRegistrar* compReg = nsnull; nsresult rv = aCompMgr->QueryInterface(kIComponentRegistrarIID, (void**)&compReg); @@ -1642,7 +1602,7 @@ { nsresult rv = NS_OK; -PR_LOG( coolKeyLog, 5, ("rhCoolKeyModule::NSGetModule \n")); +PR_LOG( coolKeyLog, PR_LOG_DEBUG, ("rhCoolKeyModule::NSGetModule \n")); // Create and initialize the module instance rhCoolKeyModule *m = new rhCoolKeyModule(); Index: rhICoolKey.idl =================================================================== RCS file: /cvs/dirsec/esc/src/app/xpcom/rhICoolKey.idl,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- rhICoolKey.idl 12 Jun 2006 23:39:49 -0000 1.1.1.1 +++ rhICoolKey.idl 13 Sep 2006 17:50:07 -0000 1.2 @@ -56,10 +56,14 @@ boolean GetCoolKeyIsEnrolled(in unsigned long aKeyType, in string aKeyID); + string GetCoolKeyIssuerInfo(in unsigned long aKeyType, in string aKeyID); + string GetCoolKeyPolicy(in unsigned long aKeyType,in string aKeyID); string GetCoolKeyCertInfo(in unsigned long aKeyType, in string aKeyID, in string aCertNickname); + string GetCoolKeyIssuedTo(in unsigned long aKeyType, in string aKeyID); + boolean GetCoolKeyRequiresAuthentication(in unsigned long aKeyType,in string aKeyID); boolean GetCoolKeyIsAuthenticated(in unsigned long aKeyType,in string aKeyID); From fedora-directory-commits at redhat.com Wed Sep 13 17:52:07 2006 From: fedora-directory-commits at redhat.com (Jack Magne (jmagne)) Date: Wed, 13 Sep 2006 10:52:07 -0700 Subject: [Fedora-directory-commits] esc/src/app/xul/esc/components - New directory Message-ID: <200609131752.k8DHq78T012791@cvs-int.fedora.redhat.com> Author: jmagne Update of /cvs/dirsec/esc/src/app/xul/esc/components In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv12776/components Log Message: Directory /cvs/dirsec/esc/src/app/xul/esc/components added to the repository From fedora-directory-commits at redhat.com Wed Sep 13 17:52:40 2006 From: fedora-directory-commits at redhat.com (Jack Magne (jmagne)) Date: Wed, 13 Sep 2006 10:52:40 -0700 Subject: [Fedora-directory-commits] esc/src/app/xul/esc/components escCLH.js, NONE, 1.1 Message-ID: <200609131752.k8DHqeRh012818@cvs-int.fedora.redhat.com> Author: jmagne Update of /cvs/dirsec/esc/src/app/xul/esc/components In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv12802 Added Files: escCLH.js Log Message: Initial revision. --- NEW FILE escCLH.js --- /* * -myapp commandline handler; starts up My App. */ const nsIAppShellService = Components.interfaces.nsIAppShellService; const nsISupports = Components.interfaces.nsISupports; const nsICategoryManager = Components.interfaces.nsICategoryManager; const nsIComponentRegistrar = Components.interfaces.nsIComponentRegistrar; const nsICommandLine = Components.interfaces.nsICommandLine; const nsICommandLineHandler = Components.interfaces.nsICommandLineHandler; const nsIFactory = Components.interfaces.nsIFactory; const nsIModule = Components.interfaces.nsIModule; const nsIWindowWatcher = Components.interfaces.nsIWindowWatcher; var consoleService = Components .classes['@mozilla.org/consoleservice;1'] .getService( Components.interfaces.nsIConsoleService ); function recordMessage( message ) { consoleService.logStringMessage("esc: " + message + "\n"); } /* * Classes */ const escCLH = { /* nsISupports */ QueryInterface : function clh_QI(iid) { if (iid.equals(nsICommandLineHandler) || iid.equals(nsIFactory) || iid.equals(nsISupports)) return this; throw Components.results.NS_ERROR_NO_INTERFACE; }, /* nsICommandLineHandler */ handle : function clh_handle(cmdLine) { var args = new Object(); args.urlopt = false; recordMessage("handle command line"); try { var wm = Components.classes["@mozilla.org/appshell/window-mediator;1"].getService(Components.interfaces.nsIWindowMediator); var win = wm.getMostRecentWindow(null); if(win) { recordMessage("Subsequent invocation. Launch an Admin page."); win.launchSETTINGS(); return; } var chromeURI = "chrome://esc/content/hiddenWindow.xul"; recordMessage(chromeURI); var wwatch = Components.classes["@mozilla.org/embedcomp/window-watcher;1"] .getService(nsIWindowWatcher); wwatch.openWindow(null, chromeURI, "_blank", "chrome,dialog,height=-1,width=-1,popup=yes", cmdLine); } catch(e) {} }, helpInfo : " -myapp Open the My App.\n", /* nsIFactory */ createInstance : function clh_CI(outer, iid) { if (outer != null) throw Components.results.NS_ERROR_NO_AGGREGATION; return this.QueryInterface(iid); }, lockFactory : function clh_lock(lock) { /* no-op */ } }; const clh_contractID = "@redhat.com/esc-clh;1"; const clh_CID = Components.ID("{36c65861-52a8-4ce9-aa3b-235b88216ed4}"); const clh_category = "c-esc"; const escCLHModule = { /* nsISupports */ QueryInterface : function mod_QI(iid) { if (iid.equals(nsIModule) || iid.equals(nsISupports)) return this; throw Components.results.NS_ERROR_NO_INTERFACE; }, /* nsIModule */ getClassObject : function mod_gch(compMgr, cid, iid) { if (cid.equals(clh_CID)) return escCLH.QueryInterface(iid); throw Components.results.NS_ERROR_NOT_REGISTERED; }, registerSelf : function mod_regself(compMgr, fileSpec, location, type) { compMgr.QueryInterface(nsIComponentRegistrar); compMgr.registerFactoryLocation(clh_CID, "escCLH", clh_contractID, fileSpec, location, type); var catMan = Components.classes["@mozilla.org/categorymanager;1"] .getService(nsICategoryManager); catMan.addCategoryEntry("command-line-handler", clh_category, clh_contractID, true, true); }, unregisterSelf : function mod_unreg(compMgr, location, type) { compMgr.QueryInterface(nsIComponentRegistrar); compMgr.unregisterFactoryLocation(clh_CID, location); var catMan = Components.classes["@mozilla.org/categorymanager;1"] .getService(nsICategoryManager); catMan.deleteCategoryEntry("command-line-handler", clh_category); }, canUnload : function (compMgr) { return true; } }; /* Module initialisation */ function NSGetModule(comMgr, fileSpec) { return escCLHModule; } From fedora-directory-commits at redhat.com Wed Sep 13 17:53:42 2006 From: fedora-directory-commits at redhat.com (Jack Magne (jmagne)) Date: Wed, 13 Sep 2006 10:53:42 -0700 Subject: [Fedora-directory-commits] esc/src/app/xul/esc/defaults/preferences esc-prefs.js, 1.1.1.1, 1.2 Message-ID: <200609131753.k8DHrgQZ012852@cvs-int.fedora.redhat.com> Author: jmagne Update of /cvs/dirsec/esc/src/app/xul/esc/defaults/preferences In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv12835 Modified Files: esc-prefs.js Log Message: Update to the latest. Index: esc-prefs.js =================================================================== RCS file: /cvs/dirsec/esc/src/app/xul/esc/defaults/preferences/esc-prefs.js,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- esc-prefs.js 12 Jun 2006 23:39:51 -0000 1.1.1.1 +++ esc-prefs.js 13 Sep 2006 17:53:40 -0000 1.2 @@ -15,7 +15,7 @@ * All rights reserved. * END COPYRIGHT BLOCK **/ -pref("toolkit.defaultChromeURI", "chrome://esc/content/settings.xul"); +#pref("toolkit.defaultChromeURI", "chrome://esc/content/settings.xul"); pref("esc.tps.url","http://test.host.com:7888/nk_service"); @@ -23,7 +23,7 @@ #pref("esc.enroll.ui.url","http://test.host.com:7888/cgi-bin/esc.cgi?action=autoenroll"); #pref("esc.enrolled.token.url","http://www.test.com"); -pref("esc.hide.on.startup","yes"); +pref("esc.hide.on.startup","no"); @@ -33,3 +33,11 @@ pref("capability.principal.codebase.p0.id", "file://"); pref("esc.tps.message.timeout","90"); + +pref("esc.factory.mode","no"); +pref("esc.show.tabs.ui","no"); + +pref("browser.dom.window.dump.enabled",true); +pref("javascript.options.showInConsole",true); +pref("nglayout.debug.disable_xul_cache",true); +pref("nglayour.debug.disable_xul_fastload",true); From fedora-directory-commits at redhat.com Wed Sep 13 17:54:38 2006 From: fedora-directory-commits at redhat.com (Jack Magne (jmagne)) Date: Wed, 13 Sep 2006 10:54:38 -0700 Subject: [Fedora-directory-commits] esc/src/app/xul/esc/chrome/icons - New directory Message-ID: <200609131754.k8DHscPY012893@cvs-int.fedora.redhat.com> Author: jmagne Update of /cvs/dirsec/esc/src/app/xul/esc/chrome/icons In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv12875/icons Log Message: Directory /cvs/dirsec/esc/src/app/xul/esc/chrome/icons added to the repository From fedora-directory-commits at redhat.com Wed Sep 13 17:54:51 2006 From: fedora-directory-commits at redhat.com (Jack Magne (jmagne)) Date: Wed, 13 Sep 2006 10:54:51 -0700 Subject: [Fedora-directory-commits] esc/src/app/xul/esc/chrome/icons/default - New directory Message-ID: <200609131754.k8DHspBq012914@cvs-int.fedora.redhat.com> Author: jmagne Update of /cvs/dirsec/esc/src/app/xul/esc/chrome/icons/default In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv12899/default Log Message: Directory /cvs/dirsec/esc/src/app/xul/esc/chrome/icons/default added to the repository From fedora-directory-commits at redhat.com Wed Sep 13 17:56:09 2006 From: fedora-directory-commits at redhat.com (Jack Magne (jmagne)) Date: Wed, 13 Sep 2006 10:56:09 -0700 Subject: [Fedora-directory-commits] esc/src/app/xul/esc/chrome/locale/en-US esc.dtd, 1.1.1.1, 1.2 esc.properties, 1.1.1.1, 1.2 Message-ID: <200609131756.k8DHu94I012951@cvs-int.fedora.redhat.com> Author: jmagne Update of /cvs/dirsec/esc/src/app/xul/esc/chrome/locale/en-US In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv12932 Modified Files: esc.dtd esc.properties Log Message: Update to Latest. Index: esc.dtd =================================================================== RCS file: /cvs/dirsec/esc/src/app/xul/esc/chrome/locale/en-US/esc.dtd,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- esc.dtd 12 Jun 2006 23:39:50 -0000 1.1.1.1 +++ esc.dtd 13 Sep 2006 17:56:06 -0000 1.2 @@ -15,39 +15,68 @@ * All rights reserved. ***** END COPYRIGHT BLOCK ***** --> - - - + + + + + + + - + + - + - - - - - - - - - - - - - - - - + + + + + + + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Index: esc.properties =================================================================== RCS file: /cvs/dirsec/esc/src/app/xul/esc/chrome/locale/en-US/esc.properties,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- esc.properties 12 Jun 2006 23:39:50 -0000 1.1.1.1 +++ esc.properties 13 Sep 2006 17:56:06 -0000 1.2 @@ -5,8 +5,7 @@ # # This Program is distributed in the hope that it will be useful, but WITHOUT # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS -# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. -# +# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.# # You should have received a copy of the GNU General Public License along with # this Program; if not, write to the Free Software Foundation, Inc., 59 Temple # Place, Suite 330, Boston, MA 02111-1307 USA. @@ -15,66 +14,158 @@ # All rights reserved. # ***** END COPYRIGHT BLOCK +#ESC strings used in Javascript +#Strings for ESC.js +escTitle=Smart Card Manager +smartCard=smart card +smartCardU=Smart Card +enrolledKey=Enrolled +noKeysPresent=No Cards Present +blankKey=Blank +uninitializedKey=Uninitialized +statusEnrolled=ENROLLED +statusUnavailable=UNAVAILABLE +statusNoApplet=NO APPLET +statusUninitialized=UNINITIALIZED +statusUnknown=UNKNOWN +statusBusy=BUSY +unknownIssuer=Unknown Issuer +redHatUser=User +statusUnknown=Unknown +tokenInformation=CARD INFORMATION +advancedInformation=Diagnostics Information +keyID=Key ID: +tpsURI=Server URL: +tpsUI=External UI URL: +status=Status: +issuer=Issuer: +escLogEntries=Log Entries +noLogFileOrData=No Log File or Log File Has No Data. +certsOnToken=CERTIFICATES on KEY +certificateNickname=Certificate Nickname: +coolkeyComponentVersion=Smart Card Manager Version: +coolkeyDetectedNumberKeys=Number of Smart Cards Detected: +enrolledDetected=Enrolled Smart Card Detected +enrolledDetectedMessage=Smart Card Manager has detected an enrolled card. If you would rather not re-enroll this card press "Close". +formatingToken=Formatting... +enrollingToken=Enrolling... +resettingTokenPIN=Resetting Password... +cancellingOperation=Cancelling... +blinkingToken=Blinking... +keyInserted=Smart Card Inserted! +keyRemoved=Smart Card Removed! +keyInsertedComputer=Security Smart Card Inserted into the computer. +keyRemovedComputer=Security Smart Card Removed from the computer. +diagnosticsMessage=The information below is diagnostic information that your system generates as you use your smart card. If you are having smart card problems, you may be asked by your support engineer to send this information for analysis. +#ESC Error Messages from TPS +errorNone=Operation Completed Successfully. +serverError=Smart Card Server error. +errorProblemResetTokenPin=Problem resetting smart card's pin. +errorTokenEnrollment=Smart card enrollment error. +errorCommCA=Error communicating with the Certification Authority. +errorInternalServer=Internal Smart Card Server error. +errorResetPin=Error resetting the smart card's password. +errorInternalServer=Internal Smart Card Server error. +errorAuthFailure=Smart Card Server authentication failure. +errorTokenDisabled=Your smart card is listed as disabled. +errorProblemCommToken=Problem communicating with the smart card. +errorTokenUpgrade=Cannot upgrade smart card software. +errorInvalidTokenType=Invalid smart card type. +errorCannotPublish=Cannot publish smart card information. +errorCommTokenDB=Cannot communicate with smart card database. +errorPinReset=Cannot reset the password value for the smart card. +errorConnLost=Connection to Smart Card Server. +errorEntryTokenDB=Can not create entry for smart card in smart card database. +errorNoTokenState=Smart card found to be in an inconsistent state. +errorInvalidLostTokenReason=Invalid reason for lost smart card submitted. +errorTokenUnusable=Smart card found to be unusable due to compromise. +errorNoInactiveToken=No such inactive smart card found. +errorProcessMultiTokens=Can not process more than one active smart card. +errorKeyRecoveryProcessed=Smart card key recovery has been processed. +errorKeyRecoveryFailed=Smart card key recovery failed. +errorNoOperateLostToken=Cannot process this smart card, which has been reported lost. +errorKeyArchival=Smart card key archival error. +errorConnTKS=Problem connecting to the Smart Card TKS Server. +errorFailUpdateTokenDB=Failed to update smart card database. +errorCertRevocation=Internal certificate revocation error discovered. +errorNotOwnToken=User does not own this smart card. +errorESCMisconfigured=Smart Card Manager has been misconfigured. +errorESCNoCommCardReader=Smart Card Manager can't communicate with card reader. +errorESCNoTokenSession=Smart Card Manager can't initiate session with smart card. +errorESCNoTalkTPS=Smart Card Manager can't talk to Smart Card Server. +errorESCNoTalkTokenReader=Smart Card Manager can't talk to smart card reader. +#ESC text in general Alert messages +errorCoolKeyIsAuth=coolkey.GetCoolKeyIsAuthenticated() failed! +errorAuthCoolKey=coolkey.AuthenticateCoolKey failed! errorJsNotifyInterface=Can't find jsNotify interface. -errorUniversalXPConnect=Can't get UniversalXPConnect +errorUniversalXPConnect=Can't get UniversalXPConnect. +errorConfigValue=Error obtaining issuer info for key. errorConfigValue=Error Getting Config Value: +errorSetConfigValue=Error SettingConfig Value: errorBlankTPSURI=Blank Tps Uri submitted. -aboutToTestTPSURI=About to test TPS URI: -errorSelectKey=Please select a key. -tpsURLContacted=TPS URL has been successfully contacted. -errorContactTPSURL=Error contacting TPS URL, reconfigure and try again. +noTpsConfigUrl=You must provide a Url to test! +aboutToTestTPSURI=About to test Smart Card Server URI: +errorSelectKey=Please select a Smart card. +tpsURLContacted=Smart Card Server URL has been successfully contacted. +errorContactTPSURL=Error contacting Smart Card Server URL, reconfigure and try again. errorBlankEnrollURI=Blank Enroll Uri submitted. -aboutToTestEnrollURI=About to test Enroll URI: -enrollURLContacted=ESC Enrollment URL has been successfully contacted. -errorContactEnrollURL=Error contacting ESC Enroll URL, reconfigure and try again. -tpsURIMustHaveValue=TPS URI item must have a value! -errorSetConfigValue=Error setting config value!: +aboutToTestEnrollURI=About to test Enroll URI: +enrollURLContacted=x Enrollment URL has been successfully contacted. +errorContactEnrollURL=Error contacting Enroll URL, reconfigure and try again. +tpsConfigSuccess=Smart Card Server config information successfully obtained! +tpsConfigError=Error obtaining Smart Card Server config information! +tpsConfigTest=About to test the Smart Card Server Phone Home Url : +tpsNoConfigUrl=Provide a valid Smart Card Server config URL! +tpsURIMustHaveValue=Smart Card Server URL item must have a value! +errorSetConfigValue=Error setting config value!: configChangesSubmitted=Configuration changes submitted. -errorSetDataValue=Error Setting data values: -errorCoolKeyGetStatus=coolkey.GetCoolKeyStatus() failed! -errorCoolKeyRequiresAuth=coolkey.GetCoolKeyRequiresAuthentication() failed! -errorCoolKeyIsAuth=coolkey.GetCoolKeyIsAuthenticated() failed! -errorAuthCoolKey=coolkey.AuthenticateCoolKey failed! -statusEnrolled=ENROLLED -unknownIssuer=Unknown Issuer -redHatUser=Red Hat User -statusUnknown=Unknown -errorNone=Operation Completed Successfully. -serverError=Server Error. -errorProblemResetTokenPin=Problem resetting token's pin. -errorTokenEnrollment=Token Enrollment Error. -errorCommCA=Error communicating with the Certificate Authority, try again later. -errorInternalServer=Internal Server Error. -errorResetPin=Error resetting the token's pin. -errorInternalServer=Internal Server Error. -errorAuthFailure=Authentication Failure, Try Again. -errorTokenDisabled=Token is disabled, contact technical support. -errorProblemCommToken=Problem communicating with the token. -errorTokenUpgrade=Cannot upgrade token software. -errorInvalidTokenType=Invalid token type. -errorCannotPublish=Cannot publish. -errorCommTokenDB=Cannot communicate with token database, try again later. -errorTokenDisabled=Token is disabled, contact techincal support. -errorPinReset=Cannot reset pin value for the token, contact technical support. -errorConnLost=Connection to server lost. -errorEntryTokenDB=Can not create entry for token in database, contact technical support. -errorNoTokenState=No such token state, contact technical support. -errorInvalidLostTokenReason=Invalid lost token reason, contact technical support. -errorTokenUnusable=Token unusable due to compromise,contact technical support. -errorNoInactiveToken=No such inactive token, contact technical support. -errorProcessMultiTokens=Can not process more than one active token. -errorKeyRecoveryProcessed=Key Recovery has been processed. -errorKeyRecoveryFailed=Key Recovery failed, contact technical support. -errorNoOperateLostToken=Can not operate on token reported lost, contact technical support. -errorKeyArchival=Key archival error, contact technical support. -errorConnTKS=Problem connecting to the TKS, contact technical support. -errorFailUpdateTokenDB=Failed to update token database, contact technical support. -errorCertRevocation=Internal certificate revocation error,contact technical support. -errorNotOwnToken=User does not own this token, contact technical support. -errorESCMisconfigured=ESC has been misconfigured, reconfigure and try again. -errorESCNoCommCardReader=ESC can't communicate with card reader. -errorESCNoTokenSession=ESC can't initiate session with token. -errorESCNoTalkTPS=ESC can't talk to TPS. -errorESCNoTalkTokenReader=ESC can't talk to token reader. - - +errorSetDataValue=Error Setting data values: +errorCoolKeyGetStatus=coolkey.GetCoolKeyStatus() failed! +errorCoolKeyGetPolicy=coolkey.GetCoolKeyPolicy() failed! +errorCoolKeyRequiresAuth=coolkey.GetCoolKeyRequiresAuthentication() failed! +errorCoolKeyIsAuth=coolkey.GetCoolKeyIsAuthenticated() failed! +errorCoolKeyCertNicknames=coolkey.GetCoolKeyCertNicknames() failed! +errorAuthCoolKey=coolkey.AuthenticateCoolKey failed! +errorCoolKeyCertInfo=coolkey.GetCoolKeyCertInfo() failed! +errorGetAvailCoolKeys=coolkey.GetAvailableCoolKeys() failed! +errorEnollCoolKey=coolkey.EnrollCoolKey() failed! +errorCoolKeyIsEnrolled=coolkey.GetCoolKeyIsEnrolled failed! +errorResetCoolKeyPIN=coolkey.ResestCoolKeyPIN() failed! Make sure Smart card is properly Enrolled. +errorFormatCoolKey=coolkey.FormatCoolKey() failed! +errorCancelCoolKey=coolkeyCancelCoolKeyOperation() failed! +errorBlinkCoolKey=coolkey.BlinkCoolKey() failes! +noCurrentlySelectedToken=No currently selected smart card! +errorProvideScreenName=You must provide a valid screen name! +errorProvideTokenPIN=You must provide a valid TokenPIN! +errorMatchPinValues=The PIN values you entered don't match! +errorValidUserPassword=You must provide a valid User Password! +errorSelectKey=Please select a smart card. +errorEnrolledFirst=Smart card must be enrolled first! Enroll card and try again. +enrollmentFor=Enrollment for +wasSuccessful=was successful. +pinResetSuccessful=Password Reset was successfull! +formatOf=Format of +error=Error +serverResponse= \n\n Server Response: +enrollmentOfKey=Enrollment of smart card +formatingOfKey=Formatting of smart card +pinResetOfKey=PIN Reset for smart card +operationForKey=Operation for smart card +failed=failed. +cancelled=cancelled. +errorFindESCPlatform=Unable to determine Smart Card Manager platform. +errorIssuerInfo=Error obtaining Issuer Info for key. +#Strings for TRAY.j +errorTrayIsInitialized=Can't determine if Icon component is already intialized! +errorShowAllWindows=Error Showing All Windows: +errorHideAllWindows=Error Hiding all Windows: +errorShowWindow=Error Showing Window: +errorHideWindow=Error Hiding Window: +errorRemoveWindow=Error Removing Window: +errorTrayNotification=Error Sending Tray notification: +#Strings for GenericAuth.js +value=Value +mustMatch=must match +mustHaveValue=Must have value set for field: +noParentWindow=No parent window. +authDialogNoParent=Auth dialog has no parent! From fedora-directory-commits at redhat.com Wed Sep 13 17:56:52 2006 From: fedora-directory-commits at redhat.com (Jack Magne (jmagne)) Date: Wed, 13 Sep 2006 10:56:52 -0700 Subject: [Fedora-directory-commits] esc/src/app/xul/esc/chrome/content/esc ESC.js, 1.1.1.1, 1.2 GenericAuth.js, 1.1.1.1, 1.2 TRAY.js, 1.1.1.1, 1.2 certinfo.xul, 1.1.1.1, 1.2 config.xul, 1.1.1.1, 1.2 esc.css, 1.1.1.1, 1.2 esc.xul, 1.1.1.1, 1.2 esc_browser.xul, 1.1.1.1, 1.2 settings.xul, 1.1.1.1, 1.2 Message-ID: <200609131756.k8DHuqOp012991@cvs-int.fedora.redhat.com> Author: jmagne Update of /cvs/dirsec/esc/src/app/xul/esc/chrome/content/esc In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv12965 Modified Files: ESC.js GenericAuth.js TRAY.js certinfo.xul config.xul esc.css esc.xul esc_browser.xul settings.xul Log Message: Update to Latest. View full diff with command: /usr/bin/cvs -f diff -kk -u -N -r 1.1.1.1 -r 1.2 ESC.js Index: ESC.js =================================================================== RCS file: /cvs/dirsec/esc/src/app/xul/esc/chrome/content/esc/ESC.js,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- ESC.js 12 Jun 2006 23:39:51 -0000 1.1.1.1 +++ ESC.js 13 Sep 2006 17:56:49 -0000 1.2 @@ -20,21 +20,42 @@ var gStringBundle = null; var netkey; -var gHidden = null; - var keyUITable = new Array(); var keyTypeTable = new Array(); var curChildWindow = null; -var gUsesTree = 0; +var gEnrollmentPage = 0; +var gAdminPage = 0; +var gUsesListBox = 0; +var gFactoryMode = 0; +var gHiddenPage = 0; +var gHiddenPageDone = 0; +var gExternalUI = 0; + +var gDiagnosticsCopyString=null; loadStringBundle(); +//ESC constants + +const KEY_ISSUER_URL = "keyIssuerUrl"; +const KEY_ISSUER = "keyIssuer"; +const TPS_URL = "Operation"; +const TPS_UI = "UI"; +const SERVICES_TAG = "Services"; +const ISSUER_TAG = "IssuerName"; +const SERVICE_INFO_TAG = "ServiceInfo"; + +//Window names + +const ENROLL_WINDOW = "esc.xul"; +const ADMIN_WINDOW = "settings.xul"; +const HIDDEN_WINDOW = "hiddenWindow.xul"; + function getUIForKey(aKeyID) { return keyUITable[aKeyID]; - } function getTypeForKey(aKeyID) @@ -60,7 +81,7 @@ if(!iid.equals(Components.interfaces.rhIKeyNotify) && !iid.equals(Components.interfaces.nsISupports)) { - alert(getBundleString("errorJsNotifyInterface")); + MyAlert(getBundleString("errorJsNotifyInterface")); throw Components.results.NS_ERROR_NO_INTERFACE; } return this; @@ -77,7 +98,7 @@ gNotify = new jsNotify; netkey.rhCoolKeySetNotifyCallback(gNotify); } catch(e) { - alert(getBundleString("errorUniversalXPConnect") + e); + MyAlert(getBundleString("errorUniversalXPConnect") + e); } // @@ -86,13 +107,14 @@ function cleanup() { - TrayRemoveWindow(); + TrayRemoveWindow(null); try { netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect"); netkey.rhCoolKeyUnSetNotifyCallback(gNotify); } catch(e) { - alert(getBundleString("errorUniversalXPConnect") + e); + MyAlert(getBundleString("errorUniversalXPConnect") + e); } + } var gScreenName = ""; @@ -181,7 +203,7 @@ } catch(e) { - alert(getBundleString("errorConfigValue") + e); + MyAlert(getBundleString("errorConfigValue") + e); } if(tps_uri) @@ -193,6 +215,102 @@ } +function DoPhoneHome(keyType,keyID) +{ + var callback = function (aResult) { + + if(aResult == true) + { + UpdateRowWithPhoneHomeData(keyType,keyID); + } + else + { + launchCONFIG(keyType,keyID); + } + } + + if(IsPhoneHomeCached(keyID)) + { + return true; + } + + var home = DoCoolKeyGetIssuerUrl(keyType,keyID); + + var homeRes = false; + + if(home) + { + homeRes = phoneHome(home,keyID,callback); + } + + if(!homeRes) + { + launchCONFIG(keyType,keyID); + } + + return homeRes; +} +//Test Phone Home url in config UI + +function DoPhoneHomeTest() +{ + // Test out user supplied phone home url + + var name = this.name; + + var callback = function (aResult) { + + if(aResult == true) + { + MyAlert(getBundleString("tpsConfigSuccess")); + } + else + { + MyAlert(getBundleString("tpsConfigError")); + } + } + + var url = document.getElementById("phonehomeuri"); + + if(!url) + { + MyAlert(getBundleString("noTpsConfigUrl")); + return; + + } + + if(!url.value) + { + MyAlert(getBundleString("noTpsConfigUrl")); + return; + } + + MyAlert(getBundleString("tpsConfigTest") + " " + url.value); + + if(name) + { + phoneHome(url.value,name,callback); + } + else + { + MyAlert(getBundleString("tpsConfigError")); + } + +} + +function DoPhoneHomeConfigClose() +{ + + var name = this.name; + + if(window.opener && name) + { + window.opener.UpdateRowWithPhoneHomeData(1,name); + } + + window.close(); +} + //Test the tps uri connection [...3381 lines suppressed...] + return false; + } + var root = response.getElementsByTagName("ServiceInfo"); + + if(!root) + { + if(resultCB) + resultCB(false); + return false; + } + + var issuer = response.getElementsByTagName("IssuerName").item(0); + + if(!issuer) + { + if(resultCB) + resultCB(false); + return false; + } + + var theIssuer = issuer.lastChild.data; + + if(theIssuer) + { + var issuer_config_value = ConfigValueWithKeyID(aKeyID,KEY_ISSUER); + if(issuer_config_value) + { + DoCoolKeySetConfigValue(issuer_config_value,theIssuer); + + } + } + + var services = response.getElementsByTagName("Services"); + + if(!services) + { + if(resultCB) + resultCB(false); + return false; + } + + var servicesNodes = services[0].childNodes; + var len = servicesNodes.length; + + for (var i = 0; i < len; i++) + { + var oChild = servicesNodes.item(i); + var name = oChild.nodeName; + var value = oChild.firstChild.data; + + if(name && value) + { + var cValue = ConfigValueWithKeyID(aKeyID,name); + + if(cValue) + { + DoCoolKeySetConfigValue(cValue,value); + } + } + + } + + if(resultCB) + { + //Manually write out entry for phone home url + + var issuer_config_value = ConfigValueWithKeyID(aKeyID,KEY_ISSUER_URL); + var result = DoCoolKeySetConfigValue(issuer_config_value,url); + resultCB(true); + } + return; } + } - } + req.onreadystatechange = callback; + req.send(null); + + return true; +} + +function ReadESCLog() +{ + + const logFileName = "esc.log"; + + // Get executable directory + + var file = Components.classes["@mozilla.org/file/directory_service;1"] + .getService(Components.interfaces.nsIProperties) + .get("ProfD", Components.interfaces.nsIFile); + + file = file.parent; + file.append(logFileName); + var istream = Components.classes["@mozilla.org/network/file-input-stream;1"] + .createInstance(Components.interfaces.nsIFileInputStream); + + try { + istream.init(file, 0x01, 0444, 0); + istream.QueryInterface(Components.interfaces.nsILineInputStream); + + } catch (e){ + + return null; + } + + // read lines into array + var line = {}, lines = [], hasmore; + do { + hasmore = istream.readLine(line); + + var value = line.value; + + var colonIndex = value.indexOf(":"); + + value = value.substring(colonIndex + 1); + + lines.push(value); + } while(hasmore); + + istream.close(); + + return lines; + +} + +// Get the url form of the balloon tooltip icon +// Only useful on Linux + +function GetESCNotifyIconPath(keyType,keyID) +{ + var path = null; + var def_image = "/components/icon.png"; + + var chrome_path = "/chrome/content/esc/"; + var image = null; + + var status; + + try { + status = GetCoolKeyStatus(keyType, keyID); + } catch(e) { + status = 0; + } + + if(status == 1) // no applet + { + image = chrome_path + "blank-card.png"; + } + if(status == 2) // uninitialized + { + image = chrome_path + "initializecard.png"; + } + if(status == 4) // enrolled + { + image = chrome_path + "enrolled-key.png"; + } + + if(!image) + image = def_image; + + var file = Components.classes["@mozilla.org/file/directory_service;1"] + .getService(Components.interfaces.nsIProperties) + .get("CurProcD", Components.interfaces.nsIFile); + + if(file) + file = file.parent; + + if(file.path) + path = "file://" + file.path + image; + + return path; +} + +// New Alert Functions based on nsIPromptService + +function MyAlert(message) +{ + if(message) + DoMyAlert(message,getBundleString("escTitle")); +} + +function DoMyAlert(message,title) +{ + + if(!message || !title) + return; try { + netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect"); + var prompts = Components.classes["@mozilla.org/embedcomp/prompt-service;1"].getService(Components.interfaces.nsIPromptService); + + prompts.alert(window,title,message); + + } catch(e) { + + + alert("Problem with nsIPromptService " + e); + } } Index: GenericAuth.js =================================================================== RCS file: /cvs/dirsec/esc/src/app/xul/esc/chrome/content/esc/GenericAuth.js,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- GenericAuth.js 12 Jun 2006 23:39:51 -0000 1.1.1.1 +++ GenericAuth.js 13 Sep 2006 17:56:49 -0000 1.2 @@ -430,6 +430,18 @@ return text_node; } +function AddSpacer() +{ + var tSpacer = document.createElement("spacer"); + + if(!tSpacer) + return null; + + + return tSpacer; + +} + function AddButton(id,label) { @@ -586,9 +598,15 @@ if(last_row) { + AddSpacerToNode(last_row,"1","min-height: 20px"); + AddSpacerToNode(last_row,"1","min-height: 20px"); var button = AddButton("","Submit"); - button.setAttribute("oncommand" , "FormSubmit();"); - last_row.appendChild(button); + if(button) + button.setAttribute("oncommand" , "FormSubmit();"); + + + if(button) + last_row.appendChild(button); } } Index: TRAY.js =================================================================== RCS file: /cvs/dirsec/esc/src/app/xul/esc/chrome/content/esc/TRAY.js,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- TRAY.js 12 Jun 2006 23:39:51 -0000 1.1.1.1 +++ TRAY.js 13 Sep 2006 17:56:49 -0000 1.2 @@ -23,9 +23,40 @@ var gBaseWindow = 0; +var gWindNotify = null; + loadStringBundle(); +// +// Tray event Notify callback +// +function jsWindNotify() {} + +jsWindNotify.prototype = { + + rhTrayWindEventNotify: function(aEvent,aEventData,aKeyData,aData1,aData2) + { + //alert("rhTrayWindEventNotify!!!! event " + aEvent); + + NotifyESCOfTrayEvent(aEvent,aEventData,aKeyData,aData1,aData2); + }, + + QueryInterface: function(iid) + { + //alert("iid: " + iid); + if(!iid.equals(Components.interfaces.rhITrayWindNotify) && + !iid.equals(Components.interfaces.nsISupports)) + { + MyAlert(getBundleString("errorJsNotifyInterface")); + throw Components.results.NS_ERROR_NO_INTERFACE; + } + return this; + } +}; + + + //Initialize tray XPCOM object // GECKO ONLY initialization @@ -39,10 +70,20 @@ gBaseWindow = getBaseWindow(); + if(gTray) + { + gWindNotify = new jsWindNotify; + if(gWindNotify) + gTray.setwindnotifycallback(gWindNotify); + + //alert("setting tray notify callback " + gWindNotify); + } + } catch(e) { -} + MyAlert("e " + e); +} TrayAddWindow(); @@ -92,7 +133,7 @@ } catch (ex) { - alert(getBundleString("errorTrayIsInitialized")); + MyAlert(getBundleString("errorTrayIsInitialized")); rv = null; /* ignore no-interface exception */ } @@ -115,7 +156,7 @@ gTray.showall(); } catch(e) { - alert(getBundleString("errorShowAllWindows") + e); + MyAlert(getBundleString("errorShowAllWindows") + e); return; } @@ -135,7 +176,7 @@ gTray.hideall(); } catch(e) { - alert(getStringBundle("errorHideAllWindows") + e); + MyAlert(getStringBundle("errorHideAllWindows") + e); return; } @@ -156,7 +197,7 @@ gTray.show(gBaseWindow); } catch(e) { - alert(getBundleString("errorShowWindow")); + MyAlert(getBundleString("errorShowWindow")); return; } @@ -176,30 +217,50 @@ gTray.hide(gBaseWindow); } catch(e) { - alert(getBundleString("errorHideWindow")); + MyAlert(getBundleString("errorHideWindow")); return; } } -function TrayRemoveWindow() +function TrayRemoveWindowNotify() { - if(gTray && gBaseWindow) + if(gTray && gBaseWindow && gWindNotify) { - try { + netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect"); + + gTray.unsetwindnotifycallback(gWindNotify); + + + } catch(e) { + return; + } + + + } +} + +function TrayRemoveWindow(doPreserveNotifyCallback) +{ + if(gTray && gBaseWindow) + { + try { + netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect"); gTray.remove(gBaseWindow); } catch(e) { - alert(getBundleString("errorRemoveWindow") + e); + MyAlert(getBundleString("errorRemoveWindow") + e); return; } + if(gWindNotify && !doPreserveNotifyCallback) + gTray.unsetwindnotifycallback(gWindNotify); } } @@ -226,38 +287,88 @@ } +} +function TraySendNotificationMessage(aTitle,aMessage,aSeverity,aTimeout,aIcon) +{ + if(!gHiddenPage) + return; + + if(gTray && gBaseWindow) + { + try { -} + netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect") -function TraySendNotificationMessage(aMessage) -{ + gTray.sendnotification(aTitle,aMessage,aSeverity,aTimeout,aIcon); - if(gTray && gBaseWindow) + } catch(e) { + alert(getBundleString("errorTrayNotification") + e); + return; + } + + } + +} + + +function TrayHideNotificationIcon() { + if(!gHiddenPage) + return; - try { + if(gTray && gBaseWindow) + { - netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect") + try { + netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect") - gTray.sendnotification(aMessage); + gTray.hideicon(); } catch(e) { - alert(getBundleString("errorTrayNotification") + e); return; } + } } +function TrayLoadedOK() +{ + var result = 0; + if(gTray) + result = 1; + return result; +} + +function TrayShowNotificationIcon() +{ + if(!gHiddenPage) + return; + + if(gTray && gBaseWindow) + { + + try { + + netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect") + gTray.settooltipmsg(getBundleString("escTitle")); + gTray.showicon(); + + } catch(e) { + return; + } + + } } + //String bundling related functions function loadStringBundle() @@ -267,7 +378,6 @@ function getBundleString(string_id) { - var str = null; if(!string_id || !gStringBundle) @@ -276,6 +386,5 @@ str = gStringBundle.getString(string_id); return str; - } Index: certinfo.xul =================================================================== RCS file: /cvs/dirsec/esc/src/app/xul/esc/chrome/content/esc/certinfo.xul,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- certinfo.xul 12 Jun 2006 23:39:51 -0000 1.1.1.1 +++ certinfo.xul 13 Sep 2006 17:56:49 -0000 1.2 @@ -20,7 +20,7 @@