Developer Area

Changeset 646

Show
Ignore:
Timestamp:
01/14/10 16:20:25 (2 months ago)
Author:
jonmaycock
Message:

Bug Fixes

Location:
apps/outlook/branches/1.6
Files:
11 modified

Legend:

Unmodified
Added
Removed
  • apps/outlook/branches/1.6/DotTel/dottel.pref

    r338 r646  
    44# Commenting these values out results in the system settings being used 
    55 
    6 #dns=208.67.222.222 
    76dnsport=53 
    87timeout=3000 
  • apps/outlook/branches/1.6/DotTel/inspector-results.xslt

    r338 r646  
    1212      <body> 
    1313        <div id="results_title"> 
    14           <div id="results_dottel_name"> 
    15             <xsl:value-of select="TelnicLookupResults/Domain"/> 
    16           </div> 
    17         </div> 
     14                        <div id="results_dottel_name"> 
     15                        <xsl:choose> 
     16                                <xsl:when test="/TelnicLookupResults/ddsValue"> 
     17                                        <xsl:value-of select="TelnicLookupResults/ddsValue"/> 
     18                                </xsl:when> 
     19                                <xsl:otherwise> 
     20                                        <xsl:value-of select="TelnicLookupResults/Domain"/> 
     21                                </xsl:otherwise> 
     22                        </xsl:choose> 
     23                        </div> 
     24                </div> 
     25 
    1826 
    1927        <div id="results"> 
    2028 
    2129          <div id="results_container"> 
    22              
     30 
    2331            <xsl:if test="/TelnicLookupResults/Crumbs"> 
    2432              <div class="breadcrumbs"> 
     
    7886                  </div> 
    7987                </xsl:if> 
    80                  
     88 
    8189                <xsl:if test="/TelnicLookupResults/Message"> 
    8290                  <div class="message"> 
     
    8694              </xsl:otherwise> 
    8795            </xsl:choose> 
    88              
     96 
    8997            <xsl:for-each select="TelnicLookupResults/TxtResults/TxtRecord"> 
    9098              <div class="textrecord txtrecord"> 
     
    132140                  </xsl:if> 
    133141                </span> 
     142                <div class="longLabelslist"> 
     143                  <xsl:for-each select="LongLabels/LongLabel"> 
     144                    <span class="longLabel"> 
     145                      <xsl:value-of select="LongLabelName" disable-output-escaping="yes"/> 
     146                    </span> 
     147                  </xsl:for-each> 
     148                </div> 
     149 
     150 
     151 
    134152                <xsl:choose> 
    135153                  <xsl:when test="Launchable = 'true'"> 
     
    147165                </xsl:choose> 
    148166              </div> 
    149             </xsl:for-each> 
     167                  </xsl:for-each> 
    150168 
    151169            <xsl:for-each select="TelnicLookupResults/NaptrResults/NonTerminalNaptrRecord"> 
     
    155173                </div> 
    156174                <span class="serviceDescription"> 
    157                   Go to: 
     175                  <xsl:choose> 
     176                    <xsl:when test="LongLabels"> 
     177                      <xsl:for-each select="LongLabels/LongLabel"> 
     178                        <xsl:value-of select="LongLabelName" disable-output-escaping="yes"/> 
     179                      </xsl:for-each> 
     180 
     181                    </xsl:when> 
     182                    <xsl:otherwise> 
     183                      Go to: 
     184                    </xsl:otherwise> 
     185                  </xsl:choose> 
    158186                </span> 
    159187                <div class="service_container"> 
     
    163191                </div> 
    164192              </div> 
     193 
    165194            </xsl:for-each> 
    166195 
    167             <xsl:for-each select="TelnicLookupResults/LocResults/LocRecord"> 
    168               <div class="locrecord"> 
    169                 <div class="service_icon"> 
    170                   <img src="{/TelnicLookupResults/Path}/images/icon-location.gif" /> 
    171                 </div> 
    172                 <span class="serviceDescription"> 
    173                   Location: 
    174                 </span> 
    175                 <div class="service_container"> 
    176                   <a href="" onclick="window.external.launchLocation('{LocationWithEscapedQuotes}')"> 
    177                     <xsl:value-of select="Latitude"/> 
    178                     , 
    179                     <xsl:value-of select="Longitude"/> 
    180                   </a> 
    181                 </div> 
    182               </div> 
    183             </xsl:for-each> 
    184  
    185             <xsl:if test="TelnicLookupResults/TxtResults/EnhancedTxtRecord"> 
     196                <xsl:for-each select="TelnicLookupResults/LocResults/LocRecord"> 
     197                  <div class="locrecord"> 
     198                    <div class="service_icon"> 
     199                      <img src="{/TelnicLookupResults/Path}/images/icon-location.gif" /> 
     200                    </div> 
     201                    <span class="serviceDescription"> 
     202                      Location: 
     203                    </span> 
     204                    <div class="service_container"> 
     205                      <a href="" onclick="window.external.launchLocation('{LocationWithEscapedQuotes}')"> 
     206                        <xsl:value-of select="Latitude"/> 
     207                        , 
     208                        <xsl:value-of select="Longitude"/> 
     209                      </a> 
     210                    </div> 
     211                  </div> 
     212                </xsl:for-each> 
     213 
     214            <xsl:if test="TelnicLookupResults/KeywordResults/EnhancedTxtRecord"> 
    186215              <div class="keywords"> 
    187216                <div class="service_icon"> 
     
    192221                </span> 
    193222                <div class="service_container"> 
    194                   <xsl:for-each select="TelnicLookupResults/TxtResults/EnhancedTxtRecord"> 
     223                  <xsl:for-each select="TelnicLookupResults/KeywordResults/EnhancedTxtRecord"> 
     224                    <xsl:if test="Type='FreeText'"> 
     225                      <div class="keywordline"> 
     226                        <span class="keyword"> 
     227                          <xsl:value-of select="PrimaryPair/Value" disable-output-escaping="yes"/> 
     228                        </span> 
     229                      </div> 
     230                    </xsl:if> 
     231                  </xsl:for-each> 
     232                  <xsl:for-each select="TelnicLookupResults/KeywordResults/EnhancedTxtRecord"> 
    195233                    <xsl:choose> 
    196                       <xsl:when test="Count='1'"> 
     234                      <xsl:when test="Type='Structured'"> 
    197235                        <div class="keywordline"> 
    198236                          <span class="primarykeyword"> 
    199237                            <xsl:choose> 
    200238                              <xsl:when test="PrimaryPair/Value"> 
    201                                 <xsl:value-of select="PrimaryPair/Value"/> 
     239                                <xsl:value-of select="PrimaryPair/Key-name"/> 
     240                                <xsl:text> - </xsl:text> 
     241                                <xsl:value-of select="PrimaryPair/Value" disable-output-escaping="yes"/> 
     242                                <xsl:text>: </xsl:text> 
    202243                              </xsl:when> 
    203244                              <xsl:otherwise> 
     
    206247                            </xsl:choose> 
    207248                          </span> 
     249                          <xsl:for-each select="Pair"> 
     250                            <span class="keyword"> 
     251                              <div> 
     252                                <xsl:value-of select="Value"/> 
     253                              </div> 
     254                            </span> 
     255                          </xsl:for-each> 
    208256                        </div> 
    209257                      </xsl:when> 
    210258                      <xsl:otherwise> 
    211                         <div class="keywordline"> 
    212                           <span class="primarykeyword"> 
     259                        <xsl:for-each select="Pair"> 
     260                          <div class="keywordline"> 
    213261                            <xsl:choose> 
    214                               <xsl:when test="PrimaryPair/Value"> 
    215                                 <xsl:value-of select="PrimaryPair/Value"/> 
     262                              <xsl:when test="Value"> 
     263                                <span class="primarykeyword"> 
     264                                  <xsl:value-of select="Key-name"/> 
     265                                  <xsl:text>: </xsl:text> 
     266                                </span> 
     267                                <span class="keyword"> 
     268                                  <xsl:value-of select="Value" disable-output-escaping="yes"/> 
     269                                </span> 
    216270                              </xsl:when> 
    217271                              <xsl:otherwise> 
    218                                 <xsl:value-of select="PrimaryPair/Key-name"/> 
     272                                <span class="primarykeyword"> 
     273                                  <xsl:value-of select="Key-name"/> 
     274                                </span> 
    219275                              </xsl:otherwise> 
    220276                            </xsl:choose> 
    221                             : 
    222                           </span> 
    223                           <xsl:for-each select="Pair"> 
    224                             <span class="keyword"> 
    225                               <xsl:value-of select="Value"/> 
    226                             </span> 
    227                           </xsl:for-each> 
    228                         </div> 
     277                          </div> 
     278                        </xsl:for-each> 
    229279                      </xsl:otherwise> 
    230280                    </xsl:choose> 
     281 
     282 
    231283                  </xsl:for-each> 
    232284                </div> 
     
    235287 
    236288          </div> 
    237          
    238       <xsl:if test="/TelnicLookupResults/PreviousDomain"> 
    239           <div class="contact"> 
    240             <div class="service_icon"> 
    241               <img src="{/TelnicLookupResults/Path}/images/icon-back.gif"/> 
     289 
     290 
     291          <xsl:if test="/TelnicLookupResults/PreviousDomain"> 
     292              <div class="contact"> 
     293                <div class="service_icon"> 
     294                  <img src="{/TelnicLookupResults/Path}/images/icon-back.gif"/> 
     295                </div> 
     296                <div class="service_container"> 
     297                  <a href="" onclick="window.external.goBack()">Go Back</a> 
     298                </div> 
     299              </div> 
     300            </xsl:if> 
     301 
     302            <div class="buttons"> 
     303              <xsl:if test="TelnicLookupResults/NaptrResults/TerminalNaptrRecord"> 
     304                <button onclick="window.external.displayImportScreen();">Save Results</button> 
     305              </xsl:if> 
     306              <button onclick="window.external.closeWindow();">Close</button> 
    242307            </div> 
    243             <div class="service_container"> 
    244               <a href="" onclick="window.external.goBack()">Go Back</a> 
    245             </div> 
     308 
    246309          </div> 
    247       </xsl:if> 
    248        
    249         <div class="buttons"> 
    250           <xsl:if test="TelnicLookupResults/NaptrResults/TerminalNaptrRecord"> 
    251             <button onclick="window.external.displayImportScreen();">Save Results</button> 
    252           </xsl:if> 
    253           <button onclick="window.external.closeWindow();">Close</button> 
    254         </div> 
    255      
    256     </div> 
    257310    <div id="footerwok"></div> 
    258311     
  • apps/outlook/branches/1.6/DotTel/MSOutlook/Toolbars/ContactToolbar/InspectorToolbar.cs

    r493 r646  
    285285 
    286286            this.SetFriendingComponents(); 
    287  
     287            Logger.Log(Logger.Section.Contact_Toolbar, "Before AutoLookupThread"); 
    288288            // perform a lookup 
    289289            Thread t = new Thread(delegate() 
    290290            { 
     291                Logger.Log(Logger.Section.Contact_Toolbar, "Start of AutoLookupThread"); 
    291292                this.AutoLookup(); 
     293                Logger.Log(Logger.Section.Contact_Toolbar, "End of AutoLookupThread"); 
    292294            }); 
    293295            t.Name = "AutoLookup Thread"; 
    294296            t.Start(); 
     297            Logger.Log(Logger.Section.Contact_Toolbar, "After Launching AutoLookup Thread"); 
    295298 
    296299            Publishers.Instance.publishersListUpdated += new Publishers.PublishersListUpdatedHandler(publishersListUpdated); 
     
    447450                            && (editButton.Caption == DotTel.Properties.Resources.InspectorToolbar_EditButtonCaption)) 
    448451                { 
    449                     if (Publishers.Instance.PublisherList.ContainsKey(telname)) 
     452                    //if (Publishers.Instance.PublisherList.ContainsKey(telname)) 
     453                    if (Publishers.Instance.GetPrivateTelname(telname) != telname) 
    450454                    { 
    451455                        // enable the friend button only if this domain is in the publishers list 
     
    639643                LookupTelname lt = new LookupTelname(IPAddress.Parse(Preferences.GetPreference("dns")), int.Parse(Preferences.GetPreference("dnsport"))); 
    640644                lt.Listener = this; 
    641                 string privateTelname = telname; 
    642                 // if this telname is in the publishers list then use the subdomain 
    643                 if (Publishers.Instance.PublisherList != null && Publishers.Instance.PublisherList.ContainsKey(telname)) 
    644                 { 
    645                     privateTelname = Publishers.Instance.PublisherList[telname]; 
    646                     if (!privateTelname.EndsWith(".tel")) 
    647                     { 
    648                         privateTelname += "." + telname; 
    649                     } 
    650                 } 
    651  
     645                string privateTelname = Publishers.Instance.GetPrivateTelname(telname); 
    652646                if (inspectorGoButton == null) 
    653647                    return; 
     
    802796            catch(Exception e) 
    803797            { 
    804                 Logger.Log(Logger.Section.Contact_Toolbar, "saveTelname exception: " + e.StackTrace); 
     798                Logger.Log(Logger.Section.Contact_Toolbar, "saveTelname exception: " + this.GetTelname() + " -  "+ e.StackTrace); 
    805799                MessageBox.Show(DotTel.Properties.Resources.InspectorToolbar_InvalidDotTelDomain,  
    806800                                DotTel.Properties.Resources.DottelError, MessageBoxButtons.OK, MessageBoxIcon.Error); 
  • apps/outlook/branches/1.6/DotTel/results.xslt

    r338 r646  
    1212    <body> 
    1313      <div id="results_title"> 
    14           <div id="results_dottel_name"> 
     14        <div id="results_dottel_name"> 
     15          <xsl:choose> 
     16            <xsl:when test="/TelnicLookupResults/ddsValue"> 
     17              <xsl:value-of select="TelnicLookupResults/ddsValue" /> 
     18            </xsl:when> 
     19            <xsl:otherwise> 
    1520              <xsl:value-of select="TelnicLookupResults/Domain"/> 
    16           </div> 
    17       </div> 
    18  
    19       <div id="results"> 
     21            </xsl:otherwise> 
     22         </xsl:choose> 
     23       </div> 
     24     </div> 
     25 
     26     <div id="results"> 
    2027 
    2128        <div id="results_container"> 
     
    106113                </xsl:if> 
    107114              </div> 
    108               <span class="serviceDescription"> 
    109                 <xsl:if test="LocationIndicatorHints/ConcatenatedCategories=' '"> 
    110                   <xsl:value-of select="ServiceName"/> 
     115              <div class="inner"> 
     116                <span class="serviceDescription"> 
     117                  <xsl:if test="LocationIndicatorHints/ConcatenatedCategories=' '"> 
     118                    <xsl:value-of select="ServiceName"/> 
     119                  </xsl:if> 
     120                  <xsl:if test="LocationIndicatorHints/ConcatenatedCategories != ' '"> 
     121                    <xsl:value-of select="LocationIndicatorHints/ConcatenatedCategories"/> 
     122                    <xsl:text> </xsl:text> 
     123                    <xsl:value-of select="ServiceName"/> 
     124                  </xsl:if> 
     125                  <span class="xlabelslist"> 
     126                    <xsl:if test="XLabels/Count&gt;0"> 
     127                      <xsl:text>(</xsl:text> 
     128                    </xsl:if> 
     129                    <xsl:for-each select="XLabels/XLabel"> 
     130                      <span class="xlabel"> 
     131                        <xsl:value-of select="XLabelName" disable-output-escaping="yes"/> 
     132                      </span> 
     133                    </xsl:for-each> 
     134                    <xsl:if test="XLabels/Count&gt;0"> 
     135                      <xsl:text>)</xsl:text> 
     136                    </xsl:if> 
     137                  </span> 
     138                </span> 
     139 
     140                 
     141 
     142                <xsl:if test="LongLabels"> 
     143                  <div class="longLabelslist"> 
     144                    <xsl:for-each select="LongLabels/LongLabel"> 
     145                      <span class="longLabel"> 
     146                        <xsl:value-of select="LongLabelName" disable-output-escaping="yes"/> 
     147                      </span> 
     148                    </xsl:for-each> 
     149                  </div> 
    111150                </xsl:if> 
    112                 <xsl:if test="LocationIndicatorHints/ConcatenatedCategories != ' '"> 
    113                   <xsl:value-of select="LocationIndicatorHints/ConcatenatedCategories"/> 
    114                   <xsl:text> </xsl:text> 
    115                   <xsl:value-of select="ServiceName"/> 
    116                 </xsl:if> 
    117               </span> 
    118               <span class="xlabelslist"> 
    119                 <xsl:if test="XLabels/Count&gt;0"> 
    120                   <xsl:text>(</xsl:text> 
    121                 </xsl:if> 
    122                 <xsl:for-each select="XLabels/XLabel"> 
    123                   <span class="xlabel"> 
    124                     <xsl:value-of select="XLabelName"/> 
    125                   </span> 
    126                 </xsl:for-each> 
    127                 <xsl:if test="XLabels/Count&gt;0"> 
    128                   <xsl:text>)</xsl:text> 
    129                 </xsl:if> 
    130               </span> 
    131               <xsl:choose> 
    132                 <xsl:when test="Launchable = 'true'"> 
    133                   <div class="service_container"> 
    134                     <a href="" onclick="window.external.launch('{ServiceType}', '{Uri}')"> 
     151 
     152 
     153 
     154                <xsl:choose> 
     155                  <xsl:when test="Launchable = 'true'"> 
     156                    <div class="service_container"> 
     157                      <a href="" onclick="window.external.launch('{ServiceType}', '{Uri}')"> 
     158                        <xsl:value-of select="Name"/> 
     159                      </a> 
     160                    </div> 
     161                  </xsl:when> 
     162                  <xsl:otherwise> 
     163                    <div class="service_container"> 
    135164                      <xsl:value-of select="Name"/> 
    136                     </a> 
    137                   </div> 
    138                 </xsl:when> 
    139                 <xsl:otherwise> 
    140                   <div class="service_container"> 
    141                     <xsl:value-of select="Name"/> 
    142                   </div> 
    143                 </xsl:otherwise> 
    144               </xsl:choose> 
     165                    </div> 
     166                  </xsl:otherwise> 
     167                </xsl:choose> 
     168 
     169 
     170 
     171              </div> 
    145172            </div> 
    146173          </xsl:for-each> 
     
    152179              </div> 
    153180              <span class="serviceDescription"> 
    154                 Go to: 
     181                <xsl:choose> 
     182                  <xsl:when test="LongLabels"> 
     183                    <xsl:for-each select="LongLabels/LongLabel"> 
     184                        <xsl:value-of select="LongLabelName" disable-output-escaping="yes"/> 
     185                    </xsl:for-each> 
     186                     
     187                  </xsl:when> 
     188                  <xsl:otherwise> 
     189                    Go to: 
     190                  </xsl:otherwise> 
     191                </xsl:choose> 
    155192              </span> 
    156193              <div class="service_container"> 
     
    160197              </div> 
    161198            </div> 
     199            
    162200          </xsl:for-each> 
    163201 
     
    180218          </xsl:for-each> 
    181219           
    182           <xsl:if test="TelnicLookupResults/TxtResults/EnhancedTxtRecord"> 
     220          <xsl:if test="TelnicLookupResults/KeywordResults/EnhancedTxtRecord"> 
    183221            <div class="keywords"> 
    184222              <div class="service_icon"> 
     
    189227              </span> 
    190228              <div class="service_container"> 
    191                 <xsl:for-each select="TelnicLookupResults/TxtResults/EnhancedTxtRecord"> 
    192                   <xsl:choose> 
    193                     <xsl:when test="Count='1'"> 
     229                <xsl:for-each select="TelnicLookupResults/KeywordResults/EnhancedTxtRecord"> 
     230                    <xsl:if test="Type='FreeText'"> 
    194231                      <div class="keywordline"> 
     232                      <span class="keyword"> 
     233                        <xsl:value-of select="PrimaryPair/Value" disable-output-escaping="yes"/> 
     234                      </span> 
     235                      </div> 
     236                    </xsl:if> 
     237                </xsl:for-each> 
     238                <xsl:for-each select="TelnicLookupResults/KeywordResults/EnhancedTxtRecord"> 
     239                    <xsl:choose> 
     240                      <xsl:when test="Type='Structured'"> 
     241                        <div class="keywordline"> 
    195242                        <span class="primarykeyword"> 
    196243                          <xsl:choose> 
    197244                            <xsl:when test="PrimaryPair/Value"> 
    198                               <xsl:value-of select="PrimaryPair/Value"/> 
     245                              <xsl:value-of select="PrimaryPair/Key-name"/> 
     246                              <xsl:text> - </xsl:text> 
     247                              <xsl:value-of select="PrimaryPair/Value" disable-output-escaping="yes"/> 
     248                              <xsl:text>: </xsl:text> 
    199249                            </xsl:when> 
    200250                            <xsl:otherwise> 
     
    203253                          </xsl:choose> 
    204254                        </span> 
    205                       </div> 
    206                     </xsl:when> 
    207                     <xsl:otherwise> 
    208                       <div class="keywordline"> 
    209                         <span class="primarykeyword"> 
     255                        <xsl:for-each select="Pair"> 
     256                          <span class="keyword"> 
     257                            <div> 
     258                              <xsl:value-of select="Value"/> 
     259                            </div> 
     260                          </span> 
     261                        </xsl:for-each> 
     262                        </div> 
     263                      </xsl:when> 
     264                      <xsl:otherwise> 
     265                        <xsl:for-each select="Pair"> 
     266                          <div class="keywordline"> 
    210267                          <xsl:choose> 
    211                             <xsl:when test="PrimaryPair/Value"> 
    212                               <xsl:value-of select="PrimaryPair/Value"/> 
     268                            <xsl:when test="Value"> 
     269                              <span class="primarykeyword"> 
     270                                <xsl:value-of select="Key-name"/> 
     271                                <xsl:text>: </xsl:text> 
     272                              </span> 
     273                              <span class="keyword"> 
     274                                <xsl:value-of select="Value" disable-output-escaping="yes"/> 
     275                              </span> 
    213276                            </xsl:when> 
    214277                            <xsl:otherwise> 
    215                               <xsl:value-of select="PrimaryPair/Key-name"/> 
     278                              <span class="primarykeyword"> 
     279                                <xsl:value-of select="Key-name"/> 
     280                              </span> 
    216281                            </xsl:otherwise> 
    217282                          </xsl:choose> 
    218                           : 
    219                         </span> 
    220                         <xsl:for-each select="Pair"> 
    221                           <span class="keyword"> 
    222                             <xsl:value-of select="Value"/> 
    223                           </span> 
     283                            </div> 
    224284                        </xsl:for-each> 
    225                       </div> 
    226                     </xsl:otherwise> 
    227                   </xsl:choose> 
     285                      </xsl:otherwise> 
     286                    </xsl:choose> 
     287 
     288 
    228289                </xsl:for-each> 
    229290              </div> 
  • apps/outlook/branches/1.6/DotTel/style.css

    r338 r646  
    1919.keyword 
    2020{ 
    21         padding-right: 10px; 
    22         vertical-align: middle; 
     21        /*padding-right: 10px;*/ 
     22        vertical-align: middle; 
     23        font-weight: normal; 
    2324} 
    2425button 
     
    4142        font-weight:bold; 
    4243        vertical-align: middle; 
    43  
     44        display:block; 
     45        margin-left: 48px; 
    4446} 
    4547 
     
    6264        margin-left: 3px; 
    6365        font-size:0.875em; 
     66} 
     67 
     68div.longlabelslist 
     69{ 
     70        width: 360px; 
     71        /*padding-left: 10px;*/ 
     72        color: Gray; 
     73        vertical-align: middle; 
     74        display:inline-block; 
     75        margin-left:56px; 
     76} 
     77 
     78div.inner 
     79{ 
     80        display:block; 
     81} 
     82 
     83span.longlabel 
     84{ 
     85        color: Gray; 
     86        /*float: right;*/ 
     87        margin: 0; 
     88        /*display:block;*/ 
     89        font-size:0.875em; 
     90        word-wrap: break-word; 
    6491} 
    6592 
     
    195222        height: 45px; 
    196223        vertical-align: top; 
    197         overflow:hidden; 
     224        overflow:auto; 
    198225} 
    199226 
     
    225252{ 
    226253        vertical-align: middle; 
     254        margin-bottom:10px; 
    227255} 
    228256 
     
    250278        /*css3 property to ensure the text is wrapped*/ 
    251279        word-wrap: break-word; 
     280        margin-left:48px; 
    252281} 
    253282 
  • apps/outlook/branches/1.6/DotTelSystem/DNS/Records/DNSTelnameNaptrResourceRecord.cs

    r493 r646  
    5757    ///  
    5858    [Serializable] 
    59     sealed public class DNSTelnameNaptrResourceRecord : DNSNaptrResourceRecord 
     59    public class DNSTelnameNaptrResourceRecord : DNSNaptrResourceRecord 
    6060    { 
     61        protected bool display; 
     62        public bool Display 
     63        { 
     64            get 
     65            { 
     66                return display; 
     67            } 
     68 
     69        } 
     70         
    6171        /// <summary> return full URI from regexp string e.g. "tel:+441794833353" 
    6272        ///  
     
    184194                } 
    185195 
     196                Logger.Log(Logger.Section.Lookups, "ntnTelname: " + ntnTelname); 
     197                Logger.Log(Logger.Section.Lookups, "ntnQuery: " + ntnQuery); 
     198                
    186199                // remove the part of ntnTelname that is common with the query including 
    187200                // the dot before the query suffix in the Telname, so 
     
    189202                // then remove the .tel suffix if still present 
    190203                int p = ntnTelname.ToLower().IndexOf(ntnQuery); 
    191                 if (p != -1) 
     204                if (p > 0) 
    192205                { 
    193206                    ntnTelname = ntnTelname.Substring(0, (p - 1) - (0)); // -1 to remove dot 
     
    199212                } 
    200213 
     214                //Replace punycode with unicode 
     215                ntnTelname = Gnu.Inet.Encoding.IDNA.ToUnicode(ntnTelname); 
    201216                // replace '-' with ' ' and '.' with '>' 
    202217                ntnTelname = ntnTelname.Replace('-', ' '); 
     
    207222 
    208223        } 
     224        /// <summary> 
     225        /// The longlabels from the NAPTR 
     226        /// </summary> 
     227        public List<string> LongLabels 
     228        { 
     229            get 
     230            { 
     231                return longlabels; 
     232            } 
     233             set 
     234            { 
     235                this.longlabels = value; 
     236            } 
     237        } 
     238         
    209239 
    210240        /// <summary> 
     
    219249        } 
    220250 
    221         private List<string> labels; 
     251        protected List<string> labels; 
     252 
     253        protected List<string> longlabels; 
    222254 
    223255        /// <summary> query.</summary> 
    224         private string query; 
     256        protected string query; 
    225257 
    226258        /// <summary> uriPath.</summary> 
    227         private string uriPath; 
     259        protected string uriPath; 
    228260 
    229261        /// <summary> uriScheme.</summary> 
    230         private string uriScheme; // includes trailing colon 
     262        protected string uriScheme; // includes trailing colon 
    231263 
    232264        /// <summary> serviceType.</summary> 
    233         private string serviceType; 
     265        protected string serviceType; 
    234266        /// <summary> catagory.</summary> 
    235         private List<string> catagories; 
     267        protected List<string> catagories; 
    236268 
    237269        public static string GetLocationIndicatorHintPresentedText(string catagory) 
     
    272304        /// <param name="naptr">the naptr 
    273305        /// </param> 
    274         private DNSTelnameNaptrResourceRecord(DNSNaptrResourceRecord naptr) 
     306        protected DNSTelnameNaptrResourceRecord(DNSNaptrResourceRecord naptr) 
    275307            : base(naptr.TTL, naptr.order, naptr.preference, naptr.flagsStr, naptr.serviceStr, naptr.regexpStr, naptr.replaceStr, naptr.WasEncrypted) 
    276308        { 
     309            longlabels = new List<string>(); 
    277310        } 
    278311 
     
    397430                    throw new DNSTelnameNaptrInvalidException("colon missing in URI (\"" + uri + "\")"); 
    398431                } 
    399  
     432                Logger.Log(Logger.Section.Lookups, "ntn uri:: " + uri); 
     433                 
    400434                string theUriScheme = uri.Substring(0, (colonPos + 1) - (0)); // scheme with ':' 
    401435                string schemeName = uri.Substring(0, (colonPos) - (0)); // scheme without ':' 
  • apps/outlook/branches/1.6/DotTelSystem/Friending/Messaging/Messaging.cs

    r338 r646  
    210210        /// </summary> 
    211211        /// <param name="telname">The domain to send the friend request to</param> 
    212         public void AddFriend(string telname) 
    213         { 
     212        public void AddFriend(string longtelname) 
     213        { 
     214            string telname = getShortTelname(longtelname); 
    214215            Logger.Log(Logger.Section.Friending, "Befriending: " + telname); 
    215216            Messaging.friendADDER.ComposeFriendingMessage(telname); 
     
    240241                Logger.Log(Logger.Section.Contact_Toolbar, "Problem adding friend: " + e.Message); 
    241242            } 
     243        } 
     244 
     245        /// <summary> 
     246        ///  returns only the top level domain for friending 
     247        /// </summary> 
     248        /// <param name="longtelname"></param> 
     249        /// <returns></returns> 
     250        private string getShortTelname(string longtelname) 
     251        { 
     252            string[] split = longtelname.Split(new char[] { '.' }); 
     253            if (split.Length > 1) 
     254                return split[split.Length - 2] + "." + split[split.Length - 1]; 
     255            else  
     256                return longtelname; 
    242257        } 
    243258 
  • apps/outlook/branches/1.6/DotTelSystem/Lookup/LookupResult.cs

    r338 r646  
    115115        } 
    116116 
     117        /// <summary> The version records.</summary> 
     118        private System.Collections.ArrayList versionRecords; 
     119        /// <summary> The status of the txt lookup.</summary> 
     120        private LookupWorker.LookupStatus versionStatus; 
     121 
     122        public LookupWorker.LookupStatus VersionStatus 
     123        { 
     124            set 
     125            { 
     126                versionStatus = value; 
     127            } 
     128            get 
     129            { 
     130                return versionStatus; 
     131            } 
     132        } 
     133 
    117134        /// <summary> The txt records.</summary> 
    118135        private System.Collections.ArrayList nInfoRecords; 
     
    132149        } 
    133150 
     151        /// <summary> The keyword records.</summary> 
     152        private System.Collections.ArrayList keywordRecords; 
     153        /// <summary> The status of the keyword lookup.</summary> 
     154        private LookupWorker.LookupStatus keywordStatus; 
     155 
     156        public LookupWorker.LookupStatus KeywordStatus 
     157        { 
     158            set 
     159            { 
     160                keywordStatus = value; 
     161            } 
     162            get 
     163            { 
     164                return keywordStatus; 
     165            } 
     166        } 
     167 
     168        /// <summary> The long label records.</summary> 
     169        private System.Collections.ArrayList longLabelRecords; 
     170 
     171 
    134172        /// <summary> 
    135173        /// Check for equality based on matching resource records 
     
    144182                // return false if we got a successful lookup 
    145183                if (naptrStatus == LookupWorker.LookupStatus.Ok && txtStatus == LookupWorker.LookupStatus.Ok  
    146                     && locStatus == LookupWorker.LookupStatus.Ok && nInfoStatus == LookupWorker.LookupStatus.Ok) 
     184                    && locStatus == LookupWorker.LookupStatus.Ok && nInfoStatus == LookupWorker.LookupStatus.Ok 
     185                    && keywordStatus == LookupWorker.LookupStatus.Ok && versionStatus == LookupWorker.LookupStatus.Ok) 
    147186                { 
    148187                    return false; 
     
    156195            // check if we've got the same telname             
    157196            if (telname != lr.telname) return false; 
     197 
     198            // check if we've got the same dds            
     199            if (ddsValue != lr.ddsValue) return false; 
     200 
     201            // check if we've got the pddxVersion           
     202            if (pddxVersion != lr.pddxVersion) return false; 
    158203 
    159204            // if neither of us have any records then we must be the same (empty) 
     
    167212                if (locRecords.Count != lr.LocRecords.Count) return false; 
    168213                if (nInfoRecords.Count != lr.NInfoRecords.Count) return false; 
     214                if (keywordRecords.Count != lr.KeywordRecords.Count) return false; 
     215                if (longLabelRecords.Count != lr.longLabelRecords.Count) return false; 
     216                if (versionRecords.Count != lr.versionRecords.Count) return false; 
    169217            } 
    170218            catch (Exception) 
     
    206254            } 
    207255            if (!this.CompareLocRecordLists(lr.locRecords, locRecords)) 
     256            { 
     257                return false; 
     258            } 
     259 
     260            if (!this.CompareKeywordRecordLists(keywordRecords, lr.keywordRecords)) 
     261            { 
     262                return false; 
     263            } 
     264            if (!this.CompareKeywordRecordLists(lr.keywordRecords, keywordRecords)) 
     265            { 
     266                return false; 
     267            } 
     268 
     269            if (!this.CompareLongLabelRecordLists(longLabelRecords, lr.longLabelRecords)) 
     270            { 
     271                return false; 
     272            } 
     273            if (!this.CompareLongLabelRecordLists(lr.longLabelRecords, longLabelRecords)) 
     274            { 
     275                return false; 
     276            } 
     277 
     278            if (!this.CompareTxtRecordLists(versionRecords, lr.versionRecords)) 
     279            { 
     280                return false; 
     281            } 
     282            if (!this.CompareTxtRecordLists(lr.versionRecords, versionRecords)) 
    208283            { 
    209284                return false; 
     
    291366        } 
    292367 
     368        private bool CompareKeywordRecordLists(ArrayList first, ArrayList second) 
     369        { 
     370            if (first.Count == second.Count) 
     371            { 
     372                foreach (DNSTxtResourceRecord r1 in first) 
     373                { 
     374                    bool found = false; 
     375                    foreach (DNSTxtResourceRecord r2 in second) 
     376                    { 
     377                        if (r1.Equals(r2)) 
     378                        { 
     379                            found = true; 
     380                        } 
     381                    } 
     382                    if (!found) 
     383                    { 
     384                        return false; 
     385                    } 
     386                } 
     387                return true; 
     388            } 
     389            return false; 
     390        } 
     391 
     392        private bool CompareLongLabelRecordLists(ArrayList first, ArrayList second) 
     393        { 
     394            if (first.Count == second.Count) 
     395            { 
     396                foreach (DNSTxtResourceRecord r1 in first) 
     397                { 
     398                    bool found = false; 
     399                    foreach (DNSTxtResourceRecord r2 in second) 
     400                    { 
     401                        if (r1.Equals(r2)) 
     402                        { 
     403                            found = true; 
     404                        } 
     405                    } 
     406                    if (!found) 
     407                    { 
     408                        return false; 
     409                    } 
     410                } 
     411                return true; 
     412            } 
     413            return false; 
     414        } 
     415 
    293416        private bool CompareLocRecordLists(ArrayList first, ArrayList second) 
    294417        { 
     
    324447            if (locRecords != null && locRecords.Count > 0) return true; 
    325448            if (nInfoRecords != null && nInfoRecords.Count > 0) return true; 
     449            if (keywordRecords != null && keywordRecords.Count > 0) return true; 
     450            if (longLabelRecords != null && longLabelRecords.Count > 0) return true; 
     451            //Version Records deliberately not included 
    326452 
    327453            return false; 
     
    358484        { 
    359485            // none of the results should be null, so if they are set ttl to 0 
    360             if (txtRecords == null && naptrRecords == null && locRecords == null && nInfoRecords == null) 
     486            if (txtRecords == null && naptrRecords == null && locRecords == null && nInfoRecords == null && keywordRecords == null && versionRecords == null) 
    361487            { 
    362488                ttl = 0; 
    363489            }   // if we don't have any actual results we can't work out a ttl, so set to 0 
    364             else if (txtRecords.Count == 0 && naptrRecords.Count == 0 && locRecords.Count == 0 && nInfoRecords.Count == 0) 
     490            else if (txtRecords.Count == 0 && naptrRecords.Count == 0 && locRecords.Count == 0 && nInfoRecords.Count == 0 && keywordRecords.Count == 0 && versionRecords.Count == 0) 
    365491            { 
    366492                ttl = 0; 
     
    374500        /// <returns> the naptr records 
    375501        /// </returns> 
    376         /// <summary> Sets the naptr records. 
     502        /// <summary> Sets the naptr records. If there are any long labels matching a naptr it updates it's long label field 
    377503        ///  
    378504        /// </summary> 
     
    397523                    updated = (System.DateTime.Now.Ticks - 621355968000000000) / 10000 / 1000; 
    398524                    setMinTtl(this.naptrRecords); 
     525                    if (!(this.longLabelRecords == null)) 
     526                    { 
     527                        foreach (DNSTelnameNaptrResourceRecord naptr in this.naptrRecords) 
     528                        { 
     529                            foreach (DNSLongLabelTxtResourceRecord label in this.longLabelRecords) 
     530                            { 
     531                                if ((naptr.Order == label.Order) && (naptr.Preference == label.Priority)) 
     532                                { 
     533                                    Logger.Log(Logger.Section.Lookups, "Long label matched " + label.TxtStr);   
     534                                    naptr.LongLabels = label.LongLabels; 
     535                                } 
     536                            } 
     537                        } 
     538                    } 
    399539                } 
    400540            } 
     
    417557                { 
    418558                    this.locRecords = value; 
    419                     //naptrRecords.Sort(); 
    420559                    updated = (System.DateTime.Now.Ticks - 621355968000000000) / 10000 / 1000; 
    421560                    setMinTtl(this.locRecords); 
     
    439578                { 
    440579                    this.nInfoRecords = value; 
     580                    this.updated = (System.DateTime.Now.Ticks - 621355968000000000) / 10000 / 1000; 
     581                    this.setMinTtl(this.nInfoRecords); 
     582                } 
     583            } 
     584        } 
     585 
     586        /// <summary> 
     587        /// Checks for existing Naptrs and tries to match them to update their longLabel field 
     588        /// </summary> 
     589        virtual public System.Collections.ArrayList LongLabelRecords 
     590        { 
     591            get 
     592            { 
     593                lock (this) 
     594                { 
     595                    return this.longLabelRecords; 
     596                } 
     597            } 
     598 
     599            set 
     600            { 
     601                lock (this) 
     602                { 
     603                    this.longLabelRecords = value; 
    441604                    //naptrRecords.Sort(); 
    442605                    this.updated = (System.DateTime.Now.Ticks - 621355968000000000) / 10000 / 1000; 
    443                     this.setMinTtl(this.nInfoRecords); 
    444                 } 
    445             } 
    446         } 
     606                    this.setMinTtl(this.longLabelRecords); 
     607 
     608                    if (!(this.naptrRecords == null)) 
     609                    { 
     610                        foreach (DNSTelnameNaptrResourceRecord naptr in this.naptrRecords) 
     611                        { 
     612                            foreach (DNSLongLabelTxtResourceRecord label in this.longLabelRecords) 
     613                            { 
     614                                if ((naptr.Order == label.Order) && (naptr.Preference == label.Priority)) 
     615                                { 
     616                                    Logger.Log(Logger.Section.Lookups, "Long label matched " + label.TxtStr); 
     617                                    naptr.LongLabels = label.LongLabels; 
     618                                } 
     619                            } 
     620                        } 
     621                    } 
     622                } 
     623            } 
     624        } 
     625 
    447626 
    448627 
     
    452631        /// <returns> the txt records 
    453632        /// </returns> 
    454         /// <summary> Sets the txt records. 
    455         ///  
     633        /// <summary> Sets the txt records.  
     634        /// Removes and process service messages. Removes keywords. Removes long labels and adds them to their own list. 
    456635        /// </summary> 
    457636        /// <param name="txtRecords">the txt records 
     
    471650                lock (this) 
    472651                { 
    473                     this.txtRecords = value; 
     652                    if (this.txtRecords == null) 
     653                    { 
     654                        this.txtRecords = value; 
     655                    } 
     656                    else 
     657                    { 
     658                        this.txtRecords.AddRange(value); 
     659                    } 
    474660                    Logger.Log(Logger.Section.Lookups, this.txtRecords.Count + " txt entries found."); 
    475                     //txtRecords.Sort(); 
    476661                    updated = (System.DateTime.Now.Ticks - 621355968000000000) / 10000 / 1000; 
    477662                    setMinTtl(this.txtRecords); 
    478663                    //interpret understood service messages 
    479                     foreach (DNSTxtResourceRecord servmess in this.txtRecords) 
    480                     { 
    481                         if (typeof(DNSTxtServiceMessageResourceRecord).IsInstanceOfType(servmess)) 
    482                         { 
    483                             ((DNSTxtServiceMessageResourceRecord)servmess).Process(this); 
    484                         } 
    485                     } 
     664                    List<DNSTxtResourceRecord> toBeRemoved = new List<DNSTxtResourceRecord>(); 
     665                    ArrayList addLongLabels = new ArrayList(); 
     666                    this.txtRecords.Reverse(); 
     667                    foreach (DNSTxtResourceRecord txtRecord in this.txtRecords) 
     668                    { 
     669                        if (typeof(DNSTxtServiceMessageResourceRecord).IsInstanceOfType(txtRecord)) 
     670                        { 
     671                            ((DNSTxtServiceMessageResourceRecord)txtRecord).Process(this); 
     672                            toBeRemoved.Add((DNSTxtResourceRecord)txtRecord); 
     673                        } 
     674                        if (typeof(DNSLongLabelTxtResourceRecord).IsInstanceOfType(txtRecord)) 
     675                        { 
     676                            addLongLabels.Add((DNSLongLabelTxtResourceRecord)txtRecord); 
     677                            toBeRemoved.Add((DNSTxtResourceRecord)txtRecord); 
     678                        } 
     679                        if (typeof(DNSStructuredKeywordsTxtResourceRecord).IsInstanceOfType(txtRecord)) 
     680                        { 
     681                            toBeRemoved.Add((DNSTxtResourceRecord)txtRecord); 
     682                        } 
     683                    } 
     684                    foreach (DNSTxtResourceRecord o in toBeRemoved) 
     685                    { 
     686                        this.txtRecords.Remove(o); 
     687                    } 
     688                    this.LongLabelRecords = addLongLabels; 
     689                } 
     690            } 
     691        } 
     692 
     693        /// <summary> 
     694        /// Removes and process service messages. Removes keywords. Removes long labels and adds them to their own list. 
     695        /// </summary> 
     696        virtual public System.Collections.ArrayList VersionRecords 
     697        { 
     698            get 
     699            { 
     700                lock (this) 
     701                { 
     702                    return versionRecords; 
     703                } 
     704            } 
     705 
     706            set 
     707            { 
     708                lock (this) 
     709                { 
     710                    this.versionRecords = value; 
     711                    this.versionRecords.Reverse() ; 
     712                    updated = (System.DateTime.Now.Ticks - 621355968000000000) / 10000 / 1000; 
     713                    setMinTtl(this.versionRecords); 
     714                    ArrayList toBeRemoved = new ArrayList(); 
     715                    ArrayList pddxRecords = new ArrayList(); 
     716                    ArrayList addKeywords = new ArrayList(); 
     717                    ArrayList addLongLabels = new ArrayList(); 
     718                    foreach (DNSTxtResourceRecord versionRecord in this.versionRecords) 
     719                    { 
     720                        if (typeof(DNSPDDXTxtServiceMessageResourceRecord).IsInstanceOfType(versionRecord)) 
     721                        { 
     722                            Logger.Log(Logger.Section.Lookups, "Version Record Found pddxVersion = " + PddxVersion); 
     723                            pddxRecords.Add((DNSPDDXTxtServiceMessageResourceRecord)versionRecord); 
     724                            ((DNSPDDXTxtServiceMessageResourceRecord)versionRecord).Process(this); 
     725                            Logger.Log(Logger.Section.Lookups, "Version Record Found pddxVersion = " + PddxVersion); 
     726                            toBeRemoved.Add((DNSTxtResourceRecord)versionRecord); 
     727                        } 
     728                        if (typeof(DNSStructuredKeywordsTxtResourceRecord).IsInstanceOfType(versionRecord)) 
     729                        { 
     730                            addKeywords.Add((DNSStructuredKeywordsTxtResourceRecord)versionRecord); 
     731                            toBeRemoved.Add((DNSTxtResourceRecord)versionRecord); 
     732                        } 
     733                        if (typeof(DNSDDSTxtServiceMessageResourceRecord).IsInstanceOfType(versionRecord)) 
     734                        { 
     735                            ((DNSDDSTxtServiceMessageResourceRecord)versionRecord).Process(this); 
     736                            toBeRemoved.Add((DNSTxtResourceRecord)versionRecord); 
     737                        } 
     738                        if (typeof(DNSLongLabelTxtResourceRecord).IsInstanceOfType(versionRecord)) 
     739                        { 
     740                            addLongLabels.Add((DNSLongLabelTxtResourceRecord)versionRecord); 
     741                            toBeRemoved.Add((DNSTxtResourceRecord)versionRecord); 
     742                        } 
     743                       
     744                    } 
     745                    foreach (DNSTxtResourceRecord o in toBeRemoved) 
     746                    { 
     747                        this.versionRecords.Remove(o); 
     748                    } 
     749                    this.txtRecords = this.versionRecords; 
     750                    this.versionRecords = pddxRecords; 
     751                    this.KeywordRecords = addKeywords; 
     752                    this.LongLabelRecords = addLongLabels; 
     753                } 
     754            } 
     755        } 
     756 
     757        /// <summary> 
     758        /// Removes any records which aren't keywords 
     759        /// </summary> 
     760        virtual public System.Collections.ArrayList KeywordRecords 
     761        { 
     762            get 
     763            { 
     764                lock (this) 
     765                { 
     766                    return keywordRecords; 
     767                } 
     768            } 
     769 
     770            set 
     771            { 
     772                lock (this) 
     773                { 
     774                    this.keywordRecords = value; 
     775                    //Logger.Log(Logger.Section.Lookups, this.keywordRecords.Count + " keyword entries found when PDDX <> 1."); 
     776                    //txtRecords.Sort(); 
     777                    updated = (System.DateTime.Now.Ticks - 621355968000000000) / 10000 / 1000; 
     778                    setMinTtl(this.keywordRecords); 
    486779                    //get rid of service messages so they don't get in the way 
    487                     List<DNSTxtServiceMessageResourceRecord> toBeRemoved = new List<DNSTxtServiceMessageResourceRecord>(); 
    488                     foreach (DNSTxtResourceRecord servmess in this.txtRecords) 
    489                     { 
    490                         if (typeof(DNSTxtServiceMessageResourceRecord).IsInstanceOfType(servmess)) 
    491                         { 
    492                             toBeRemoved.Add((DNSTxtServiceMessageResourceRecord)servmess); 
    493                         } 
    494                     } 
    495                     foreach (DNSTxtServiceMessageResourceRecord o in toBeRemoved) 
    496                     { 
    497                         this.txtRecords.Remove(o); 
    498                     } 
    499                 } 
    500             } 
    501  
    502         } 
     780                    List<DNSTxtResourceRecord> toBeRemoved = new List<DNSTxtResourceRecord>(); 
     781                    foreach (DNSTxtResourceRecord txtRecord in this.keywordRecords) 
     782                    { 
     783                        if (!typeof(DNSStructuredKeywordsTxtResourceRecord).IsInstanceOfType(txtRecord)) 
     784                        { 
     785                            toBeRemoved.Add((DNSTxtResourceRecord)txtRecord); 
     786                        } 
     787                    } 
     788                    foreach (DNSTxtResourceRecord o in toBeRemoved) 
     789                    { 
     790                        this.keywordRecords.Remove(o); 
     791                    } 
     792                     
     793                } 
     794            } 
     795 
     796        } 
     797 
     798 
     799       
    503800 
    504801        private bool canBeFriended = true; 
     
    519816        } 
    520817 
     818        private string pddxVersion = ""; 
     819        /// <summary> 
     820        /// The Version found in the PDDX version record 
     821        /// </summary> 
     822        public string PddxVersion 
     823        { 
     824            get 
     825            { 
     826                return this.pddxVersion; 
     827            } 
     828 
     829            set 
     830            { 
     831                this.pddxVersion = value; 
     832            } 
     833        } 
     834 
     835        private string ddsValue = null; 
     836        /// <summary> 
     837        /// Returns the vlaue of the DDS 
     838        /// </summary> 
     839        public string DdsValue 
     840        { 
     841            get 
     842            { 
     843                return this.ddsValue; 
     844            } 
     845 
     846            set 
     847            { 
     848                this.ddsValue = value; 
     849            } 
     850        } 
     851 
    521852        /// <summary> Gets the telname. 
    522853        ///  
     
    625956            { 
    626957                //domainElement.InnerText = this.publicTelname; 
     958                //string[] crumbs = this.publicTelname.Substring(0, this.publicTelname.Length - 4).Split('.'); 
    627959                string[] crumbs = this.publicTelname.Substring(0, this.publicTelname.Length - 4).Split('.'); 
    628                 if (crumbs.Length > 1) 
    629                 { 
    630                     if (LookupResult.IsSpecialDomain(crumbs[crumbs.Length - 1])) 
     960                if (crumbs.Length > 0) 
     961                { 
     962                    if (LookupResult.IsSpecialDomain(crumbs[crumbs.Length - 1]) && (crumbs.Length > 1)) 
    631963                    { 
    632964                        domainElement.InnerText = crumbs[crumbs.Length - 2]; 
     
    641973                        XmlElement crumbElement = doc.CreateElement("Crumb"); 
    642974                        XmlElement crumbNameElement = doc.CreateElement("CrumbName"); 
    643                         crumbNameElement.InnerText = crumbs[i]; 
     975                        crumbNameElement.InnerText = Gnu.Inet.Encoding.IDNA.ToUnicode(crumbs[i]); 
    644976                        crumbElement.AppendChild(crumbNameElement); 
    645977                        if (i > 0) 
     
    6741006            } 
    6751007 
     1008            if (keywordStatus != LookupWorker.LookupStatus.Ok) 
     1009            { 
     1010                XmlElement keywordStatusElement = doc.CreateElement("KeywordErrorStatus"); 
     1011                keywordStatusElement.InnerText = LookupWorker.FormatStatus(KeywordStatus); 
     1012                root.AppendChild(keywordStatusElement); 
     1013            } 
     1014 
    6761015            if (txtStatus != LookupWorker.LookupStatus.Ok) 
    6771016            { 
     
    6941033                root.AppendChild(nInfoStatusElement); 
    6951034            } 
    696  
    697             if (this.naptrRecords.Count == 0 && this.locRecords.Count == 0 && this.txtRecords.Count == 0 && this.nInfoRecords.Count == 0) 
     1035            if (this.naptrRecords.Count == 0 && this.locRecords.Count == 0 && this.txtRecords.Count == 0 && (this.nInfoRecords == null  || this.nInfoRecords.Count == 0 ) 
     1036                && (this.keywordRecords == null || this.keywordRecords.Count == 0)) 
    6981037            { 
    6991038                XmlElement messageElement = doc.CreateElement("Message"); 
     
    7191058            root.AppendChild(lastLookUpTimeElement); 
    7201059 
     1060            if (this.ddsValue != null) 
     1061            { 
     1062                XmlElement ddsValueElement = doc.CreateElement("ddsValue"); 
     1063                Logger.Log(Logger.Section.Results_Screen, "DDS - " + this.ddsValue); 
     1064                ddsValueElement.InnerXml = GetSafeValue(this.ddsValue); 
     1065                Logger.Log(Logger.Section.Results_Screen, "DDS - " + ddsValueElement.InnerXml); 
     1066                root.AppendChild(ddsValueElement); 
     1067            } 
     1068            
     1069 
    7211070 
    7221071            // add the NAPTR results 
     
    7281077                foreach (DNSTelnameNaptrResourceRecord rr in NaptrRecords) 
    7291078                { 
     1079                 
    7301080                    if (rr.NonTerminal) 
    7311081                    { 
     
    7371087                        naptrRecord.AppendChild(displayElement); 
    7381088 
     1089                        Logger.Log(Logger.Section.Results_Screen, "Non terminal: " + rr.ReplaceStr); 
    7391090                        XmlElement uriElement = doc.CreateElement("Uri"); 
    740                         uriElement.InnerText = rr.ReplaceStr.Replace("\\", "\\\\"); 
     1091                        uriElement.InnerText = Uri.UnescapeDataString(rr.ReplaceStr).Replace("\\", "\\\\"); 
    7411092                        naptrRecord.AppendChild(uriElement); 
     1093 
     1094                        if (rr.LongLabels.Count > 0) 
     1095                        { 
     1096                            XmlElement longLabelsElement = doc.CreateElement("LongLabels"); 
     1097                            foreach (string longLabel in rr.LongLabels) 
     1098                            { 
     1099                                XmlElement longLabelElement = doc.CreateElement("LongLabel"); 
     1100                                XmlElement longLabelNameElement = doc.CreateElement("LongLabelName"); 
     1101 
     1102                                longLabelNameElement.InnerText = GetSafeValue(longLabel); 
     1103                                longLabelElement.AppendChild(longLabelNameElement); 
     1104                                longLabelsElement.AppendChild(longLabelElement); 
     1105                            } 
     1106                            naptrRecord.AppendChild(longLabelsElement); 
     1107                        } 
    7421108                    } 
    7431109                    else 
    7441110                    { 
    745                         XmlElement naptrRecord = doc.CreateElement("TerminalNaptrRecord"); 
    746                         naptrResultsElement.AppendChild(naptrRecord); 
    747  
    748                         XmlElement serviceElement = doc.CreateElement("ServiceType"); 
    749                         serviceElement.InnerText = rr.ServiceType; 
    750                         naptrRecord.AppendChild(serviceElement); 
    751  
    752                         XmlElement serviceNameElement = doc.CreateElement("ServiceName"); 
    753                         serviceNameElement.InnerText = UriHandler.getInstance().ServiceName(rr.ServiceType); 
    754                         naptrRecord.AppendChild(serviceNameElement); 
    755  
    756                         XmlElement uriElement = doc.CreateElement("Uri"); 
    757                         uriElement.InnerText = rr.Uri.Replace("\\", "\\\\"); 
    758                         naptrRecord.AppendChild(uriElement); 
    759  
    760                         XmlElement nameElement = doc.CreateElement("Name"); 
    761                         nameElement.InnerText = UriHandler.getInstance().Format(rr.ServiceType, rr.Uri); 
    762                         naptrRecord.AppendChild(nameElement); 
    763  
    764                         XmlElement categoriesElement = doc.CreateElement("LocationIndicatorHints"); 
    765                         XmlElement categoriesCountElement = doc.CreateElement("Count"); 
    766                         categoriesCountElement.InnerText = rr.Catagories.Count.ToString(); 
    767                         categoriesElement.AppendChild(categoriesCountElement); 
    768  
    769                         foreach (string lih in rr.Catagories) 
    770                         { 
    771                             XmlElement categoryElement = doc.CreateElement("LocationIndicatorHint"); 
    772                             XmlElement categoryNameElement = doc.CreateElement("Name"); 
    773                             categoryNameElement.InnerText = lih; 
    774                             categoryElement.AppendChild(categoryNameElement); 
    775                             XmlElement categoryPTElement = doc.CreateElement("PresentedText"); 
    776                             categoryPTElement.InnerText = DNSTelnameNaptrResourceRecord.GetLocationIndicatorHintPresentedText(lih); 
    777                             categoryElement.AppendChild(categoryPTElement); 
    778                             categoriesElement.AppendChild(categoryElement); 
    779                         } 
    780  
    781                         XmlElement concatenatedCategoriesElement = doc.CreateElement("ConcatenatedCategories"); 
    782                         if (rr.Catagories.Count > 0) 
    783                         { 
    784                             string[] cats = rr.Catagories.ToArray(); 
    785                             for (int i = 0; i < cats.Length; i++) 
     1111                        if (UriHandler.getInstance().Launchable(rr.ServiceType) || 
     1112                        (typeof(DNSUnlinkedTelnameNaptrResourceRecord).IsInstanceOfType(rr) && ((DNSUnlinkedTelnameNaptrResourceRecord)rr).Display)) 
     1113                        { 
     1114                            XmlElement naptrRecord = doc.CreateElement("TerminalNaptrRecord"); 
     1115                            naptrResultsElement.AppendChild(naptrRecord); 
     1116 
     1117                            XmlElement serviceElement = doc.CreateElement("ServiceType"); 
     1118                            serviceElement.InnerText = rr.ServiceType; 
     1119                            naptrRecord.AppendChild(serviceElement); 
     1120 
     1121                            XmlElement serviceNameElement = doc.CreateElement("ServiceName"); 
     1122                            serviceNameElement.InnerText = UriHandler.getInstance().ServiceName(rr.ServiceType); 
     1123                            naptrRecord.AppendChild(serviceNameElement); 
     1124 
     1125                            XmlElement uriElement = doc.CreateElement("Uri"); 
     1126                            uriElement.InnerText = rr.Uri.Replace("\\", "\\\\"); 
     1127                            naptrRecord.AppendChild(uriElement); 
     1128 
     1129                            XmlElement nameElement = doc.CreateElement("Name"); 
     1130 
     1131                            if (typeof(DNSUnlinkedTelnameNaptrResourceRecord).IsInstanceOfType(rr)) 
    7861132                            { 
    787                                 cats[i] = DNSTelnameNaptrResourceRecord.GetLocationIndicatorHintPresentedText(cats[i]); 
     1133                                nameElement.InnerText = ((DNSUnlinkedTelnameNaptrResourceRecord)rr).Text; 
    7881134                            } 
    789                             concatenatedCategoriesElement.InnerText = String.Join( 
    790                                                 DotTelSystem.Properties.Resources.LookUpResult_LocationIndicatorHintsSeparator, cats); 
    791                         } 
    792                         else 
    793                         { 
    794                             concatenatedCategoriesElement.InnerText = " "; 
    795                         } 
    796                         categoriesElement.AppendChild(concatenatedCategoriesElement); 
    797                          
    798                         naptrRecord.AppendChild(categoriesElement); 
    799  
    800                         XmlElement iconElement = doc.CreateElement("Icon"); 
    801                         iconElement.InnerText = UriHandler.getInstance().GetIcon(rr.ServiceType, rr.Catagories, rr.WasEncrypted); 
    802                         naptrRecord.AppendChild(iconElement); 
    803  
    804                         if (UriHandler.getInstance().Launchable(rr.ServiceType)) 
    805                         { 
    806                             XmlElement launchElement = doc.CreateElement("Launchable"); 
    807                             launchElement.InnerText = "true"; 
    808                             naptrRecord.AppendChild(launchElement); 
    809                         } 
    810                         XmlElement labelsElement = doc.CreateElement("XLabels"); 
    811                         XmlElement xlblCount = doc.CreateElement("Count"); 
    812                         xlblCount.InnerText = rr.Labels.Count.ToString(); 
    813                         labelsElement.AppendChild(xlblCount); 
    814                         foreach (string label in rr.Labels) 
    815                         { 
    816                             XmlElement labelElement = doc.CreateElement("XLabel"); 
    817                             XmlElement labelNameElement = doc.CreateElement("XLabelName"); 
    818                             labelNameElement.InnerText = label.Replace('-', ' ').Replace(':', ' '); 
    819                             labelElement.AppendChild(labelNameElement); 
    820                             labelsElement.AppendChild(labelElement); 
    821                         } 
    822                         naptrRecord.AppendChild(labelsElement); 
    823                     } 
     1135                            else 
     1136                            { 
     1137                                nameElement.InnerText = UriHandler.getInstance().Format(rr.ServiceType, rr.Uri); 
     1138                                XmlElement launchElement = doc.CreateElement("Launchable"); 
     1139                                launchElement.InnerText = "true"; 
     1140                                naptrRecord.AppendChild(launchElement); 
     1141                            } 
     1142                            naptrRecord.AppendChild(nameElement); 
     1143 
     1144                            XmlElement categoriesElement = doc.CreateElement("LocationIndicatorHints"); 
     1145                            XmlElement categoriesCountElement = doc.CreateElement("Count"); 
     1146                            categoriesCountElement.InnerText = rr.Catagories.Count.ToString(); 
     1147                            categoriesElement.AppendChild(categoriesCountElement); 
     1148 
     1149                            foreach (string lih in rr.Catagories) 
     1150                            { 
     1151                                XmlElement categoryElement = doc.CreateElement("LocationIndicatorHint"); 
     1152                                XmlElement categoryNameElement = doc.CreateElement("Name"); 
     1153                                categoryNameElement.InnerText = lih; 
     1154                                categoryElement.AppendChild(categoryNameElement); 
     1155                                XmlElement categoryPTElement = doc.CreateElement("PresentedText"); 
     1156                                categoryPTElement.InnerText = DNSTelnameNaptrResourceRecord.GetLocationIndicatorHintPresentedText(lih); 
     1157                                categoryElement.AppendChild(categoryPTElement); 
     1158                                categoriesElement.AppendChild(categoryElement); 
     1159                            } 
     1160 
     1161                            XmlElement concatenatedCategoriesElement = doc.CreateElement("ConcatenatedCategories"); 
     1162                            if (rr.Catagories.Count > 0) 
     1163                            { 
     1164                                string[] cats = rr.Catagories.ToArray(); 
     1165                                for (int i = 0; i < cats.Length; i++) 
     1166                                { 
     1167                                    cats[i] = DNSTelnameNaptrResourceRecord.GetLocationIndicatorHintPresentedText(cats[i]); 
     1168                                } 
     1169                                concatenatedCategoriesElement.InnerText = String.Join( 
     1170                                                    DotTelSystem.Properties.Resources.LookUpResult_LocationIndicatorHintsSeparator, cats); 
     1171                            } 
     1172                            else 
     1173                            { 
     1174                                concatenatedCategoriesElement.InnerText = " "; 
     1175                            } 
     1176                            categoriesElement.AppendChild(concatenatedCategoriesElement); 
     1177 
     1178                            naptrRecord.AppendChild(categoriesElement); 
     1179 
     1180                            XmlElement iconElement = doc.CreateElement("Icon"); 
     1181                            iconElement.InnerText = UriHandler.getInstance().GetIcon(rr.ServiceType, rr.Catagories, rr.WasEncrypted); 
     1182                            naptrRecord.AppendChild(iconElement); 
     1183 
     1184                            XmlElement labelsElement = doc.CreateElement("XLabels"); 
     1185                            XmlElement xlblCount = doc.CreateElement("Count"); 
     1186                            xlblCount.InnerText = rr.Labels.Count.ToString(); 
     1187                            labelsElement.AppendChild(xlblCount); 
     1188                            foreach (string label in rr.Labels) 
     1189                            { 
     1190                                XmlElement labelElement = doc.CreateElement("XLabel"); 
     1191                                XmlElement labelNameElement = doc.CreateElement("XLabelName"); 
     1192                                labelNameElement.InnerText = GetSafeValue(label).Replace('-', ' ').Replace(':', ' ');  
     1193                                labelElement.AppendChild(labelNameElement); 
     1194                                labelsElement.AppendChild(labelElement); 
     1195                            } 
     1196                            naptrRecord.AppendChild(labelsElement); 
     1197                             
     1198                            if (rr.LongLabels.Count > 0) 
     1199                            { 
     1200                                Logger.Log(Logger.Section.Results_Screen, "Long Label count: " + rr.LongLabels.Count); 
     1201                                XmlElement longLabelsElement = doc.CreateElement("LongLabels"); 
     1202                                foreach (string longLabel in rr.LongLabels) 
     1203                                { 
     1204                                    XmlElement longLabelElement = doc.CreateElement("LongLabel"); 
     1205                                    XmlElement longLabelNameElement = doc.CreateElement("LongLabelName"); 
     1206                                    longLabelNameElement.InnerText = GetSafeValue(longLabel); 
     1207                                    longLabelElement.AppendChild(longLabelNameElement); 
     1208                                    longLabelsElement.AppendChild(longLabelElement); 
     1209                                } 
     1210                                naptrRecord.AppendChild(longLabelsElement); 
     1211                            } 
     1212 
     1213                          
     1214                        } 
     1215                        
     1216                    } 
     1217                    
    8241218                } 
    8251219 
     
    8561250 
    8571251            // add the TXT results 
    858             XmlElement txtResultsElement = doc.CreateElement("TxtResults"); 
    859             root.AppendChild(txtResultsElement); 
    860  
    861             if (TxtRecords != null) 
    862             { 
    863                 foreach (DNSTxtResourceRecord rr in TxtRecords) 
     1252            //Commented out because we shouldn't be displaying an txtRecords 
     1253            if (pddxVersion == "1") 
     1254            { 
     1255                XmlElement txtResultsElement = doc.CreateElement("TxtResults"); 
     1256                root.AppendChild(txtResultsElement); 
     1257 
     1258                if (TxtRecords != null) 
     1259                { 
     1260                    foreach (DNSTxtResourceRecord rr in TxtRecords) 
     1261                    { 
     1262                        if (!typeof(DNSEnhancedTxtResourceRecord).IsInstanceOfType(rr)) 
     1263                        { 
     1264                            XmlElement txtRecord = doc.CreateElement("TxtRecord"); 
     1265                            txtResultsElement.AppendChild(txtRecord); 
     1266 
     1267                            XmlElement stringElement = doc.CreateElement("String"); 
     1268                            stringElement.InnerText = stringElement.InnerText = GetSafeValue(rr.TxtStr); 
     1269                            txtRecord.AppendChild(stringElement); 
     1270                        } 
     1271                    } 
     1272                } 
     1273            } 
     1274 
     1275            // add the Keyword results 
     1276            XmlElement keywordResultsElement = doc.CreateElement("KeywordResults"); 
     1277            root.AppendChild(keywordResultsElement); 
     1278 
     1279            if (KeywordRecords != null) 
     1280            { 
     1281                foreach (DNSTxtResourceRecord rr in KeywordRecords) 
    8641282                { 
    8651283                    if (typeof(DNSEnhancedTxtResourceRecord).IsInstanceOfType(rr)) 
     
    8671285                        if (typeof(DNSStructuredKeywordsTxtResourceRecord).IsInstanceOfType(rr)) 
    8681286                        { 
    869                             XmlElement txtRecord = doc.CreateElement("EnhancedTxtRecord"); 
    870                             txtResultsElement.AppendChild(txtRecord); 
     1287                            XmlElement keywordRecord = doc.CreateElement("EnhancedTxtRecord"); 
     1288                            keywordResultsElement.AppendChild(keywordRecord); 
    8711289 
    8721290                            DNSStructuredKeywordsTxtResourceRecord dnssktrr = (DNSStructuredKeywordsTxtResourceRecord)rr; 
    8731291 
     1292                            if (dnssktrr.FreeText != null) 
     1293                            { 
     1294                                XmlElement typeElement = doc.CreateElement("Type"); 
     1295                                typeElement.InnerText = "FreeText"; 
     1296                                keywordRecord.AppendChild(typeElement); 
     1297 
     1298                                XmlElement pairElement = doc.CreateElement("PrimaryPair"); 
     1299                                XmlElement keyElement = doc.CreateElement("Key"); 
     1300                                keyElement.InnerText = ""; 
     1301                                pairElement.AppendChild(keyElement); 
     1302 
     1303                                string value = GetSafeValue(dnssktrr.FreeText); 
     1304                                //string value = System.Security.SecurityElement.Escape(StripCharactersHTMLFears(dnssktrr.FreeText)); 
     1305                                if (value != "") 
     1306                                { 
     1307                                    XmlElement valueElement = doc.CreateElement("Value"); 
     1308                                    valueElement.InnerText =  value; 
     1309                                    pairElement.AppendChild(valueElement); 
     1310                                } 
     1311                                keywordRecord.AppendChild(pairElement); 
     1312                            } 
     1313                        } 
     1314                    } 
     1315                } 
     1316                foreach (DNSTxtResourceRecord rr in KeywordRecords) 
     1317                { 
     1318                    if (typeof(DNSEnhancedTxtResourceRecord).IsInstanceOfType(rr)) 
     1319                    { 
     1320                        if (typeof(DNSStructuredKeywordsTxtResourceRecord).IsInstanceOfType(rr)) 
     1321                        { 
     1322                            XmlElement keywordRecord = doc.CreateElement("EnhancedTxtRecord"); 
     1323                            keywordResultsElement.AppendChild(keywordRecord); 
     1324 
     1325                            DNSStructuredKeywordsTxtResourceRecord dnssktrr = (DNSStructuredKeywordsTxtResourceRecord)rr; 
     1326 
    8741327                            XmlElement countElement = doc.CreateElement("Count"); 
    875                             countElement.InnerText = "" + dnssktrr.OrderOfKeys.Count; 
    876                             txtRecord.AppendChild(countElement); 
     1328                            countElement.InnerText = "" + dnssktrr.KeywordsAndValues.Count; 
     1329                            keywordRecord.AppendChild(countElement); 
    8771330                            bool primary = true; 
    878                             foreach (string key in dnssktrr.OrderOfKeys) 
     1331                            foreach (KeyValuePair<string, string> kvp in dnssktrr.KeywordsAndValues) 
    8791332                            { 
     1333                                XmlElement typeElement = doc.CreateElement("Type"); 
     1334                                if (dnssktrr.IsStructured()) 
     1335                                { 
     1336                                    typeElement.InnerText = "Structured"; 
     1337                                  } 
     1338                                else 
     1339                                { 
     1340                                    typeElement.InnerText = "Other"; 
     1341                                } 
     1342                                keywordRecord.AppendChild(typeElement); 
     1343 
     1344                                //string key = System.Security.SecurityElement.Escape(StripCharactersHTMLFears(kvp.Key)); 
     1345                                //string value = System.Security.SecurityElement.Escape(StripCharactersHTMLFears(kvp.Value)); 
     1346                                string key = GetSafeValue(kvp.Key); 
     1347                                string value = GetSafeValue(kvp.Value); 
    8801348                                XmlElement pairElement = null; 
    881                                 if (primary) 
     1349                                if (primary && dnssktrr.IsStructured()) 
    8821350                                { 
    8831351                                    primary = false; 
     
    8881356                                    pairElement = doc.CreateElement("Pair"); 
    8891357                                } 
    890  
    8911358                                XmlElement keyElement = doc.CreateElement("Key"); 
    892                                 keyElement.InnerText = StripCharactersHTMLFears(key); 
     1359                                keyElement.InnerText = key; 
    8931360                                pairElement.AppendChild(keyElement); 
    894  
     1361                                Logger.Log(Logger.Section.Results_Screen,"Key: " + key); 
    8951362                                XmlElement keyNameElement = doc.CreateElement("Key-name"); 
    896                                 keyNameElement.InnerText = dnssktrr.KeysToHumanReadableValues[StripCharactersHTMLFears(key)]; 
     1363                                keyNameElement.InnerText = dnssktrr.KeysToHumanReadableValues[kvp.Key]; 
     1364 
     1365 
    8971366                                pairElement.AppendChild(keyNameElement); 
    8981367 
    899                                 string value = dnssktrr.KeywordsAndValues[StripCharactersHTMLFears(key)]; 
    9001368                                if (value != "") 
    9011369                                { 
    9021370                                    XmlElement valueElement = doc.CreateElement("Value"); 
    903                                     valueElement.InnerText = value; 
     1371                                    if (value.EndsWith(":")) 
     1372                                    { 
     1373                                        valueElement.InnerText = value.Substring(0,value.Length-1); 
     1374                                    } 
     1375                                    else 
     1376                                    { 
     1377                                        valueElement.InnerText = value; 
     1378                                    } 
     1379                                     
    9041380                                    pairElement.AppendChild(valueElement); 
    9051381                                } 
    9061382 
    907                                 txtRecord.AppendChild(pairElement); 
     1383                                keywordRecord.AppendChild(pairElement); 
     1384                                 
    9081385                            } 
    9091386                        } 
    910  
    911                     } 
    912                     else 
    913                     { 
    914                         XmlElement txtRecord = doc.CreateElement("TxtRecord"); 
    915                         txtResultsElement.AppendChild(txtRecord); 
    916  
    917                         XmlElement stringElement = doc.CreateElement("String"); 
    918                         stringElement.InnerText = System.Security.SecurityElement.Escape(StripCharactersHTMLFears(rr.TxtStr)) 
    919                             .Replace("\r\n", "<br />").Replace("\n", "<br />").Replace("\r", "<br />").Replace("&apos;", "&#39;"); 
    920                         txtRecord.AppendChild(stringElement); 
    9211387                    } 
    9221388                } 
     
    9341400 
    9351401                    XmlElement stringElement = doc.CreateElement("String"); 
    936                     stringElement.InnerText = System.Security.SecurityElement.Escape(StripCharactersHTMLFears(rr.TxtStr)) 
    937                         .Replace("\r\n", "<br />").Replace("\n", "<br />").Replace("\r", "<br />").Replace("&apos;", "&#39;"); 
     1402                    stringElement.InnerText = GetSafeValue(rr.TxtStr); 
     1403                    //stringElement.InnerText = System.Security.SecurityElement.Escape(StripCharactersHTMLFears(rr.TxtStr)) 
     1404                    //      .Replace("\r\n", "<br />").Replace("\n", "<br />").Replace("\r", "<br />").Replace("&apos;", "&#39;"); 
    9381405                    nInfoRecord.AppendChild(stringElement); 
    9391406                } 
    9401407            } 
    941  
    9421408            return root; 
    9431409             
    9441410        } 
     1411 
     1412        private string GetSafeValue(string p) 
     1413        { 
     1414            return System.Security.SecurityElement.Escape(StripCharactersHTMLFears(p)) 
     1415                .Replace("\r\n", "<br />").Replace("\n", "<br />").Replace("\r", "<br />") 
     1416                .Replace("&apos;", "&#39;"); 
     1417        } 
     1418 
     1419        /*private static void MakeLabelText(string label, XmlElement labelNameElement) 
     1420        { 
     1421            labelNameElement.InnerText = System.Security.SecurityElement.Escape(StripCharactersHTMLFears(label)) 
     1422                .Replace("\r\n", "<br />").Replace("\n", "<br />").Replace("\r", "<br />") 
     1423                .Replace("&apos;", "&#39;").Replace('-', ' ').Replace(':', ' '); 
     1424        }*/ 
    9451425 
    9461426 
     
    9801460            } 
    9811461        } 
     1462 
     1463      
    9821464    } 
    9831465} 
  • apps/outlook/branches/1.6/DotTelSystem/Lookup/LookupTelname.cs

    r338 r646  
    5858    public class LookupTelname : LookupWorkerCompletedListener 
    5959        { 
    60  
     60         
    6161        /// <summary> Sets the listener. 
    6262        ///  
     
    101101        private LookupWorker lwTxt; 
    102102 
    103         /// <summary> The lw txt.</summary> 
     103        /// <summary> The lw ninfo.</summary> 
    104104        private LookupWorker lwNInfo; 
     105 
     106        /// <summary> The lw kw.</summary> 
     107        private LookupWorker lwKeyword; 
     108 
     109        /// <summary> The lw version.</summary> 
     110        private LookupWorker lwVersion; 
    105111 
    106112        /// <summary> The lookup result.</summary> 
     
    136142        /// <summary> The status.</summary> 
    137143        private int status = STATUS_OK; 
     144 
     145        /// <summary> The version at which we change lookups</summary> 
     146        private const int version_change = 11; 
    138147 
    139148        private Thread naptrThread; 
     
    141150        private Thread txtThread; 
    142151        private Thread nInfoThread; 
     152        private Thread keywordThread; 
     153        private Thread versionThread; 
    143154 
    144155        public LookupWorker.LookupStatus parentStatus; 
     
    191202            else if (!cancelled) 
    192203            { 
    193                 // do txt and naptr lookups in separate threads 
    194                 performTxtLookup(publicTelname); 
    195                 performLocLookup(publicTelname); 
    196                 performNaptrLookup(telname); 
    197                 performNInfoLookup(publicTelname); 
    198  
    199                 // wait for those threads to finish 
    200                 naptrThread.Join(); 
    201                 locThread.Join(); 
    202                 txtThread.Join(); 
    203                 nInfoThread.Join(); 
    204  
    205                 Logger.Log(Logger.Section.Lookups, "Lookup threads finished for " + telname); 
    206                 Logger.Log(Logger.Section.Lookups, "NAPTR Status: " + lookupResult.NaptrStatus); 
    207                 Logger.Log(Logger.Section.Lookups, "LOC Status: " + lookupResult.LocStatus); 
    208                 Logger.Log(Logger.Section.Lookups, "TXT Status: " + lookupResult.TxtStatus); 
    209                 Logger.Log(Logger.Section.Lookups, "NInfo Status: " + lookupResult.NInfoStatus); 
    210  
    211                 // check if the lookup status was OK 
    212                 if (!cancelled && lookupResult.LocStatus == LookupWorker.LookupStatus.Ok && 
    213                                         lookupResult.TxtStatus == LookupWorker.LookupStatus.Ok &&  
    214                                         lookupResult.NaptrStatus == LookupWorker.LookupStatus.Ok && 
    215                                         lookupResult.NInfoStatus == LookupWorker.LookupStatus.Ok) 
    216                 { 
    217                     // store result in cache 
    218                     LookupCache.SetResult(telname, lookupResult); 
    219                     complete = true; 
    220                     completeListener.LookupTelnameComplete(lookupResult); 
    221                 } 
    222                 // if the result was NXDomain then remove the cache! 
    223                 else if (!cancelled && (lookupResult.NaptrStatus == LookupWorker.LookupStatus.Nxdomain ||  
    224                                         lookupResult.LocStatus == LookupWorker.LookupStatus.Nxdomain || 
    225                                         lookupResult.TxtStatus == LookupWorker.LookupStatus.Nxdomain || 
    226                                         lookupResult.NInfoStatus == LookupWorker.LookupStatus.Nxdomain)) 
    227                 { 
    228                     LookupCache.RemoveResult(telname); 
    229                     complete = true; 
    230                     completeListener.LookupTelnameComplete(lookupResult); 
    231                 } 
    232  
    233                 // lookup result is not OK, return the cached result 
    234                 else if (!cancelled && cachedResult != null) 
    235                 { 
    236                     // return the cached result, but set the status to the status of the actual lookup 
    237                     // so that the user will know why they are seeing the cached results 
    238                     complete = true; 
    239                     cachedResult.TxtStatus = lookupResult.TxtStatus; 
    240                     cachedResult.NaptrStatus = lookupResult.NaptrStatus; 
    241                     cachedResult.LocStatus = lookupResult.LocStatus; 
    242                     cachedResult.NInfoStatus = lookupResult.NInfoStatus; 
    243                     completeListener.LookupTelnameComplete(cachedResult); 
    244                 } 
    245                 else if (!cancelled) 
    246                 { 
    247                     completeListener.LookupTelnameComplete(lookupResult); 
    248                 } 
    249             } 
    250         } 
     204                int version = GetVersion(publicTelname); 
     205 
     206                if (version < version_change) 
     207                { 
     208                    Logger.Log(Logger.Section.Lookups, "version " + version ); 
     209                    if (publicTelname == telname) 
     210                    { 
     211                        Logger.Log(Logger.Section.Lookups, "public"); 
     212                        DoVersionOneLookupAndCache(publicTelname); 
     213                    } 
     214                    else 
     215                    { 
     216                        Logger.Log(Logger.Section.Lookups, "private "); 
     217                        DoVersionOneLookupAndCachePrivate(publicTelname, telname); 
     218                    } 
     219                } 
     220                else 
     221                { 
     222                    Logger.Log(Logger.Section.Lookups, "version " + version); 
     223                    DoLookupAndCache(publicTelname, telname); 
     224                } 
     225 
     226            } 
     227        } 
     228 
     229        /// <summary> 
     230        /// Performs both public and private lookup and caching for version 1.1 onwards 
     231        /// </summary> 
     232        /// <param name="publicTelname">the public telname</param> 
     233        /// <param name="telname">the private telname</param> 
     234        private void DoLookupAndCache(string publicTelname, string telname) 
     235        { 
     236             // do txt and naptr lookups in separate threads 
     237            performTxtLookup(telname); 
     238            performLocLookup(telname); 
     239            performNaptrLookup(telname); 
     240            performNInfoLookup(telname); 
     241            performKeywordLookup("_kw." + publicTelname); 
     242             
     243            // wait for those threads to finish 
     244            naptrThread.Join(); 
     245            locThread.Join(); 
     246            txtThread.Join(); 
     247            nInfoThread.Join(); 
     248            keywordThread.Join(); 
     249 
     250            Logger.Log(Logger.Section.Lookups, "Lookup threads finished for " + telname); 
     251            Logger.Log(Logger.Section.Lookups, "NAPTR Status: " + lookupResult.NaptrStatus); 
     252            Logger.Log(Logger.Section.Lookups, "LOC Status: " + lookupResult.LocStatus); 
     253            Logger.Log(Logger.Section.Lookups, "TXT Status: " + lookupResult.TxtStatus); 
     254            Logger.Log(Logger.Section.Lookups, "NInfo Status: " + lookupResult.NInfoStatus); 
     255            Logger.Log(Logger.Section.Lookups, "Keyword Status: " + lookupResult.KeywordStatus); 
     256            Logger.Log(Logger.Section.Lookups, "Version Status: " + lookupResult.VersionStatus); 
     257 
     258            // check if the lookup status was OK 
     259            if (!cancelled && lookupResult.LocStatus == LookupWorker.LookupStatus.Ok && 
     260                                    lookupResult.TxtStatus == LookupWorker.LookupStatus.Ok &&  
     261                                    lookupResult.NaptrStatus == LookupWorker.LookupStatus.Ok && 
     262                                    lookupResult.NInfoStatus == LookupWorker.LookupStatus.Ok && 
     263                                    lookupResult.KeywordStatus == LookupWorker.LookupStatus.Ok && 
     264                                    lookupResult.VersionStatus == LookupWorker.LookupStatus.Ok) 
     265            { 
     266                // store result in cache 
     267                LookupCache.SetResult(telname, lookupResult); 
     268                complete = true; 
     269                completeListener.LookupTelnameComplete(lookupResult); 
     270            } 
     271            // if the result was NXDomain then remove the cache! 
     272            else if (!cancelled && (lookupResult.NaptrStatus == LookupWorker.LookupStatus.Nxdomain ||  
     273                                    lookupResult.LocStatus == LookupWorker.LookupStatus.Nxdomain || 
     274                                    lookupResult.TxtStatus == LookupWorker.LookupStatus.Nxdomain || 
     275                                    lookupResult.KeywordStatus == LookupWorker.LookupStatus.Nxdomain || 
     276                                    lookupResult.VersionStatus == LookupWorker.LookupStatus.Nxdomain || 
     277                                    lookupResult.NInfoStatus == LookupWorker.LookupStatus.Nxdomain)) 
     278            { 
     279                LookupCache.RemoveResult(telname); 
     280                complete = true; 
     281                completeListener.LookupTelnameComplete(lookupResult); 
     282            } 
     283            // lookup result is not OK, return the cached result 
     284            else if (!cancelled && cachedResult != null) 
     285            { 
     286                // return the cached result, but set the status to the status of the actual lookup 
     287                // so that the user will know why they are seeing the cached results 
     288                complete = true; 
     289                cachedResult.TxtStatus = lookupResult.TxtStatus; 
     290                cachedResult.NaptrStatus = lookupResult.NaptrStatus; 
     291                cachedResult.LocStatus = lookupResult.LocStatus; 
     292                cachedResult.NInfoStatus = lookupResult.NInfoStatus; 
     293                cachedResult.KeywordStatus = lookupResult.KeywordStatus; 
     294                cachedResult.VersionStatus = lookupResult.VersionStatus; 
     295                completeListener.LookupTelnameComplete(cachedResult); 
     296            } 
     297            else if (!cancelled) 
     298            { 
     299                completeListener.LookupTelnameComplete(lookupResult); 
     300            } 
     301        } 
     302 
     303        /// <summary> 
     304        /// Perform public lookup on version one 
     305        /// </summary> 
     306        /// <param name="publicTelname">the public telname</param> 
     307        private void DoVersionOneLookupAndCache(string publicTelname) 
     308        { 
     309            // do txt and naptr lookups in separate threads 
     310            performLocLookup(publicTelname); 
     311            performNaptrLookup(publicTelname); 
     312                    
     313            // wait for those threads to finish 
     314            naptrThread.Join(); 
     315            locThread.Join(); 
     316 
     317            Logger.Log(Logger.Section.Lookups, "Lookup threads finished for " + telname); 
     318            Logger.Log(Logger.Section.Lookups, "NAPTR Status: " + lookupResult.NaptrStatus); 
     319            Logger.Log(Logger.Section.Lookups, "LOC Status: " + lookupResult.LocStatus); 
     320                Logger.Log(Logger.Section.Lookups, "Version Status: " + lookupResult.VersionStatus); 
     321 
     322            // check if the lookup status was OK 
     323            if (!cancelled && lookupResult.LocStatus == LookupWorker.LookupStatus.Ok && 
     324                                     lookupResult.NaptrStatus == LookupWorker.LookupStatus.Ok && 
     325                                    lookupResult.VersionStatus == LookupWorker.LookupStatus.Ok) 
     326            { 
     327                // store result in cache 
     328                LookupCache.SetResult(telname, lookupResult); 
     329                complete = true; 
     330                completeListener.LookupTelnameComplete(lookupResult); 
     331            } 
     332            // if the result was NXDomain then remove the cache! 
     333            else if (!cancelled && (lookupResult.NaptrStatus == LookupWorker.LookupStatus.Nxdomain ||  
     334                                    lookupResult.LocStatus == LookupWorker.LookupStatus.Nxdomain || 
     335                                    lookupResult.VersionStatus == LookupWorker.LookupStatus.Nxdomain)) 
     336            { 
     337                LookupCache.RemoveResult(telname); 
     338                complete = true; 
     339                completeListener.LookupTelnameComplete(lookupResult); 
     340            } 
     341            // lookup result is not OK, return the cached result 
     342            else if (!cancelled && cachedResult != null) 
     343            { 
     344                // return the cached result, but set the status to the status of the actual lookup 
     345                // so that the user will know why they are seeing the cached results 
     346                complete = true; 
     347                cachedResult.TxtStatus = lookupResult.TxtStatus; 
     348                cachedResult.NaptrStatus = lookupResult.NaptrStatus; 
     349                cachedResult.LocStatus = lookupResult.LocStatus; 
     350                cachedResult.VersionStatus = lookupResult.VersionStatus; 
     351                completeListener.LookupTelnameComplete(cachedResult); 
     352            } 
     353            else if (!cancelled) 
     354            { 
     355                completeListener.LookupTelnameComplete(lookupResult); 
     356            } 
     357        } 
     358 
     359        /// <summary> 
     360        /// Performs private lookup on version 1 
     361        /// </summary> 
     362        /// <param name="publicTelname"> the public telname</param> 
     363        /// <param name="telname">the private telname</param> 
     364        private void DoVersionOneLookupAndCachePrivate(string publicTelname, string telname) 
     365        { 
     366            // do txt and naptr lookups in separate threads 
     367            performTxtLookup(telname); 
     368            performLocLookup(publicTelname); 
     369            performNaptrLookup(telname); 
     370 
     371            // wait for those threads to finish 
     372            naptrThread.Join(); 
     373            locThread.Join(); 
     374            txtThread.Join(); 
     375 
     376            Logger.Log(Logger.Section.Lookups, "Lookup threads finished for " + telname); 
     377            Logger.Log(Logger.Section.Lookups, "NAPTR Status: " + lookupResult.NaptrStatus); 
     378            Logger.Log(Logger.Section.Lookups, "LOC Status: " + lookupResult.LocStatus); 
     379            Logger.Log(Logger.Section.Lookups, "TXT Status: " + lookupResult.TxtStatus); 
     380            Logger.Log(Logger.Section.Lookups, "Version Status: " + lookupResult.VersionStatus); 
     381 
     382            // check if the lookup status was OK 
     383            if (!cancelled && lookupResult.LocStatus == LookupWorker.LookupStatus.Ok && 
     384                                    lookupResult.TxtStatus == LookupWorker.LookupStatus.Ok && 
     385                                    lookupResult.NaptrStatus == LookupWorker.LookupStatus.Ok && 
     386                                    lookupResult.VersionStatus == LookupWorker.LookupStatus.Ok) 
     387            { 
     388                // store result in cache 
     389                LookupCache.SetResult(telname, lookupResult); 
     390                complete = true; 
     391                completeListener.LookupTelnameComplete(lookupResult); 
     392            } 
     393            // if the result was NXDomain then remove the cache! 
     394            else if (!cancelled && (lookupResult.NaptrStatus == LookupWorker.LookupStatus.Nxdomain || 
     395                                    lookupResult.LocStatus == LookupWorker.LookupStatus.Nxdomain || 
     396                                    lookupResult.TxtStatus == LookupWorker.LookupStatus.Nxdomain || 
     397                                    lookupResult.VersionStatus == LookupWorker.LookupStatus.Nxdomain)) 
     398            { 
     399                LookupCache.RemoveResult(telname); 
     400                complete = true; 
     401                completeListener.LookupTelnameComplete(lookupResult); 
     402            } 
     403            // lookup result is not OK, return the cached result 
     404            else if (!cancelled && cachedResult != null) 
     405            { 
     406                // return the cached result, but set the status to the status of the actual lookup 
     407                // so that the user will know why they are seeing the cached results 
     408                complete = true; 
     409                cachedResult.TxtStatus = lookupResult.TxtStatus; 
     410                cachedResult.NaptrStatus = lookupResult.NaptrStatus; 
     411                cachedResult.LocStatus = lookupResult.LocStatus; 
     412                cachedResult.VersionStatus = lookupResult.VersionStatus; 
     413                completeListener.LookupTelnameComplete(cachedResult); 
     414            } 
     415            else if (!cancelled) 
     416            { 
     417                completeListener.LookupTelnameComplete(lookupResult); 
     418            } 
     419        } 
     420 
    251421 
    252422 
     
    260430            if (!cancelled) 
    261431            { 
    262                 lwNaptr = new LookupWorker(telnameVal, DNS.DnsQueryType.Naptr, address, port); 
     432                lwNaptr = new LookupWorker(telnameVal, DNS.DnsQueryType.Naptr, address, port, TelnicLookupType.Naptr); 
    263433            } 
    264434            if (!cancelled) 
     
    283453            if (!cancelled) 
    284454            { 
    285                 lwLoc = new LookupWorker(telnameVal, DNS.DnsQueryType.Loc, address, port); 
     455                lwLoc = new LookupWorker(telnameVal, DNS.DnsQueryType.Loc, address, port, TelnicLookupType.Location); 
    286456            } 
    287457            if (!cancelled) 
     
    306476            if (!cancelled) 
    307477            { 
    308                 lwTxt = new LookupWorker(telnameVal, DNS.DnsQueryType.Txt, address, port); 
     478                lwTxt = new LookupWorker(telnameVal, DNS.DnsQueryType.Txt, address, port, TelnicLookupType.LongLabelAndServiceMessage); 
    309479            } 
    310480            if (!cancelled) 
     
    321491        } 
    322492 
     493 
     494        /// <summary> Perform Version lookup. 
     495        ///  
     496        /// </summary> 
     497        /// <param name="telname">the telname 
     498        /// </param> 
     499        private void performVersionLookup(string telnameVal) 
     500        { 
     501            if (!cancelled) 
     502            { 
     503                lwVersion = new LookupWorker(telnameVal, DNS.DnsQueryType.Txt, address, port, TelnicLookupType.Version); 
     504            } 
     505            if (!cancelled) 
     506            { 
     507                lwVersion.LookupWorkerCompletedListener = this; 
     508            } 
     509            if (!cancelled) 
     510            { 
     511                versionThread = new Thread(lwVersion.Run); 
     512                versionThread.Name = "Version Thread"; 
     513                versionThread.Start(); 
     514            } 
     515        } 
     516 
     517        /// <summary> 
     518        /// Perform Ninfo Lookup 
     519        /// </summary> 
     520        /// <param name="telnameVal"> the telname</param> 
    323521        private void performNInfoLookup(string telnameVal) 
    324522        { 
    325523            if (!cancelled) 
    326524            { 
    327                 lwNInfo = new LookupWorker(telnameVal, DNS.DnsQueryType.Ninfo, address, port); 
     525                lwNInfo = new LookupWorker(telnameVal, DNS.DnsQueryType.Ninfo, address, port, TelnicLookupType.HeaderText); 
    328526            } 
    329527            if (!cancelled) 
     
    341539 
    342540        /// <summary> 
     541        /// Perform keyword lookup 
     542        /// </summary> 
     543        /// <param name="telnameVal">the telname</param> 
     544        private void performKeywordLookup(string telnameVal) 
     545        { 
     546            if (!cancelled) 
     547            { 
     548                lwKeyword = new LookupWorker(telnameVal, DNS.DnsQueryType.Txt, address, port, TelnicLookupType.Keyword); 
     549            } 
     550            if (!cancelled) 
     551            { 
     552                lwKeyword.LookupWorkerCompletedListener = this; 
     553            } 
     554            if (!cancelled) 
     555            { 
     556                keywordThread = new Thread(lwKeyword.Run); 
     557                keywordThread.Name = "Keyword Thread"; 
     558                keywordThread.Start(); 
     559 
     560            } 
     561        } 
     562 
     563        /// <summary> 
    343564        /// Adds the results to the lookup results according to the type of the query 
    344565        /// </summary> 
     
    346567        /// <param name="type">The type of lookup performed</param> 
    347568        /// <param name="answers"></param> 
    348         public virtual void lookupWorkerCompleted(LookupWorker.LookupStatus statusVal, DNS.DnsQueryType type, System.Collections.ArrayList answers) 
     569        public virtual void lookupWorkerCompleted(LookupWorker.LookupStatus statusVal, DNS.DnsQueryType type, System.Collections.ArrayList answers, TelnicLookupType telnicType) 
    349570        { 
    350571            if (type == DNS.DnsQueryType.Txt) 
    351572            { 
    352                 if (statusVal == LookupWorker.LookupStatus.Ok) 
    353                 { 
    354                     lookupResult.TxtRecords = answers; 
     573                if (telnicType == TelnicLookupType.Keyword) 
     574                { 
     575                    if (statusVal == LookupWorker.LookupStatus.Ok) 
     576                    { 
     577                        lookupResult.KeywordRecords = answers; 
     578                    } 
     579                    else 
     580                    { 
     581                        lookupResult.KeywordRecords = new System.Collections.ArrayList(); 
     582                    } 
     583 
     584                    lookupResult.KeywordStatus = statusVal; 
     585                    return; 
     586                } 
     587                else if (telnicType == TelnicLookupType.Version) 
     588                { 
     589                    if (statusVal == LookupWorker.LookupStatus.Ok) 
     590                    { 
     591                        lookupResult.VersionRecords = answers; 
     592                    } 
     593                    else 
     594                    { 
     595                        lookupResult.VersionRecords = new System.Collections.ArrayList(); 
     596                    } 
     597 
     598                    lookupResult.VersionStatus = statusVal; 
     599                    return; 
    355600                } 
    356601                else 
    357602                { 
    358                     lookupResult.TxtRecords = new System.Collections.ArrayList(); 
    359                 } 
    360  
    361                 lookupResult.TxtStatus = statusVal; 
    362                 return; 
     603                    if (statusVal == LookupWorker.LookupStatus.Ok) 
     604                    { 
     605                        lookupResult.TxtRecords = answers; 
     606                    } 
     607                    else 
     608                    { 
     609                        lookupResult.TxtRecords = new System.Collections.ArrayList(); 
     610                    } 
     611 
     612                    lookupResult.TxtStatus = statusVal; 
     613                    return; 
     614                } 
    363615            } 
    364616            else if (type == DNS.DnsQueryType.Loc) 
     
    429681                lwNInfo = null; 
    430682            } 
     683            if (lwKeyword != null) 
     684            { 
     685                lwKeyword = null; 
     686            } 
     687            if (lwVersion != null) 
     688            { 
     689                lwVersion = null; 
     690            } 
    431691 
    432692            this.status = STATUS_CANCELLED; 
     
    436696            } 
    437697        } 
     698 
     699        /// <summary> 
     700        /// Do a public text lookup to get the pddx version to decide what further lookups to do 
     701        /// </summary> 
     702        /// <param name="telname">the public telname</param> 
     703        /// <returns>the pddx version eg "1" or "11"</returns> 
     704        private int GetVersion(string telname) 
     705        { 
     706            performVersionLookup(telname); 
     707            versionThread.Join(); 
     708            Logger.Log(Logger.Section.Lookups, "Version Status: " + lookupResult.VersionStatus); 
     709            if (lookupResult.VersionStatus == LookupWorker.LookupStatus.Ok) 
     710            { 
     711                Logger.Log(Logger.Section.Lookups, "PDDX Version (in getVersion) is: " + lookupResult.PddxVersion); 
     712                string pddx = lookupResult.PddxVersion; 
     713                if (pddx.Length == 1) 
     714                    pddx = pddx + "0"; 
     715                try 
     716                { 
     717                    return int.Parse(pddx); 
     718                } 
     719                catch (Exception e) 
     720                { 
     721                    return version_change; 
     722                } 
     723 
     724            } 
     725            return version_change; 
     726        } 
    438727    } 
    439728} 
  • apps/outlook/branches/1.6/DotTel/ThisAddIn.cs

    r493 r646  
    9191            get 
    9292            { 
    93                 return "1.4"; 
     93                return "1.6"; 
    9494            } 
    9595        } 
Telnic
Search This Site
Partners
Neustar
ICANN
Main site | WHOIS | Sell .tel | FAQ | Archived Site | About Telnic | Contact Us