Changeset 8f20eb


Ignore:
Timestamp:
Sep 29, 2007, 7:23:57 PM (14 years ago)
Author:
rene <rene@…>
Branches:
master
Children:
11aa72
Parents:
c34db9
Message:

show description in smtp-Menu, if there, else show only hostname

File:
1 edited

Legend:

Unmodified
Added
Removed
  • chrome/content/v_identity/vI_smtpSelector.js

    rc34db9 r8f20eb  
    2020    the Initial Developer. All Rights Reserved.
    2121
    22     Contributor(s): chuonthis
     22    Contributor(s):
    2323 * ***** END LICENSE BLOCK ***** */
    24 
    25 /**
    26 * some code copied and adapted from 'Show SMTP Username'
    27 * thanks to chuonthis
    28 */
    2924
    3025vI_smtpSelector = {
     
    121116            }
    122117        }
    123         vI_smtpSelector.elements.Obj_SMTPServerList.setAttribute("label", vI_smtpSelector.getNewHostnamex(idserver));
     118        vI_smtpSelector.elements.Obj_SMTPServerList.setAttribute("label", (server.description?server.description:server.hostname));
    124119    },
    125120
     
    127122        var listitem = document.createElement("menuitem");
    128123
    129         var hostname = vI_smtpSelector.getNewHostnamex(server);
    130        
    131         listitem.setAttribute("label", hostname);
     124        listitem.setAttribute("label", (server.description?server.description:server.hostname));
    132125        listitem.setAttribute("key", server.key);
    133126        // give it some unique id
     
    135128
    136129        return listitem;
    137     },
    138    
    139     getNewHostnamex : function (server)
    140     {
    141         var showAlias = true;
    142         var showUsername = true;
    143         var hideUsername = true;
    144 
    145        
    146         // reuse Preferences from ssun
    147         try { showAlias = vI.preferences.getBoolPref("ssun.showalias"); } catch (ex) {}
    148         try { showUsername = vI.preferences.getBoolPref("ssun.showusername"); } catch (ex) {}
    149         try { hideUsername = vI.preferences.getBoolPref("ssun.hideusername"); } catch (ex) {}
    150 
    151         var hostname = server.hostname;
    152         var port = "";
    153 
    154         if (server.port)
    155           port = ":" + server.port;
    156 
    157         // SSUN: Get server alias
    158         var alias = "";
    159         if (showAlias) {
    160         try { alias = vI.preferences.getCharPref("ssun." + server.key + ".alias"); } catch (ex) {}
    161         if (alias) {
    162             hostname = alias;
    163         } else {
    164             hostname += port;
    165         }
    166         } else {
    167         hostname += port;
    168         }
    169 
    170         // SSUN: Add username
    171         if (showUsername && (!showAlias || (showAlias && (!alias || !hideUsername))) && server.authMethod && server.username)
    172           hostname += " (" + server.username + ")";
    173 
    174         return hostname
    175130    }
    176131}
Note: See TracChangeset for help on using the changeset viewer.