aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorhiro <hiro@ee746299-78ed-0310-b773-934348b2243d>2007-07-11 06:45:46 +0000
committerhiro <hiro@ee746299-78ed-0310-b773-934348b2243d>2007-07-11 06:45:46 +0000
commit4acd459c3cd42a7cbde6f884cee2720537183452 (patch)
tree4b17b77d682a89889f912a9ad63355536a40acce /src
parent55dac1ad8c46dd9911566a4e46db1d67da0f8da7 (diff)
code cleanup.
git-svn-id: svn://sylpheed.sraoss.jp/sylpheed/trunk@1854 ee746299-78ed-0310-b773-934348b2243d
Diffstat (limited to 'src')
-rw-r--r--src/compose.c23
-rw-r--r--src/send_message.c23
2 files changed, 10 insertions, 36 deletions
diff --git a/src/compose.c b/src/compose.c
index 6c3bc116..28972cc4 100644
--- a/src/compose.c
+++ b/src/compose.c
@@ -1541,8 +1541,6 @@ static gint compose_parse_source_msg(Compose *compose, MsgInfo *msginfo)
gchar *str;
gchar buf[BUFFSIZE];
gint hnum;
- gchar *id;
- gchar *msg;
gint num;
gchar **paths;
gint i;
@@ -1564,35 +1562,24 @@ static gint compose_parse_source_msg(Compose *compose, MsgInfo *msginfo)
++str;
if ((hnum == H_X_SYLPHEED_REPLY || hnum == H_REP) &&
!compose->replyto) {
- id = g_path_get_dirname(str);
- msg = g_path_get_basename(str);
- num = to_number(msg);
- item = folder_find_item_from_identifier(id);
- g_print("folder id: %s (msg %d)\n", id, num);
- if (num > 0 && item) {
+ item = folder_find_item_and_num_from_id(str, &num);
+ if (item && num > 0) {
compose->replyinfo =
folder_item_get_msginfo(item, num);
}
- g_free(msg);
- g_free(id);
} else if (hnum == H_X_SYLPHEED_FORWARD || hnum == H_FWD) {
paths = g_strsplit(str, "\n", 0);
for (i = 0; paths[i] != NULL; i++) {
g_strstrip(paths[i]);
- id = g_path_get_dirname(paths[i]);
- msg = g_path_get_basename(paths[i]);
- num = to_number(msg);
- item = folder_find_item_from_identifier(id);
- g_print("folder id: %s (msg %d)\n", id, num);
- if (num > 0 && item) {
+ item = folder_find_item_and_num_from_id
+ (paths[i], &num);
+ if (item && num > 0) {
MsgInfo *msginfo;
msginfo = folder_item_get_msginfo
(item, num);
if (msginfo)
compose->forward_mlist = g_slist_append(compose->forward_mlist, msginfo);
}
- g_free(msg);
- g_free(id);
}
g_strfreev(paths);
}
diff --git a/src/send_message.c b/src/send_message.c
index 483f6126..a6b2e895 100644
--- a/src/send_message.c
+++ b/src/send_message.c
@@ -150,8 +150,6 @@ QueueInfo *send_get_queue_info(const gchar *file)
gchar buf[BUFFSIZE];
gint hnum;
QueueInfo *qinfo;
- gchar *id;
- gchar *msg;
gint num;
FolderItem *item;
MsgInfo *msginfo;
@@ -190,34 +188,23 @@ QueueInfo *send_get_queue_info(const gchar *file)
qinfo->ac = account_find_from_id(atoi(p));
break;
case Q_REPLY_TARGET:
- id = g_path_get_dirname(p);
- msg = g_path_get_basename(p);
- num = to_number(msg);
- item = folder_find_item_from_identifier(id);
- g_print("folder id: %s (msg %d)\n", id, num);
- if (num > 0 && item) {
+ item = folder_find_item_and_num_from_id(p, &num);
+ if (item && num > 0) {
qinfo->replyinfo =
procmsg_get_msginfo(item, num);
}
- g_free(msg);
- g_free(id);
break;
case Q_FORWARD_TARGETS:
paths = g_strsplit(p, "\n", 0);
for (i = 0; paths[i] != NULL; i++) {
g_strstrip(paths[i]);
- id = g_path_get_dirname(paths[i]);
- msg = g_path_get_basename(paths[i]);
- num = to_number(msg);
- item = folder_find_item_from_identifier(id);
- g_print("folder id: %s (msg %d)\n", id, num);
- if (num > 0 && item) {
+ item = folder_find_item_and_num_from_id
+ (paths[i], &num);
+ if (item && num > 0) {
msginfo = procmsg_get_msginfo(item, num);
if (msginfo)
qinfo->forward_mlist = g_slist_append(qinfo->forward_mlist, msginfo);
}
- g_free(msg);
- g_free(id);
}
g_strfreev(paths);
break;