Explorar el Código

get changes from deltachat-core

Jonas Reinsch hace 7 años
padre
commit
024d4eae04

+ 1 - 1
deltachat-ios/libraries/deltachat-core/src/main.c

@@ -108,7 +108,7 @@ static uintptr_t receive_event(mrmailbox_t* mailbox, int event, uintptr_t data1,
 
 int main(int argc, char ** argv)
 {
-	mrmailbox_t* mailbox = mrmailbox_new(receive_event, NULL);
+	mrmailbox_t* mailbox = mrmailbox_new(receive_event, NULL, "CLI");
 
 	mrmailbox_cmdline_skip_auth(mailbox); /* disable the need to enter the command `auth <password>` for all mailboxes. */
 

+ 4 - 2
deltachat-ios/libraries/deltachat-core/src/mrmailbox.c

@@ -876,7 +876,7 @@ static void cb_receive_imf(mrimap_t* imap, const char* imf_raw_not_terminated, s
 }
 
 
-mrmailbox_t* mrmailbox_new(mrmailboxcb_t cb, void* userData)
+mrmailbox_t* mrmailbox_new(mrmailboxcb_t cb, void* userdata, const char* os_name)
 {
 	mrmailbox_get_thread_index(); /* make sure, the main thread has the index #1, only for a nicer look of the logs */
 
@@ -892,9 +892,10 @@ mrmailbox_t* mrmailbox_new(mrmailboxcb_t cb, void* userData)
 
 	ths->m_sql      = mrsqlite3_new(ths);
 	ths->m_cb       = cb? cb : cb_dummy;
-	ths->m_userData = userData;
+	ths->m_userdata = userdata;
 	ths->m_imap     = mrimap_new(cb_get_config_int, cb_set_config_int, cb_receive_imf, (void*)ths, ths);
 	ths->m_smtp     = mrsmtp_new(ths);
+	ths->m_os_name  = safe_strdup(os_name);
 
 	mrjob_init_thread(ths);
 
@@ -946,6 +947,7 @@ void mrmailbox_unref(mrmailbox_t* ths)
 		free(ths->m_log_ringbuf[i]);
 	}
 
+	free(ths->m_os_name);
 	free(ths);
 
 	if( s_localize_mb_obj==ths ) {

+ 9 - 3
deltachat-ios/libraries/deltachat-core/src/mrmailbox.h

@@ -121,7 +121,9 @@ typedef struct mrmailbox_t
 	int              m_job_do_exit;
 
 	mrmailboxcb_t    m_cb;
-	void*            m_userData;
+	void*            m_userdata;
+
+	char*            m_os_name;
 
 	uint32_t         m_cmdline_sel_chat_id;
 
@@ -141,8 +143,12 @@ typedef struct mrmailbox_t
 
 /* mrmailbox_new() creates a new mailbox object.  After creation it is usually
 opened, connected and mails are fetched; see the corresponding functions below.
-After usage, the mailbox object must be freed using mrmailbox_unref(). */
-mrmailbox_t*         mrmailbox_new                  (mrmailboxcb_t, void* userData);
+The os name is only for decorative use and is shown eg. in the X-Mailer header
+in the form "Delta Chat <version> for <osName>" */
+mrmailbox_t*         mrmailbox_new                  (mrmailboxcb_t, void* userData, const char* osName);
+
+/* After usage, the mailbox object must be freed using mrmailbox_unref().
+If app runs can only be terminated by a forced kill, this may be superfluous. */
 void                 mrmailbox_unref                (mrmailbox_t*);
 
 

+ 3 - 1
deltachat-ios/libraries/deltachat-core/src/mrmimefactory.c

@@ -477,7 +477,9 @@ int mrmimefactory_render(mrmimefactory_t* factory, int encrypt_to_self)
 			references_list /* references */,
 			NULL /* subject set later */);
 
-		mailimf_fields_add(imf_fields, mailimf_field_new_custom(strdup("X-Mailer"), mr_mprintf("Delta Chat %i.%i.%i", MR_VERSION_MAJOR, MR_VERSION_MINOR, MR_VERSION_REVISION))); /* only informational, for debugging, may be removed in the release. Also do not rely on this as it may be removed by MTAs. */
+		mailimf_fields_add(imf_fields, mailimf_field_new_custom(strdup("X-Mailer"),
+			mr_mprintf("Delta Chat %i.%i.%i for %s", MR_VERSION_MAJOR, MR_VERSION_MINOR, MR_VERSION_REVISION, factory->m_mailbox->m_os_name))); /* only informational, for debugging, may be removed in the release. Also do not rely on this as it may be removed by MTAs. */
+
 		mailimf_fields_add(imf_fields, mailimf_field_new_custom(strdup("X-MrMsg"), strdup("1.0"))); /* mark message as being sent by a messenger */
 		if( factory->m_predecessor ) {
 			mailimf_fields_add(imf_fields, mailimf_field_new_custom(strdup("X-MrPredecessor"), strdup(factory->m_predecessor)));

+ 2 - 0
deltachat-ios/libraries/deltachat-core/src/mrmsg.h

@@ -104,6 +104,8 @@ char*         mrmsg_get_filename           (mrmsg_t*); /* returns base file name
 mrpoortext_t* mrmsg_get_mediainfo          (mrmsg_t*); /* returns real author (as text1, this is not always the sender, NULL if unknown) and title (text2, NULL if unknown) */
 int           mrmsg_is_increation          (mrmsg_t*);
 void          mrmsg_save_param_to_disk     (mrmsg_t*); /* can be used to add some additional, persistent information to a messages record */
+
+/* only sets the text field, MR_MSG_TEXT must be set additionally */
 void          mrmsg_set_text               (mrmsg_t*, const char* text);