Make Message-ID string generation less confusing.
[claws.git] / src / plugins / vcalendar / vcalendar.c
index 2a924e475353f45922cb071fed7b750f3572ffa6..576da832c078ec94f6775158e4847423ec9cceb6 100644 (file)
@@ -150,7 +150,7 @@ static void create_meeting_from_message_cb_ui(GtkAction *action, gpointer data)
                }
                
                if (fp) {
-                       gchar uid[256];
+                       gchar *uid;
                        time_t t = time(NULL);
                        time_t t2 = t+3600;
                        gchar *org = NULL;
@@ -179,22 +179,13 @@ static void create_meeting_from_message_cb_ui(GtkAction *action, gpointer data)
 
                        org = g_strdup(account->address);
 
-                       if (account->set_domain && account->domain) {
-                               g_snprintf(uid, sizeof(uid), "%s", account->domain); 
-                       } else if (!strncmp(get_domain_name(), "localhost", strlen("localhost"))) {
-                               g_snprintf(uid, sizeof(uid), "%s", 
-                                       strchr(account->address, '@') ?
-                                       strchr(account->address, '@')+1 :
-                                       account->address);
-                       } else {
-                               g_snprintf(uid, sizeof(uid), "%s", "");
-                       }
-                       generate_msgid(uid, 255, account->address);
+                       uid = prefs_account_generate_msgid(account);
                        
                        event = vcal_manager_new_event(uid,
                                        org, NULL, NULL/*location*/, summary, description, 
                                        dtstart, dtend, recur, tzid, url, method, sequence, 
                                        ICAL_VTODO_COMPONENT);
+                       g_free(uid);
                        
                        /* hack to get default hours */
                        g_free(event->dtstart);
@@ -217,7 +208,7 @@ bail:
                        g_free(url);
                }
 
-               procmsg_msginfo_free(msginfo);
+               procmsg_msginfo_free(&msginfo);
        }
 
        statusbar_progress_all(0,0,0);