fix bug 643638
This commit is contained in:
parent
8fa18fb744
commit
4fd905f07b
3 changed files with 30 additions and 4 deletions
|
@ -1,3 +1,11 @@
|
|||
2002-12-21 [paul] 0.8.6claws122
|
||||
|
||||
* src/addrbook.c
|
||||
fix bug [643638] where if a person is in one or more
|
||||
addressbook groups editing that person's email
|
||||
address results in removal from those groups.
|
||||
Patch submitted by Luke Plant.
|
||||
|
||||
2002-12-20 [christoph] 0.8.6claws121
|
||||
|
||||
* src/common/utils.c
|
||||
|
|
|
@ -11,7 +11,7 @@ MINOR_VERSION=8
|
|||
MICRO_VERSION=6
|
||||
INTERFACE_AGE=0
|
||||
BINARY_AGE=0
|
||||
EXTRA_VERSION=claws121
|
||||
EXTRA_VERSION=claws122
|
||||
VERSION=$MAJOR_VERSION.$MINOR_VERSION.$MICRO_VERSION$EXTRA_VERSION
|
||||
|
||||
dnl set $target
|
||||
|
|
|
@ -1214,19 +1214,24 @@ void addrbook_update_address_list(
|
|||
listGroup = addrcache_get_group_for_person( book->addressCache, person );
|
||||
if( listGroup ) {
|
||||
GHashTable *hashEMail;
|
||||
GHashTable *hashEMailAlias;
|
||||
GList *nodeGrp;
|
||||
|
||||
/* Load hash table with new address entries */
|
||||
hashEMail = g_hash_table_new( g_str_hash, g_str_equal );
|
||||
hashEMailAlias = g_hash_table_new( g_str_hash, g_str_equal );
|
||||
node = listEMail;
|
||||
while( node ) {
|
||||
ItemEMail *email = node->data;
|
||||
gchar *addr = g_strdup( email->address );
|
||||
|
||||
gchar *alias = email->obj.name ;
|
||||
g_strdown( addr );
|
||||
if( ! g_hash_table_lookup( hashEMail, addr ) ) {
|
||||
g_hash_table_insert( hashEMail, addr, email );
|
||||
}
|
||||
if ( *alias != '\0' && ! g_hash_table_lookup( hashEMailAlias, alias ) ) {
|
||||
g_hash_table_insert( hashEMailAlias, alias, email );
|
||||
}
|
||||
node = g_list_next( node );
|
||||
}
|
||||
|
||||
|
@ -1247,15 +1252,26 @@ void addrbook_update_address_list(
|
|||
/* Found an email address for this person */
|
||||
ItemEMail *emailNew = NULL;
|
||||
gchar *addr = g_strdup( emailGrp->address );
|
||||
|
||||
gchar *alias = emailGrp->obj.name;
|
||||
g_strdown( addr );
|
||||
emailNew = ( ItemEMail * )
|
||||
g_hash_table_lookup( hashEMail, addr );
|
||||
g_free( addr );
|
||||
/* If no match by e-mail, try to match by e-mail alias */
|
||||
if( ! emailNew && *alias != '\0' ) {
|
||||
emailNew = ( ItemEMail * )
|
||||
g_hash_table_lookup( hashEMailAlias, alias);
|
||||
}
|
||||
|
||||
if( emailNew ) {
|
||||
/* Point to this entry */
|
||||
nodeGrpEM->data = emailNew;
|
||||
}
|
||||
else if(g_hash_table_size(hashEMail)==1) {
|
||||
/* If the person has just one e-mail address, then
|
||||
change e-mail address in group list */
|
||||
nodeGrpEM->data = listEMail->data;
|
||||
}
|
||||
else {
|
||||
/* Mark for removal */
|
||||
listRemove = g_list_append( listRemove, emailGrp );
|
||||
|
@ -1285,6 +1301,8 @@ void addrbook_update_address_list(
|
|||
hashEMail, ( GHRFunc ) addrbook_free_simple_hash_vis, NULL );
|
||||
g_hash_table_destroy( hashEMail );
|
||||
hashEMail = NULL;
|
||||
g_hash_table_destroy( hashEMailAlias );
|
||||
hashEMailAlias = NULL;
|
||||
g_list_free( listGroup );
|
||||
listGroup = NULL;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue