-
-
Notifications
You must be signed in to change notification settings - Fork 100
change type of dc_msg_t.text to String #283
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,6 +9,7 @@ use mmime::mailmime_types_helper::*; | |
use mmime::mailmime_write_mem::*; | ||
use mmime::mmapstring::*; | ||
use mmime::other::*; | ||
use std::ptr; | ||
|
||
use crate::constants::*; | ||
use crate::context::Context; | ||
|
@@ -799,12 +800,17 @@ pub unsafe fn dc_mimefactory_render(mut factory: *mut dc_mimefactory_t) -> libc: | |
) | ||
} | ||
|
||
let mut final_text: *const libc::c_char = 0 as *const libc::c_char; | ||
if !placeholdertext.is_null() { | ||
final_text = placeholdertext | ||
} else if !(*msg).text.is_null() && 0 != *(*msg).text.offset(0isize) as libc::c_int { | ||
final_text = (*msg).text | ||
} | ||
let final_text = { | ||
if !placeholdertext.is_null() { | ||
to_string(placeholdertext) | ||
} else if let Some(ref text) = (*msg).text { | ||
text.clone() | ||
} else { | ||
"".into() | ||
} | ||
}; | ||
let final_text = CString::yolo(final_text); | ||
|
||
let footer: *mut libc::c_char = (*factory).selfstatus; | ||
message_text = dc_mprintf( | ||
b"%s%s%s%s%s\x00" as *const u8 as *const libc::c_char, | ||
|
@@ -813,12 +819,8 @@ pub unsafe fn dc_mimefactory_render(mut factory: *mut dc_mimefactory_t) -> libc: | |
} else { | ||
b"\x00" as *const u8 as *const libc::c_char | ||
}, | ||
if !final_text.is_null() { | ||
final_text | ||
} else { | ||
b"\x00" as *const u8 as *const libc::c_char | ||
}, | ||
if !final_text.is_null() | ||
final_text.as_ptr(), | ||
if final_text != CString::yolo("") | ||
&& !footer.is_null() | ||
&& 0 != *footer.offset(0isize) as libc::c_int | ||
{ | ||
|
@@ -1094,8 +1096,17 @@ unsafe fn get_subject( | |
) -> *mut libc::c_char { | ||
let context = (*chat).context; | ||
let ret: *mut libc::c_char; | ||
let raw_subject = | ||
dc_msg_get_summarytext_by_raw((*msg).type_0, (*msg).text, &mut (*msg).param, 32, context); | ||
|
||
let raw_subject = { | ||
let msgtext_c = (*msg) | ||
.text | ||
.as_ref() | ||
.map(|s| CString::yolo(String::as_str(s))); | ||
let msgtext_ptr = msgtext_c.map_or(ptr::null(), |s| s.as_ptr()); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oh, this is nice! I think there are a lot of places that simply do |
||
|
||
dc_msg_get_summarytext_by_raw((*msg).type_0, msgtext_ptr, &mut (*msg).param, 32, context) | ||
}; | ||
|
||
let fwd = if 0 != afwd_email { | ||
b"Fwd: \x00" as *const u8 as *const libc::c_char | ||
} else { | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.unwrap_or_default()
would be the same? Not that I mind.