mirror of https://github.com/djcb/mu.git
* mu_str_display_contact_s: split, so 'make cc10' is honored
This commit is contained in:
parent
ea544a9148
commit
6842c8c8a1
38
src/mu-str.c
38
src/mu-str.c
|
@ -164,6 +164,27 @@ mu_str_summarize (const char* str, size_t max_lines)
|
||||||
return summary;
|
return summary;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static void
|
||||||
|
cleanup_contact (char *contact)
|
||||||
|
{
|
||||||
|
char *c, *c2;
|
||||||
|
|
||||||
|
/* replace "'<> with space */
|
||||||
|
for (c2 = contact; *c2; ++c2)
|
||||||
|
if (*c2 == '"' || *c2 == '\'' || *c2 == '<' || *c2 == '>')
|
||||||
|
*c2 = ' ';
|
||||||
|
|
||||||
|
/* remove everything between '()' if it's after the 5th pos;
|
||||||
|
* good to cleanup corporate contact address spam... */
|
||||||
|
c = g_strstr_len (contact, -1, "(");
|
||||||
|
if (c && c - contact > 5)
|
||||||
|
*c = '\0';
|
||||||
|
|
||||||
|
g_strstrip (contact);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/* this is still somewhat simplistic... */
|
/* this is still somewhat simplistic... */
|
||||||
const char*
|
const char*
|
||||||
mu_str_display_contact_s (const char *str)
|
mu_str_display_contact_s (const char *str)
|
||||||
|
@ -185,22 +206,9 @@ mu_str_display_contact_s (const char *str)
|
||||||
* so we can remove the <... part*/
|
* so we can remove the <... part*/
|
||||||
*c = '\0';
|
*c = '\0';
|
||||||
}
|
}
|
||||||
|
|
||||||
/* replace "'<> with space */
|
|
||||||
for (c2 = contact; *c2; ++c2)
|
|
||||||
if (*c2 == '"' || *c2 == '\'' || *c2 == '<' || *c2 == '>')
|
|
||||||
*c2 = ' ';
|
|
||||||
|
|
||||||
/* FIXME: this breaks cc10 */
|
|
||||||
|
|
||||||
/* remove everything between '()' if it's after the 5th pos;
|
|
||||||
* good to cleanup corporate contact address spam... */
|
|
||||||
c = g_strstr_len (contact, -1, "(");
|
|
||||||
if (c && c - contact > 5)
|
|
||||||
*c = '\0';
|
|
||||||
|
|
||||||
g_strstrip (contact);
|
|
||||||
|
|
||||||
|
cleanup_contact (contact);
|
||||||
|
|
||||||
return contact;
|
return contact;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue