예제 #1
0
static char *
get_misc_value (vc_component * vcard, const char *type_name)
{
  char *ret_val = NULL;
  vc_component *tmp_vc = NULL;

  if (NULL == type_name)
    {
      /* retrieve the default value of the address locality */
      tmp_vc = vc_get_next_by_name (vcard, VC_ADDRESS);
      ret_val = get_val_struct_part (vc_get_value (tmp_vc), ADR_LOCALITY);
    }
  else
    {
      tmp_vc = vc_get_next_by_name (vcard, type_name);
      ret_val = vc_get_value (tmp_vc);
    }

  ret_val = ret_val ? strdup (ret_val) : strdup (" ");

  return ret_val;
}
예제 #2
0
파일: view.c 프로젝트: coachshea/rolo
static void
view_org ()
{
  vc_component *vc = NULL;
  char *str = NULL;
  char *val = NULL;
  int x = 0;
  int y = 0;

  g_mode = VIEW_ORG;

  werase (sub);

  x = (COLS - strlen (HEADING_ORG_STRING)) / 2;
  y = 1;

  wattron (sub, A_UNDERLINE);
  mvwprintw (sub, y, x, HEADING_ORG_STRING);
  wstandend (sub);
  wmove (sub, 3, 0);

  vc = vc_get_next_by_name (g_v, VC_TITLE);
  val = vc_get_value (vc);
  wprintw (sub, "Title  : %s\n", val ? val : "");

  vc = vc_get_next_by_name (g_v, VC_ROLE);
  val = vc_get_value (vc);
  wprintw (sub, "Role   : %s\n", val ? val : "");

  wprintw (sub, "\n");

  vc = vc_get_next_by_name (g_v, VC_ORGANIZATION);
  val = vc_get_value (vc);

  str = get_val_struct_part (val, ORG_NAME);
  wprintw (sub, "Organization Name       : %s\n", str ? str : "");
  free (str);

  str = get_val_struct_part (val, ORG_UNIT_1);
  wprintw (sub, "Organizational Unit #1  : %s\n", str ? str : "");
  free (str);

  str = get_val_struct_part (val, ORG_UNIT_2);
  wprintw (sub, "Organizational Unit #2  : %s\n", str ? str : "");
  free (str);

  str = get_val_struct_part (val, ORG_UNIT_3);
  wprintw (sub, "Organizational Unit #3  : %s\n", str ? str : "");
  free (str);

  str = get_val_struct_part (val, ORG_UNIT_4);
  wprintw (sub, "Organizational Unit #4  : %s\n", str ? str : "");
  free (str);

  wprintw (sub, "\n");

  vc = vc_get_next_by_name (g_v, VC_LOGO);
  val = vc_get_value (vc);
  wprintw (sub, "Logo  : %s\n", val ? val : "");

  vc = vc_get_next_by_name (g_v, VC_AGENT);
  val = vc_get_value (vc);
  wprintw (sub, "Agent  : %s\n", val ? val : "");

  touchwin (win);
  wrefresh (sub);
  wrefresh (win);
}
예제 #3
0
파일: view.c 프로젝트: coachshea/rolo
static void
view_geo ()
{
  vc_component *vc = NULL;
  char *str = NULL;
  char *val = NULL;
  int x = 0;
  int y = 0;

  g_mode = VIEW_GEO;

  werase (sub);

  x = (COLS - strlen (HEADING_GEO_STRING)) / 2;
  y = 1;

  wattron (sub, A_UNDERLINE);
  mvwprintw (sub, y, x, HEADING_GEO_STRING);
  wstandend (sub);
  wmove (sub, 3, 0);

  vc = vc_get_next_by_name (g_v, VC_GEOGRAPHIC_POSITION);
  val = vc_get_value (vc);

  str = get_val_struct_part (val, GEO_LATITUDE);
  wprintw (sub, "Latitude   : %s\n", str ? str : "");
  free (str);

  str = get_val_struct_part (val, GEO_LONGITUDE);
  wprintw (sub, "Longitude  : %s\n", str ? str : "");
  free (str);

  wprintw (sub, "\n");
  vc = vc_get_next_by_name (g_v, VC_TIME_ZONE);
  val = vc_get_value (vc);
  wprintw (sub, "Time Zone  : %s\n", val ? val : "");

  wprintw (sub, "\n");

  vc = vc_get_next_by_name (g_v, VC_ADDRESS);
  val = vc_get_value (vc);

  str = get_val_struct_part (val, ADR_PO_BOX);
  wprintw (sub, "Post Office Box   : %s\n", str ? str : "");
  free (str);

  str = get_val_struct_part (val, ADR_EXT_ADDRESS);
  wprintw (sub, "Extended Address  : %s\n", str ? str : "");
  free (str);

  str = get_val_struct_part (val, ADR_STREET);
  wprintw (sub, "Street Address    : %s\n", str ? str : "");
  free (str);

  str = get_val_struct_part (val, ADR_LOCALITY);
  wprintw (sub, "Locality          : %s\n", str ? str : "");
  free (str);

  str = get_val_struct_part (val, ADR_REGION);
  wprintw (sub, "Region            : %s\n", str ? str : "");
  free (str);

  str = get_val_struct_part (val, ADR_POSTAL_CODE);
  wprintw (sub, "Postal Code       : %s\n", str ? str : "");
  free (str);

  str = get_val_struct_part (val, ADR_COUNTRY);
  wprintw (sub, "Country           : %s\n", str ? str : "");
  free (str);

  wprintw (sub, "\n");
  touchwin (win);
  wrefresh (sub);
  wrefresh (win);
}