home *** CD-ROM | disk | FTP | other *** search
/ Tools / WinSN5.0Ver.iso / NETSCAP.50 / WIN1998.ZIP / ns / cmd / xfe / src / AddrBookView.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  1998-04-08  |  18.4 KB  |  755 lines

  1. /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
  2.  *
  3.  * The contents of this file are subject to the Netscape Public License
  4.  * Version 1.0 (the "NPL"); you may not use this file except in
  5.  * compliance with the NPL.  You may obtain a copy of the NPL at
  6.  * http://www.mozilla.org/NPL/
  7.  *
  8.  * Software distributed under the NPL is distributed on an "AS IS" basis,
  9.  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
  10.  * for the specific language governing rights and limitations under the
  11.  * NPL.
  12.  *
  13.  * The Initial Developer of this code under the NPL is Netscape
  14.  * Communications Corporation.  Portions created by Netscape are
  15.  * Copyright (C) 1998 Netscape Communications Corporation.  All Rights
  16.  * Reserved.
  17.  */
  18. /* 
  19.    AddrBookView.h -- view of user's mailfilters.
  20.    Created: Chris Toshok <toshok@netscape.com>, 29-Aug-96.
  21.    Revised: Tao Cheng <tao@netscape.com>, 01-nov-96
  22.  */
  23.  
  24. #include "AddrBookView.h"
  25. #include "AddrBookFrame.h"
  26.  
  27. #include "Xfe/Xfe.h"
  28.  
  29. #include "xpassert.h"
  30.  
  31. extern char *fe_conference_path;
  32.  
  33. extern "C" {
  34. #include "xfe.h"
  35. #include "outline.h"
  36. #include "addrbk.h"
  37.  
  38. XP_List* FE_GetDirServers();
  39. ABook*   fe_GetABook(MWContext *context);
  40. };
  41. extern "C" void 
  42. fe_showConference(Widget w, char *email, short use, char *coolAddr);
  43. extern "C" void 
  44. fe_showABCardPropertyDlg(Widget parent, MWContext *context, ABID entry, 
  45.                          XP_Bool newuser);
  46.  
  47. #include "xpgetstr.h"
  48.  
  49. extern int XFE_AB_HEADER_NAME;
  50. extern int XFE_AB_HEADER_CERTIFICATE;
  51. extern int XFE_AB_HEADER_EMAIL;
  52. extern int XFE_AB_HEADER_NICKNAME;
  53. extern int XFE_AB_HEADER_EMAIL;
  54. extern int XFE_AB_HEADER_COMPANY;
  55. extern int XFE_AB_HEADER_PHONE;
  56. extern int XFE_AB_HEADER_LOCALITY;
  57.  
  58. extern int MK_MSG_CALL_NEEDS_EMAILADDRESS;
  59. extern int XFE_PLACE_CONFERENCE_CALL_TO;
  60. extern int XFE_SEND_MSG_TO;
  61.  
  62. #define ADDRESS_OUTLINER_GEOMETRY_PREF "addressbook.outliner_geometry"
  63.  
  64. #if !defined(EMPTY_STRVAL)
  65. #define EMPTY_STRVAL(value) \
  66.   (!(value) || !((value)->u.string) || !XP_STRLEN(((value)->u.string)))
  67.  
  68. #endif
  69.  
  70. // constructor
  71. XFE_AddrBookView::XFE_AddrBookView(XFE_Component *toplevel_component, 
  72.                                    Widget         parent, 
  73.                                    XFE_View      *parent_view,
  74.                                    MWContext     *context,
  75.                                    XP_List       *directories):
  76.     XFE_ABListSearchView(toplevel_component, 
  77.                          parent,
  78.                          parent_view, 
  79.                          context,
  80.                          directories){
  81.  
  82.   /* For outliner
  83.    */
  84.   int num_columns = OUTLINER_COLUMN_LAST;
  85.   static int column_widths[] = {3, 25, 25, 8, 8, 10, 12};
  86.   m_outliner = new XFE_Outliner("addressBookList",
  87.                                 this,
  88.                                 toplevel_component,
  89.                                 parent,
  90.                                 False, // constantSize
  91.                                 True,  // hasHeadings
  92.                                 num_columns,
  93.                                 num_columns-2,// num_visible 
  94.                                 column_widths,
  95.                                 ADDRESS_OUTLINER_GEOMETRY_PREF);
  96.  
  97.   m_outliner->setMultiSelectAllowed(True);
  98.   m_outliner->setHideColumnsAllowed(True);
  99.  
  100.   /* BEGIN_3P: XmLGrid
  101.    */
  102.   XtVaSetValues(m_outliner->getBaseWidget(),
  103.                 XmNselectionPolicy, XmSELECT_MULTIPLE_ROW,
  104.                 XtVaTypedArg, XmNblankBackground, XmRString, "white", 6,
  105.                 XmNvisibleRows, 15,
  106.                 NULL);
  107.   XtVaSetValues(m_outliner->getBaseWidget(),
  108.                 XmNcellDefaults, True,
  109.                 XtVaTypedArg, XmNcellBackground, XmRString, "white", 6,
  110.                 NULL);
  111.   /* END_3P: XmLGrid
  112.    */
  113.   // layout
  114.   layout();
  115.  
  116.   setBaseWidget(m_outliner->getBaseWidget());
  117.  
  118.   /* For property
  119.    */
  120.   CONTEXT_DATA(m_contextData)->abdata->outline = m_outliner->getBaseWidget();
  121. }
  122.  
  123. XFE_AddrBookView::~XFE_AddrBookView()
  124. {
  125. }
  126. //
  127.  
  128. // tooltips and doc string
  129. char *XFE_AddrBookView::getDocString(CommandType cmd)
  130. {
  131.     uint32 count = 0;
  132.     const int *indices = 0;
  133.     m_outliner->getSelection(&indices, (int *) &count);
  134.  
  135.     if (count > 0) {
  136.         char *names = 0;
  137.         char a_line[512];
  138.         a_line[0] = '\0';
  139.         int len = 0;
  140.         for (int i=0; i < count && len < 512; i++) {
  141.             /* Take the first one 
  142.              */
  143. #if defined(USE_ABCOM)
  144.             AB_AttributeValue *value = NULL;
  145.             int error = 
  146.                 AB_GetEntryAttributeForPane(m_pane,
  147.                                             (MSG_ViewIndex) indices[i],
  148.                                             AB_attribFullName,
  149.                                             &value);
  150.             XP_ASSERT(value && value->attrib == AB_attribFullName);
  151.  
  152.             XP_SAFE_SPRINTF(a_line, sizeof(a_line),
  153.                             "%s",
  154.                             value->u.string?value->u.string:"");
  155.             AB_FreeEntryAttributeValue(value);
  156. #else
  157.             ABID entry;        
  158.             entry = AB_GetEntryIDAt((AddressPane *) m_abPane, 
  159.                                     (uint32) indices[i]);
  160.             AB_GetFullName(m_dir, m_AddrBook, entry, a_line);
  161. #endif /* USE_ABCOM */
  162.             if (a_line) {
  163.                 len += XP_STRLEN(a_line);
  164.                 if (i)
  165.                     len += 2;
  166.  
  167.                 names = names?
  168.                     ((char *) XP_REALLOC(names, (len+1)*sizeof(char))):
  169.                     ((char *) XP_CALLOC(1+len, sizeof(char)));
  170.  
  171.                 if (i)
  172.                     names = XP_STRCAT(names, ", ");
  173.                 names = XP_STRCAT(names, a_line);            
  174.             }/* if */
  175.         }/* for i */
  176.  
  177.         char *cstr = 0;
  178.         if (cmd == xfeCmdComposeMessage ||
  179.             cmd == xfeCmdComposeMessageHTML ||
  180.             cmd == xfeCmdComposeMessagePlain) {
  181.             cstr = XP_STRDUP(XP_GetString(XFE_SEND_MSG_TO));    
  182.         } else if (cmd == xfeCmdABCall) {
  183.             cstr = XP_STRDUP(XP_GetString(XFE_PLACE_CONFERENCE_CALL_TO));
  184.         }
  185.         len += XP_STRLEN(cstr);
  186.         cstr = (char *) XP_REALLOC(cstr, (1+len)*sizeof(char));
  187.         cstr = (char *) XP_STRCAT(cstr, names);
  188.         return cstr;
  189.     }/* if */
  190.     return NULL;
  191. }
  192.  
  193. Boolean XFE_AddrBookView::isCommandSelected(CommandType cmd, 
  194.                                     void */* calldata */,
  195.                                     XFE_CommandInfo* /* i */)
  196. {
  197.  
  198.     /*     
  199.      *    XP_Bool AB_GetPaneSortedAscending(ABPane * pABookPane);
  200.      *    ABID AB_GetPaneSortedBy(ABPane * pABookPane);
  201.      */
  202.     ABID sortType = 0;
  203.  
  204.     if (cmd == xfeCmdABByType)
  205.         sortType = ABTypeEntry;
  206.     else if (cmd == xfeCmdABByName)
  207.         sortType = ABFullName;
  208.     else if (cmd == xfeCmdABByEmailAddress)
  209.         sortType = ABEmailAddress;
  210.     else if (cmd == xfeCmdABByCompany)
  211.         sortType = ABCompany;
  212.     else if (cmd == xfeCmdABByLocality)
  213.         sortType = ABLocality;
  214.     else if (cmd == xfeCmdABByNickName)
  215.         sortType = ABNickname;
  216.  
  217.     if (sortType > 0) {
  218.         if (sortType == getSortType())
  219.             return True;
  220.         return False;
  221.     }/* if */
  222.     else if ((cmd == xfeCmdSortAscending && isAscending())||
  223.              (cmd == xfeCmdSortDescending && !isAscending()))
  224.         return True;
  225.     return False;
  226. }
  227.  
  228. /* Methods for the outlinable interface.
  229.  */
  230. char *XFE_AddrBookView::getCellTipString(int row, int column)
  231. {
  232.     char *tmp = 0;
  233.     if (row < 0) {
  234.         /* header
  235.          */
  236.         tmp = getColumnHeaderText(column);
  237.     }/* if */
  238.     else {
  239.         ABID orgID = m_entryID;
  240.  
  241.         /* content 
  242.          */
  243. #if defined(USE_ABCOM)
  244.         int error = AB_GetABIDForIndex(m_pane,
  245.                                        (MSG_ViewIndex) row,
  246.                                        &m_entryID);
  247. #else
  248.         m_entryID = AB_GetEntryIDAt((AddressPane *) m_abPane, (uint32) row);
  249. #endif /* USE_ABCOM */
  250.         tmp = getColumnText(column);
  251.  
  252.         /* reset
  253.          */
  254.         m_entryID = orgID;
  255.     }/* else */
  256.  
  257.     if (tmp && 
  258.         (!m_outliner->isColTextFit(tmp, row, column)))
  259.         return tmp;
  260.  
  261.     return NULL;
  262. }
  263.  
  264. char *XFE_AddrBookView::getCellDocString(int /* row */, int /* column */)
  265. {
  266.     return NULL;
  267. }
  268.  
  269. char*
  270. XFE_AddrBookView::getColumnName(int column)
  271. {
  272.   switch (column) {
  273.     case OUTLINER_COLUMN_TYPE:    
  274.         return XP_GetString(XFE_AB_HEADER_NAME);
  275.     case OUTLINER_COLUMN_NAME:
  276.         return XP_GetString(XFE_AB_HEADER_NAME);
  277.     case OUTLINER_COLUMN_EMAIL:    
  278.         return XP_GetString(XFE_AB_HEADER_EMAIL);
  279.     case OUTLINER_COLUMN_PHONE:    
  280.         return XP_GetString(XFE_AB_HEADER_PHONE);
  281.     case OUTLINER_COLUMN_NICKNAME:    
  282.         return XP_GetString(XFE_AB_HEADER_NICKNAME);
  283.     case OUTLINER_COLUMN_COMPANY:    
  284.         return XP_GetString(XFE_AB_HEADER_COMPANY);
  285.     case OUTLINER_COLUMN_LOCALITY:    
  286.         return XP_GetString(XFE_AB_HEADER_LOCALITY);
  287.     default:            
  288.         XP_ASSERT(0); 
  289.         return 0;
  290.     }
  291. }
  292.  
  293. EOutlinerTextStyle XFE_AddrBookView::getColumnHeaderStyle(int column)
  294. {
  295.     ABID sortType = 0;
  296.     switch (column) {
  297.     case OUTLINER_COLUMN_TYPE:
  298.         sortType = ABTypeEntry;
  299.         break;
  300.         
  301.     case OUTLINER_COLUMN_NAME:
  302.         sortType = ABFullName;
  303.         break;
  304.         
  305.     case OUTLINER_COLUMN_EMAIL:
  306.         sortType = ABEmailAddress;
  307.         break;
  308.         
  309.     case OUTLINER_COLUMN_NICKNAME:
  310.         sortType = ABNickname;
  311.       break;
  312.       
  313.     case OUTLINER_COLUMN_COMPANY:
  314.         sortType = ABCompany;
  315.         break;
  316.         
  317.     case OUTLINER_COLUMN_LOCALITY:
  318.         sortType = ABLocality;
  319.         break;
  320.     }/* switch */
  321.     
  322.     if (sortType == getSortType())
  323.         return OUTLINER_Bold;
  324.     else
  325.         return OUTLINER_Default;
  326. }
  327.  
  328. /* Returns the text and/or icon to display at the top of the column.
  329.  */
  330. char*
  331. XFE_AddrBookView::getColumnHeaderText(int column)
  332. {
  333.  
  334.   char *tmp = 0;
  335.   switch (column) {
  336.   case OUTLINER_COLUMN_TYPE:
  337.     tmp = XP_STRDUP(" ");
  338.     break;
  339.  
  340.   case OUTLINER_COLUMN_NAME:
  341.     tmp = XP_GetString(XFE_AB_HEADER_NAME);
  342.     break;
  343.  
  344.   case OUTLINER_COLUMN_NICKNAME:
  345.     tmp = XP_GetString(XFE_AB_HEADER_NICKNAME);
  346.     break;
  347.  
  348.   case OUTLINER_COLUMN_EMAIL:
  349.     tmp = XP_GetString(XFE_AB_HEADER_EMAIL);
  350.     break;
  351.  
  352.   case OUTLINER_COLUMN_PHONE:
  353.     tmp = XP_GetString(XFE_AB_HEADER_PHONE);
  354.     break;
  355.  
  356.   case OUTLINER_COLUMN_COMPANY:
  357.     tmp = XP_GetString(XFE_AB_HEADER_COMPANY);
  358.     break;
  359.  
  360.   case OUTLINER_COLUMN_LOCALITY:
  361.     tmp = XP_GetString(XFE_AB_HEADER_LOCALITY);
  362.     break;
  363.  
  364.   }/* switch () */
  365.  
  366.   return tmp;
  367. }
  368.  
  369. char*
  370. XFE_AddrBookView::getColumnText(int column)
  371. {
  372.   static char a_line[AB_MAX_STRLEN];
  373.   a_line[0] = '\0';
  374. #if defined(USE_ABCOM)
  375.   AB_AttributeValue *value = 0;
  376.   AB_AttribID attrib = AB_attribEntryType;
  377.   XP_Bool isPhone = False;
  378.   switch (column) {
  379.   case OUTLINER_COLUMN_TYPE:
  380.       break;
  381.  
  382.   case OUTLINER_COLUMN_NAME:
  383.       attrib = AB_attribFullName; // shall be AB_attribDisplayName;
  384.       break;
  385.  
  386.   case OUTLINER_COLUMN_NICKNAME:
  387.       attrib = AB_attribNickName;
  388.       break;
  389.       
  390.   case OUTLINER_COLUMN_EMAIL:
  391.       attrib = AB_attribEmailAddress;
  392.       break;
  393.       
  394.   case OUTLINER_COLUMN_PHONE:
  395.       isPhone = True;
  396.       attrib = AB_attribWorkPhone;
  397.       break;
  398.  
  399.   case OUTLINER_COLUMN_COMPANY:
  400.       attrib = AB_attribCompanyName;
  401.       break;
  402.       
  403.   case OUTLINER_COLUMN_LOCALITY:
  404.        attrib = AB_attribLocality;
  405.       break;
  406.       
  407.   }/* switch () */
  408.   if (attrib != AB_attribEntryType) {
  409.       int error = AB_GetEntryAttribute(m_containerInfo, m_entryID, 
  410.                                        attrib, &value);
  411.  
  412.       if (isPhone && 
  413.           EMPTY_STRVAL(value)) {
  414.           error = AB_GetEntryAttribute(m_containerInfo, m_entryID, 
  415.                                        AB_attribHomePhone, &value);
  416.       }/* if */
  417.       XP_SAFE_SPRINTF(a_line, sizeof(a_line),
  418.                       "%s",
  419.                       EMPTY_STRVAL(value)?"":value->u.string);
  420.  
  421.       AB_FreeEntryAttributeValue(value);
  422.   }/* if */
  423. #else
  424.   switch (column) {
  425.   case OUTLINER_COLUMN_TYPE:
  426.     break;
  427.  
  428.   case OUTLINER_COLUMN_NAME:
  429.     AB_GetFullName(m_dir, m_AddrBook, m_entryID, a_line);
  430.     break;
  431.  
  432.   case OUTLINER_COLUMN_NICKNAME:
  433.     AB_GetNickname(m_dir, m_AddrBook, m_entryID, a_line);
  434.     break;
  435.  
  436.   case OUTLINER_COLUMN_EMAIL:
  437.     AB_GetEmailAddress(m_dir, m_AddrBook, m_entryID, a_line);
  438.     break;
  439.  
  440.   case OUTLINER_COLUMN_PHONE:
  441.     AB_GetWorkPhone(m_dir, m_AddrBook, m_entryID, a_line);
  442.     if (!a_line || !XP_STRLEN(a_line)) {
  443.         a_line[0] = '\0';
  444.         AB_GetHomePhone(m_dir, m_AddrBook, m_entryID, a_line);
  445.     }/* if */
  446.     break;
  447.  
  448.   case OUTLINER_COLUMN_COMPANY:
  449.     AB_GetCompanyName(m_dir, m_AddrBook, m_entryID, a_line);
  450.     break;
  451.  
  452.   case OUTLINER_COLUMN_LOCALITY:
  453.     AB_GetLocality(m_dir, m_AddrBook, m_entryID, a_line);
  454.     break;
  455.  
  456.   }/* switch () */
  457. #endif /* !USE_ABCOM */
  458.   return a_line;
  459. }
  460.  
  461. fe_icon*
  462. XFE_AddrBookView::getColumnIcon(int column)
  463. {
  464.   fe_icon *myIcon = 0;
  465.   switch (column) {
  466.   case OUTLINER_COLUMN_TYPE:
  467.     {
  468. #if defined(USE_ABCOM)
  469.         AB_EntryType type = getType(m_containerInfo, m_entryID);
  470.         if (type == AB_Person)
  471.             myIcon = &m_personIcon; /* shall call make/initialize icons */
  472.         else if (type == AB_MailingList)
  473.             myIcon = &m_listIcon;
  474. #else
  475.       ABID type;
  476.       AB_GetType(m_dir, m_AddrBook, m_entryID, &type);
  477.       if (type == ABTypePerson)
  478.     myIcon = &m_personIcon; /* shall call make/initialize icons */
  479.       else if (type == ABTypeList)
  480.     myIcon = &m_listIcon;
  481. #endif /* USE_ABCOM */
  482.     }
  483.     break;
  484.   }/* switch () */
  485.   return myIcon;
  486. }
  487.  
  488. void XFE_AddrBookView::clickHeader(const OutlineButtonFuncData *data)
  489. {
  490.   int column = data->column; 
  491.   int invalid = True;
  492. #if defined(USE_ABCOM)
  493.   switch (column) {
  494.     case OUTLINER_COLUMN_TYPE:
  495.       setSortType(AB_attribEntryType);
  496.       break;
  497.  
  498.     case OUTLINER_COLUMN_NAME:
  499.       setSortType(AB_attribFullName);
  500.       break;
  501.  
  502.     case OUTLINER_COLUMN_NICKNAME:
  503.       setSortType(AB_attribNickName);
  504.       break;
  505.  
  506.     case OUTLINER_COLUMN_EMAIL:
  507.       setSortType(AB_attribEmailAddress);
  508.       break;
  509.  
  510.     case OUTLINER_COLUMN_COMPANY:
  511.       setSortType(AB_attribCompanyName);
  512.       break;
  513.  
  514.     case OUTLINER_COLUMN_LOCALITY:
  515.       setSortType(AB_attribLocality);
  516.       break;
  517.     default:
  518.       invalid = False;
  519.     }/* switch() */
  520. #else
  521.   switch (column) {
  522.     case OUTLINER_COLUMN_TYPE:
  523.       setSortType(AB_SortByTypeCmd);
  524.       break;
  525.  
  526.     case OUTLINER_COLUMN_NAME:
  527.       setSortType(AB_SortByFullNameCmd);
  528.       break;
  529.  
  530.     case OUTLINER_COLUMN_NICKNAME:
  531.       setSortType(AB_SortByNickname);
  532.       break;
  533.  
  534.     case OUTLINER_COLUMN_EMAIL:
  535.       setSortType(AB_SortByEmailAddress);
  536.       break;
  537.  
  538.     case OUTLINER_COLUMN_COMPANY:
  539.       setSortType(AB_SortByCompanyName);
  540.       break;
  541.  
  542.     case OUTLINER_COLUMN_LOCALITY:
  543.       setSortType(AB_SortByLocality);
  544.       break;
  545.     default:
  546.       invalid = False;
  547.     }/* switch() */
  548. #endif /* USE_ABCOM */
  549.  
  550.   if (invalid)
  551.     m_outliner->invalidate();
  552. }
  553.  
  554. void XFE_AddrBookView::doubleClickBody(const OutlineButtonFuncData *data)
  555. {
  556. #if defined(USE_ABCOM)
  557.     editProperty();
  558. #else
  559.   int row = data->row;
  560.   ABID type, entry;
  561.  
  562.   entry = AB_GetEntryIDAt((AddressPane *) m_abPane, (uint32) row);
  563.     
  564.   if (entry == MSG_VIEWINDEXNONE) 
  565.     return;
  566.     
  567.   AB_GetType(m_dir, m_AddrBook, entry, &type);
  568.     
  569.   if (type == ABTypePerson)
  570.       /* Send tothis user
  571.        */
  572.     popupUserPropertyWindow(entry, False, False);
  573.   else
  574.     /* Send to this mail list
  575.      */
  576.     popupListPropertyWindow(entry, False, False);
  577. #endif /* USE_ABCOM */
  578. }
  579.  
  580.  
  581. void XFE_AddrBookView::abCall()
  582. {
  583.   int count = 0;
  584.   const int *indices = 0;
  585.   m_outliner->getSelection(&indices, &count);
  586.   if (count > 0 && indices) {
  587. #if defined(USE_ABCOM)
  588. #else
  589.       /* Take the first one 
  590.        */
  591.       ABID type;
  592.       ABID entry;
  593.       
  594.       entry = AB_GetEntryIDAt((AddressPane *) m_abPane, (uint32) indices[0]);
  595.     
  596.       if (entry == MSG_VIEWINDEXNONE) 
  597.           return;
  598.  
  599.       AB_GetType(m_dir, m_AddrBook, entry, &type);
  600.     
  601.       /* Select
  602.        */
  603.       if (type != ABTypePerson)
  604.           return;
  605.           
  606.       char a_line[AB_MAX_STRLEN];
  607.       a_line[0] = '\0';
  608.       
  609.       char cmdstr[AB_MAX_STRLEN];
  610.       cmdstr[0] = '\0';
  611.       char *email= NULL;
  612.  
  613.       if ((AB_GetEmailAddress(m_dir, m_AddrBook, entry, a_line) != MSG_VIEWINDEXNONE)&&
  614.           XP_STRLEN(a_line))
  615.           email = XP_STRDUP(a_line);
  616.       else {
  617.           /* Can not call w/o email
  618.            */
  619.           // Prompt the user to enter the email address
  620.           char tmp[128];
  621.           XP_SAFE_SPRINTF(tmp, sizeof(tmp),
  622.                           "%s",
  623.                           XP_GetString(MK_MSG_CALL_NEEDS_EMAILADDRESS));
  624.           fe_Message(m_contextData, tmp);
  625.           return;
  626.       }/* else */
  627.  
  628.       char *coolAddr = NULL;
  629.       if (AB_GetCoolAddress(m_dir, m_AddrBook, entry, a_line) != MSG_VIEWINDEXNONE)
  630.           coolAddr = XP_STRDUP(a_line);
  631.  
  632.       short use;
  633.       if (AB_GetUseServer(m_dir, m_AddrBook, entry, &use) == MSG_VIEWINDEXNONE)
  634.           /* Can't determine which mode; use default
  635.            */
  636.           use = kDefaultDLS;
  637.  
  638.       if (email && XP_STRLEN(email))
  639.           fe_showConference(getBaseWidget(), email, use, coolAddr);
  640.       else {
  641.           /* prompt user to enter email address for this person
  642.            */
  643.               char tmp[128];
  644.               XP_SAFE_SPRINTF(tmp, sizeof(tmp),
  645.                               "%s",
  646.                               XP_GetString(MK_MSG_CALL_NEEDS_EMAILADDRESS));
  647.               fe_Message(m_contextData, tmp);
  648.  
  649.       }/* else */
  650.       if (email)
  651.           XP_FREE((char *) email);
  652.       if (coolAddr)
  653.           XP_FREE((char *) coolAddr);
  654. #endif /* USE_ABCOM */
  655.   }/* if */
  656. }
  657.  
  658. void XFE_AddrBookView::abVCard()
  659. {
  660.     // Need to check if the user has created a card 
  661.     XFE_GlobalPrefs    *prefs = &fe_globalPrefs;
  662.  
  663.     PersonEntry  person;
  664.     ABook       *addr_book = fe_GetABook(0);
  665.     DIR_Server  *dir;
  666.     ABID         entry_id;
  667.  
  668.     person.Initialize();
  669.     person.pGivenName = ((prefs->real_name) && 
  670.                          (XP_STRLEN(prefs->real_name) > 0)) ?
  671.                          XP_STRDUP(prefs->real_name) : 0;
  672.     person.pEmailAddress = ((prefs->email_address) && 
  673.                             (XP_STRLEN(prefs->email_address) > 0)) ?
  674.                             XP_STRDUP(prefs->email_address) : 0;
  675.   
  676.     DIR_GetPersonalAddressBook(m_directories, &dir);
  677.  
  678.     if (dir) {
  679.         AB_GetEntryIDForPerson(dir, addr_book, &entry_id, &person);
  680.         fe_showABCardPropertyDlg(getToplevel()->getBaseWidget(), 
  681.                                  m_contextData,
  682.                                  entry_id,
  683.                                  (MSG_MESSAGEIDNONE != entry_id)?FALSE:TRUE);
  684.     }
  685.     person.CleanUp();
  686.  
  687. }
  688.  
  689. extern "C" void fe_AB_AllConnectionsComplete(MWContext *context)
  690. {
  691.   ABPane* pABookPane = context->fe.data->abdata->abpane;
  692.   if (pABookPane) {
  693.     AB_FinishSearch(pABookPane, context);
  694.     XFE_MNListView *list_view = 
  695.       (XFE_MNListView*) MSG_GetFEData((MSG_Pane *)pABookPane);
  696.     ((XFE_ABListSearchView *)list_view)->stopSearch();
  697.   }/* if */
  698. }
  699.  
  700. //
  701. extern "C" void fe_showConference(Widget w, char *email, 
  702.                                   short use, char *coolAddr)
  703. {
  704.     // Assume that conference is located at the same directory as netscape
  705.     XP_ASSERT(w);
  706.  
  707.     char execu[32];
  708.     XP_STRCPY(execu, fe_conference_path);
  709.  
  710. #if defined(IRIX)
  711.     pid_t mypid = fork();
  712. #else
  713.     pid_t mypid = vfork();
  714. #endif
  715.     if (mypid == 0) {
  716.  
  717.         close (ConnectionNumber(XtDisplay(w)));
  718.  
  719.         /* sports
  720.          * int execlp (const char *file, const char *arg0, ..., 
  721.          * int execvp (const char *file, char *const *argv);
  722.          * const char *argn, (char *)0);
  723.          */
  724.         if (email && 
  725.             XP_STRLEN(email)) {
  726.             if (use == kDefaultDLS ||
  727.                 !coolAddr || 
  728.                 XP_STRLEN(coolAddr) == 0) {
  729.                 execlp(execu, execu, 
  730.                        "-invite", email, 0);
  731.             }/* if */
  732.             else if (use == kSpecificDLS && 
  733.                      coolAddr && 
  734.                      XP_STRLEN(coolAddr)) {
  735.                 execlp(execu, execu, 
  736.                        "-invite", email, 
  737.                        "-server", coolAddr, 0);
  738.             }/* else */
  739.             else if (use == kHostOrIPAddress && 
  740.                      coolAddr && 
  741.                      XP_STRLEN(coolAddr)) {
  742.                 execlp(execu, execu, 
  743.                        "-invite", email, 
  744.                        "-direct", coolAddr, 0);
  745.             }/* else */
  746.         }/* if */
  747.         else
  748.             /* insufficient info to run
  749.              */
  750.             execlp(execu, execu, 0);
  751.  
  752.         _exit(0);
  753.     }/* if */
  754. }/* fe_showConference() */
  755.