⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 abook-opts.c

📁 一个功能全面的电子邮件客户端
💻 C
📖 第 1 页 / 共 2 页
字号:
/* TradeClient <http://tradeclient.sourceforge.net> * $Id: abook-opts.c,v 1.13 2001/03/20 22:19:33 ttabner Exp $ * * Copyright (C) 1999-2000 Bynari Inc. * Copyright (C) 2001 Project TradeClient * * LGPL * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU Library General Public License as published by * the Free Software Foundation; either version 2 of the License, or (at * your option) any later version. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Library * General Public License for more details. * * You should have received a copy of the GNU Library General Public License * along with this program; if not, write to the Free Software Foundation, * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */#include "abook-main.h"GList *abooks=NULL;QuestionFunc question_func=NULL;GtkSignalFunc about_func=NULL;void abook_set_question_func (QuestionFunc func) {  question_func=func;}void abook_set_about_func (GtkSignalFunc func) {  about_func=func;}void abook_do_nothing () {}GtkSignalFunc abook_get_about_func () {  if (about_func)     return about_func;  return GTK_SIGNAL_FUNC (abook_do_nothing);}void abook_question (char *question, char *explanation, GtkSignalFunc func, gpointer data) {  if (question_func) {    GtkWidget *widget=question_func (question, explanation, func, data);    gtk_widget_show (widget);  }	}GList *abook_first () {  return abooks;}Abook *abook_new () {   Abook *abook=(Abook *)calloc (1, sizeof (Abook));  abooks=g_list_append (abooks, abook);  return abook;}void abook_destroy (Abook *abook) {   GList *eseek, *gseek, *bseek;  Abook_entry *entry;  Abook_group *group;  g_return_if_fail (abook != NULL);	  for (eseek=abook->entrys;eseek;eseek=eseek->next) {    entry=(Abook_entry *)eseek->data;    for (bseek=entry->email;bseek;bseek=bseek->next) {      free (bseek->data);    }    g_list_free (entry->email);    entry->email=NULL;    abook_entry_free (entry);    free (entry);		  }	  g_list_free (abook->entrys);  abook->entrys=NULL;	  for (gseek=abook->groups;gseek;gseek=gseek->next) {    group=(Abook_group *)gseek->data;    if (group->name) free (group->name);    free (group);  }	  g_list_free (abook->groups);	  if (abook->name) free (abook->name);	  abooks=g_list_remove (abooks, abook);  free (abook);}void abook_destroy_all () {  GList *aseek, *eseek, *gseek, *bseek;  Abook *abook;  Abook_entry *entry;  Abook_group *group;  for (aseek=abooks;aseek;aseek=aseek->next) {    abook=(Abook *)aseek->data;    for (eseek=abook->entrys;eseek;eseek=eseek->next) {      entry=(Abook_entry *)eseek->data;      for (bseek=entry->email;bseek;bseek=bseek->next) {	free (bseek->data);      }      g_list_free (entry->email);      entry->email=NULL;      abook_entry_free (entry);      free (entry);		    }    g_list_free (abook->entrys);    abook->entrys=NULL;    for (gseek=abook->groups;gseek;gseek=gseek->next) {      group=(Abook_group *)gseek->data;      if (group->name) free (group->name);      if (group) free (group);    }    g_list_free (abook->groups);    if (abook->name) free (abook->name);    free (abook);		  }  g_list_free (abooks);}Abook *abook_seek_by_name (char *name) {   GList *seek;  Abook *abook;  for (seek=abooks;seek;seek=seek->next) {    abook=(Abook *)seek->data;    if (abook)      if (abook->name) 	if (strcmp (abook->name, name)==0) 	  return abook;  }  return NULL;}void abook_destroy_entries (Abook *abook) {  while (abook->entrys) {    abook_entry_destroy (abook, abook->entrys->data);  }	}voidabook_destroy_groups (Abook *abook){  while (abook->groups)    {      abook_group_destroy (abook, abook->groups->data);    }}void abook_entry_free (Abook_entry *entry) {  g_return_if_fail (entry != NULL);  if (entry->first) {     free (entry->first);    entry->first=NULL;  }  if (entry->last) {     free (entry->last);    entry->last=NULL;  }  if (entry->middle) {     free (entry->middle);    entry->middle=NULL;  }  if (entry->title) {     free (entry->title);    entry->title=NULL;  }  if (entry->nickname) {     free (entry->nickname);    entry->nickname=NULL;  }	if (entry->sex){		free (entry->sex);		entry->sex=NULL;	}  if (entry->hphone) {     free (entry->hphone);    entry->hphone=NULL;  }  if (entry->wphone) {     free (entry->wphone);    entry->wphone=NULL;  }  if (entry->mphone) {     free (entry->mphone);    entry->mphone=NULL;  }  if (entry->pager) {     free (entry->pager);    entry->pager=NULL;  }  if (entry->fax) {     free (entry->fax);    entry->fax=NULL;  }  if (entry->street) {     free (entry->street);    entry->street=NULL;  }  if (entry->webpage) {     free (entry->webpage);    entry->webpage=NULL;  }  if (entry->notes) {     free (entry->notes);    entry->notes=NULL;  }  if (entry->company) {     free (entry->company);    entry->company=NULL;  }  if (entry->position) {     free (entry->position);    entry->position=NULL;  }  if (entry->cstreet) {     free (entry->cstreet);    entry->cstreet=NULL;  }  if (entry->ccity) {     free (entry->ccity);    entry->ccity=NULL;  }  if (entry->cstate) {     free (entry->cstate);    entry->cstate=NULL;  }  if (entry->czip) {     free (entry->czip);    entry->czip=NULL;  }  if (entry->ccountry) {     free (entry->ccountry);    entry->ccountry=NULL;  }  if (entry->coffice) {     free (entry->coffice);    entry->coffice=NULL;  }  if (entry->cphone1) {     free (entry->cphone1);    entry->cphone1=NULL;  }  if (entry->cphone2) {     free (entry->cphone2);    entry->cphone2=NULL;  }  if (entry->cfax) {     free (entry->cfax);    entry->cfax=NULL;  }  if (entry->cpager) {     free (entry->cpager);    entry->cpager=NULL;  }  if (entry->cwebpage) {     free (entry->cwebpage);    entry->cwebpage=NULL;  }  if (entry->cassistant) {     free (entry->cassistant);    entry->cassistant=NULL;  }  if (entry->cmanager) {    free (entry->cmanager);    entry->cmanager=NULL;  }}Abook_entry *abook_entry_new (Abook *abook) {   Abook_entry *entry;  g_return_val_if_fail (abook != NULL, NULL);	  entry=(Abook_entry *)calloc (1, sizeof (Abook_entry));  abook->entrys=g_list_append (abook->entrys, entry);  return entry;}Abook_entry *abook_entry_seek_in_part (char *partial) {  GList *aseek;  GList *eseek;  GList *mseek;  Abook *abook;  Abook_entry *entry;  g_return_val_if_fail (partial != NULL, NULL);  for (aseek=abooks;aseek;aseek=aseek->next) {    abook=aseek->data;    for (eseek=abook->entrys;eseek;eseek=eseek->next) {      entry=eseek->data;      for (mseek=entry->email;mseek;mseek=mseek->next) {	if (strncasecmp ((char *)mseek->data, partial, strlen (partial))==0) {	  return entry;	}      }    }  }  return NULL;}char *abook_entry_seek_in_part2 (char *partial) {  GList *aseek;  GList *eseek;  GList *mseek;  Abook *abook;  Abook_entry *entry;  g_return_val_if_fail (partial != NULL, NULL);  if (strlen (partial)<=0)     return NULL;  for (aseek=abooks;aseek;aseek=aseek->next) {    abook=aseek->data;    for (eseek=abook->entrys;eseek;eseek=eseek->next) {      entry=eseek->data;      for (mseek=entry->email;mseek;mseek=mseek->next) {	if (strncasecmp ((char *)mseek->data, partial, strlen (partial))==0) {	  return (char *)mseek->data;	}      }    }  }  return NULL;}Abook_entry *abook_entry_seek_name_in_part (Abook *abook, char *partial) {  GList *eseek;  Abook_entry *entry;	char *tmp ;	g_return_val_if_fail (partial != NULL, NULL);	g_return_val_if_fail (abook != NULL, NULL);	tmp = (char *)calloc (1024, sizeof (char));  if (strlen (partial)<=0)     return NULL;  for (eseek=abook->entrys;eseek;eseek=eseek->next) {    entry=eseek->data;#if 0    format_name (tmp, entry->first, entry->last);#else    format_name (1024, tmp, entry->first, entry->last, entry->def_email);#endif    if (strncasecmp (tmp, partial, strlen (partial))==0) {      free (tmp);      return entry;    }  }	free( tmp ) ;  return NULL;}void abook_entry_edit (Abook_entry *entry, char *first, char *middle, char *last,                       char *title, char *nickname, char *sex, char *hphone, char *wphone,		       char *mphone, char *pager, char *fax, char *street,		       char *webpage,		       char *company, char *position,		       char *cstreet, char *ccity, char *cstate, char *czip, 		       char *ccountry, char *coffice, char *cphone1, 		       char *cphone2, char *cfax, char *cpager, char *cwebpage,		       char *cmanager, char *cassistant, char *notes) {  g_return_if_fail (entry != NULL);  abook_entry_free (entry);  if (first) entry->first=strdup (first);   if (middle) entry->middle=strdup (middle);  if (last) entry->last=strdup (last);  if (title) entry->title=strdup (title);  if (nickname) entry->nickname=strdup (nickname);  if (sex) entry->sex=strdup (sex);  if (hphone) entry->hphone=strdup (hphone);  if (wphone) entry->wphone=strdup (wphone);  if (mphone) entry->mphone=strdup (mphone);  if (pager) entry->pager=strdup (pager);  if (fax) entry->fax=strdup (fax);  if (street) entry->street=strdup (street);  if (webpage) entry->webpage=strdup (webpage);  if (notes) entry->notes=strdup (notes);  if (company) entry->company=strdup (company);  if (position) entry->position=strdup (position);  if (cstreet) entry->cstreet=strdup (cstreet);  if (ccity) entry->ccity=strdup (ccity);  if (cstate) entry->cstate=strdup (cstate);  if (czip) entry->czip=strdup (czip);  if (ccountry) entry->ccountry=strdup (ccountry);  if (coffice) entry->coffice=strdup (coffice);  if (cphone1) entry->cphone1=strdup (cphone1);  if (cphone2) entry->cphone2=strdup (cphone2);  if (cfax) entry->cfax=strdup (cfax);  if (cpager) entry->cpager=strdup (cpager);  if (cwebpage) entry->cwebpage=strdup (cwebpage);  if (cmanager) entry->cmanager=strdup (cmanager);  if (cassistant) entry->cassistant=strdup (cassistant);  abook_entry_dump (entry);}void abook_entry_destroy (Abook *abook, Abook_entry *entry) {   GList *bseek;  g_return_if_fail (entry != NULL);  if (!abook) {    abook=abook_entry_find_book (entry);  }  g_return_if_fail (abook != NULL);	  abook->entrys=g_list_remove  (abook->entrys, entry);  for (bseek=entry->email;bseek;bseek=bseek->next) {

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -