text
stringlengths
0
357
if (msg->state==DC_STATE_OUT_DRAFT)
{
lot->text1 = dc_stock_str(context, DC_STR_DRAFT);
lot->text1_meaning = DC_TEXT1_DRAFT;
}
else if (msg->from_id==DC_CONTACT_ID_SELF)
{
if (dc_msg_is_info(msg) || dc_chat_is_self_talk(chat)) {
lot->text1 = NULL;
lot->text1_meaning = 0;
}
else {
lot->text1 = dc_stock_str(context, DC_STR_SELF);
lot->text1_meaning = DC_TEXT1_SELF;
}
}
else if (chat==NULL)
{
lot->text1 = NULL;
lot->text1_meaning = 0;
}
else if (DC_CHAT_TYPE_IS_MULTI(chat->type))
{
if (dc_msg_is_info(msg) || contact==NULL) {
lot->text1 = NULL;
lot->text1_meaning = 0;
}
else {
// show full name for contact request, later on only the first name
if (chat!=NULL && chat->id==DC_CHAT_ID_DEADDROP) {
lot->text1 = dc_contact_get_display_name(contact);
}
else {
lot->text1 = dc_contact_get_first_name(contact);
}
lot->text1_meaning = DC_TEXT1_USERNAME;
}
}
lot->text2 = dc_msg_get_summarytext_by_raw(msg->type, msg->text, msg->param, DC_SUMMARY_CHARACTERS, context);
lot->timestamp = dc_msg_get_timestamp(msg);
lot->state = msg->state;
}
```
Filename: dc_mimefactory.c
```c
#include "dc_context.h"
#include "dc_mimefactory.h"
#include "dc_apeerstate.h"
#define LINEEND "\r\n" /* lineend used in IMF */
/*******************************************************************************
* Load data
******************************************************************************/
void dc_mimefactory_init(dc_mimefactory_t* factory, dc_context_t* context)
{
if (factory==NULL || context==NULL) {
return;
}
memset(factory, 0, sizeof(dc_mimefactory_t));
factory->context = context;
}
void dc_mimefactory_empty(dc_mimefactory_t* factory)
{
if (factory==NULL) {
return;
}
free(factory->from_addr);
factory->from_addr = NULL;
free(factory->from_displayname);
factory->from_displayname = NULL;
free(factory->selfstatus);
factory->selfstatus = NULL;
free(factory->rfc724_mid);
factory->rfc724_mid = NULL;
if (factory->recipients_names) {
clist_free_content(factory->recipients_names);
clist_free(factory->recipients_names);
factory->recipients_names = NULL;
}
if (factory->recipients_addr) {