Changeset 1714

Show
Ignore:
Timestamp:
03/09/07 18:03:05
Author:
pvanhoof
Message:

A few major API changes

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/libtinymail-camel/tny-camel-account.c

    r1713 r1714  
    5959tny_camel_account_matches_url_string_default (TnyAccount *self, const gchar *url_string) 
    6060{ 
    61         /* TODO implement */ 
    62         return FALSE; 
     61        TnyCamelAccountPriv *priv = TNY_CAMEL_ACCOUNT_GET_PRIVATE (self); 
     62        CamelException ex = CAMEL_EXCEPTION_INITIALISER; 
     63        CamelURL *in = NULL; 
     64        CamelURL *org = NULL; 
     65        gboolean retval = TRUE; 
     66 
     67        if (url_string) 
     68                camel_url_new (url_string, &ex); 
     69        else 
     70                return FALSE; 
     71 
     72        if (camel_exception_is_set (&ex) || !in) 
     73                return FALSE; 
     74 
     75        if (priv->url_string) 
     76                org = camel_url_new (priv->url_string, &ex); 
     77        else { 
     78                gchar *proto; 
     79                if (priv->proto == NULL) 
     80                        return FALSE; 
     81                proto = g_strdup_printf ("%s://", priv->proto);  
     82                org = camel_url_new (proto, &ex); 
     83                g_free (proto); 
     84                if (camel_exception_is_set (&ex) || !org) 
     85                        return FALSE; 
     86                camel_url_set_protocol (org, priv->proto);  
     87                if (priv->user) 
     88                        camel_url_set_user (org, priv->user); 
     89                camel_url_set_host (org, priv->host); 
     90                if (priv->port != -1) 
     91                        camel_url_set_port (org, (int)priv->port); 
     92        } 
     93 
     94        if (camel_exception_is_set (&ex) || !org) 
     95        { 
     96                if (in) 
     97                        camel_url_free (in); 
     98                if (org) 
     99                        camel_url_free (org); 
     100                return FALSE; 
     101        } 
     102 
     103        if (in && org && in->protocol && (org->protocol && strcmp (org->protocol, in->protocol) != 0)) 
     104                retval = FALSE; 
     105 
     106        if (in && org && in->user && (org->user && strcmp (org->user, in->user) != 0)) 
     107                retval = FALSE; 
     108 
     109        if (in && org && in->host && (org->host && strcmp (org->host, in->host) != 0)) 
     110                retval = FALSE; 
     111 
     112        if (in && org && in->port != -1 && (org->port != in->port)) 
     113                retval = FALSE; 
     114 
     115        if (org) 
     116                camel_url_free (org); 
     117 
     118        if (in) 
     119                camel_url_free (in); 
     120 
     121        return retval; 
    63122} 
    64123