Lines Matching refs:mp
90 show_msg(struct message *mp) in show_msg() argument
92 if (mp == NULL) in show_msg()
100 mp->m_index, mp, in show_msg()
101 mp->m_flink, mp->m_blink, mp->m_clink, mp->m_plink, in show_msg()
102 mp->m_depth, mp->m_flag); in show_msg()
108 show_thread(struct message *mp) in show_thread() argument
111 for (/*EMPTY*/; mp; mp = next_message(mp)) in show_thread()
112 show_msg(mp); in show_thread()
137 is_tagged_core(struct message *mp) in is_tagged_core() argument
142 for (/*EMPTY*/; mp; mp = mp->m_flink) in is_tagged_core()
143 if ((mp->m_flag & MTAGGED) == 0 || in is_tagged_core()
144 is_tagged_core(mp->m_clink) == 0) in is_tagged_core()
150 is_tagged(struct message *mp) in is_tagged() argument
152 return mp->m_flag & MTAGGED && is_tagged_core(mp->m_clink); in is_tagged()
161 has_parent(struct message *mp) in has_parent() argument
163 return mp->m_plink != NULL && in has_parent()
164 mp->m_plink->m_clink != current_thread.t_head; in has_parent()
168 next_message1(struct message *mp) in next_message1() argument
170 if (mp == NULL) in next_message1()
174 return mp->m_flink; in next_message1()
176 if (mp->m_clink) in next_message1()
177 return mp->m_clink; in next_message1()
179 while (mp->m_flink == NULL && has_parent(mp)) in next_message1()
180 mp = mp->m_plink; in next_message1()
182 return mp->m_flink; in next_message1()
186 prev_message1(struct message *mp) in prev_message1() argument
188 if (mp == NULL) in prev_message1()
191 if (S_IS_EXPOSE(state) && mp->m_blink == NULL && has_parent(mp)) in prev_message1()
192 return mp->m_plink; in prev_message1()
194 return mp->m_blink; in prev_message1()
198 next_message(struct message *mp) in next_message() argument
201 return next_message1(mp); in next_message()
203 while ((mp = next_message1(mp)) != NULL && is_tagged(mp)) in next_message()
206 return mp; in next_message()
210 prev_message(struct message *mp) in prev_message() argument
213 return prev_message1(mp); in prev_message()
215 while ((mp = prev_message1(mp)) != NULL && is_tagged(mp)) in prev_message()
218 return mp; in prev_message()
222 first_message(struct message *mp) in first_message() argument
224 if (S_IS_RESTRICT(state) && is_tagged(mp)) in first_message()
225 mp = next_message(mp); in first_message()
226 return mp; in first_message()
232 struct message *mp; in get_message() local
236 mp = current_thread.t_msgtbl[msgnum - 1]; in get_message()
237 assert(mp->m_index == msgnum); in get_message()
238 return mp; in get_message()
242 get_msgnum(struct message *mp) in get_msgnum() argument
244 return mp ? mp->m_index : 0; in get_msgnum()
269 next_abs_message(struct message *mp) in next_abs_message() argument
273 i = (int)(mp - message_array.t_head); in next_abs_message()
292 thread_recursion_flist(struct message *mp, int (*fn)(struct message *, void *), void *args) in thread_recursion_flist() argument
295 for (/*EMPTY*/; mp; mp = mp->m_flink) { in thread_recursion_flist()
296 if (S_IS_RESTRICT(state) && is_tagged(mp)) in thread_recursion_flist()
298 if ((retval = fn(mp, args)) != 0 || in thread_recursion_flist()
299 (retval = thread_recursion_flist(mp->m_clink, fn, args)) != 0) in thread_recursion_flist()
307 thread_recursion(struct message *mp, int (*fn)(struct message *, void *), void *args) in thread_recursion() argument
311 assert(mp != NULL); in thread_recursion()
313 if ((retval = fn(mp, args)) != 0) in thread_recursion()
317 (retval = thread_recursion_flist(mp->m_clink, fn, args)) != 0) in thread_recursion()
336 reindex_core(struct message *mp) in reindex_core() argument
339 assert(mp->m_blink == NULL); in reindex_core()
342 for (mp = first_message(mp); mp; mp = mp->m_flink) { in reindex_core()
343 assert(mp->m_flink == NULL || mp == mp->m_flink->m_blink); in reindex_core()
344 assert(mp->m_blink == NULL || mp == mp->m_blink->m_flink); in reindex_core()
346 assert(mp->m_size != 0); in reindex_core()
348 if (S_IS_RESTRICT(state) == 0 || !is_tagged(mp)) in reindex_core()
349 mp->m_index = ++i; in reindex_core()
351 if (mp->m_clink) in reindex_core()
352 (void)reindex_core(mp->m_clink); in reindex_core()
361 struct message *mp; in reindex() local
366 if ((mp = tp->t_head) == NULL || mp->m_size == 0) in reindex()
369 assert(mp->m_blink == NULL); in reindex()
380 for (mp = first_message(tp->t_head); mp; mp = next_message(mp)) in reindex()
381 mp->m_index = ++i; in reindex()
388 for (mp = first_message(tp->t_head); mp; mp = next_message(mp)) in reindex()
389 tp->t_msgtbl[i++] = mp; in reindex()
393 redepth_core(struct message *mp, int depth, struct message *parent) in redepth_core() argument
395 assert(mp->m_blink == NULL); in redepth_core()
399 for (/*EMPTY*/; mp; mp = mp->m_flink) { in redepth_core()
400 assert(mp->m_plink == parent); in redepth_core()
401 assert(mp->m_flink == NULL || mp == mp->m_flink->m_blink); in redepth_core()
402 assert(mp->m_blink == NULL || mp == mp->m_blink->m_flink); in redepth_core()
403 assert(mp->m_size != 0); in redepth_core()
405 mp->m_depth = depth; in redepth_core()
406 if (mp->m_clink) in redepth_core()
407 redepth_core(mp->m_clink, depth + 1, mp); in redepth_core()
415 struct message *mp; in redepth() local
419 if ((mp = thread->t_head) == NULL || mp->m_size == 0) in redepth()
422 depth = mp->m_plink ? mp->m_plink->m_depth + 1 : 0; in redepth()
429 for (tp = mp->m_plink; tp; tp = tp->m_plink) in redepth()
435 redepth_core(mp, depth, mp->m_plink); in redepth()
469 thread_init(struct thread_s *tp, struct message *mp, int msgCount) in thread_init() argument
478 tp->t_head = mp; in thread_init()
481 tp->t_msgtbl[i] = &mp[i]; in thread_init()
588 first_visible_message(struct message *mp) in first_visible_message() argument
592 if (mp == NULL) in first_visible_message()
593 mp = current_thread.t_head; in first_visible_message()
595 if (mp == NULL) in first_visible_message()
598 oldmp = mp; in first_visible_message()
599 if ((S_IS_RESTRICT(state) && is_tagged(mp)) || mp->m_flag & MDELETED) in first_visible_message()
600 mp = next_message(mp); in first_visible_message()
602 if (mp == NULL) { in first_visible_message()
603 mp = oldmp; in first_visible_message()
604 if ((S_IS_RESTRICT(state) && is_tagged(mp)) || mp->m_flag & MDELETED) in first_visible_message()
605 mp = prev_message(mp); in first_visible_message()
607 if (mp == NULL) in first_visible_message()
608 mp = current_thread.t_head; in first_visible_message()
610 return mp; in first_visible_message()
623 thread_top(struct message *mp) in thread_top() argument
625 while (mp && mp->m_plink) { in thread_top()
626 if (mp->m_plink->m_clink == current_thread.t_head) in thread_top()
628 mp = mp->m_plink; in thread_top()
630 return mp; in thread_top()
663 flattencmd_core(struct message *mp) in flattencmd_core() argument
671 if (mp == NULL) in flattencmd_core()
675 for (tp = next_message(mp); tp && tp->m_depth > mp->m_depth; tp = next_message(tp)) in flattencmd_core()
678 if (tp && tp->m_depth < mp->m_depth) in flattencmd_core()
687 tp = mp; in flattencmd_core()
692 mp->m_clink = NULL; in flattencmd_core()
694 marray[i]->m_depth = mp->m_depth; in flattencmd_core()
695 marray[i]->m_plink = mp->m_plink; in flattencmd_core()
719 struct message *mp; in flattencmd() local
720 mp = get_message(*ip); in flattencmd()
721 if (mp != NULL) in flattencmd()
722 flattencmd_core(mp); in flattencmd()
726 struct message *mp; in flattencmd() local
727 for (mp = first_message(current_thread.t_head); in flattencmd()
728 mp; mp = next_message(mp)) in flattencmd()
729 flattencmd_core(mp); in flattencmd()
745 struct message *mp; /* the message the following refer to */ member
787 marray[i].mp->m_index = (int)i + 1; in link_array()
788 marray[i].mp->m_blink = lastmp; in link_array()
789 marray[i].mp->m_flink = NULL; in link_array()
791 lastmp->m_flink = marray[i].mp; in link_array()
792 lastmp = marray[i].mp; in link_array()
795 current_thread.t_head->m_plink->m_clink = marray[0].mp; in link_array()
797 current_thread.t_head = marray[0].mp; in link_array()
806 assert(marray[beg].mp->m_clink == NULL); in cut_array()
808 marray[beg].mp->m_clink = marray[beg + 1].mp; in cut_array()
809 marray[beg + 1].mp->m_blink = NULL; in cut_array()
811 marray[beg].mp->m_flink = marray[end].mp; in cut_array()
812 if (marray[end].mp) in cut_array()
813 marray[end].mp->m_blink = marray[beg].mp; in cut_array()
815 marray[end - 1].mp->m_flink = NULL; in cut_array()
818 marray[i].mp->m_plink = marray[beg].mp; in cut_array()
830 parent = marray[0].mp->m_plink; in thread_array()
840 marray[i].mp->m_plink = parent; in thread_array()
841 marray[i].mp->m_clink = NULL; in thread_array()
909 get_parent_id(struct message *mp) in get_parent_id() argument
913 if ((refs = extract(hfield("references", mp), 0)) != NULL) { in get_parent_id()
923 return skin(hfield("in-reply-to", mp)); in get_parent_id()
931 thread_on_reference(struct message *mp) in thread_on_reference() argument
934 struct message *mp; in thread_on_reference() member
942 assert(mp == current_thread.t_head); in thread_on_reference()
960 marray[i].mp = mp; in thread_on_reference()
961 marray[i].message_id = skin(hfield("message-id", mp)); in thread_on_reference()
962 marray[i].parent_id = get_parent_id(mp); in thread_on_reference()
963 mp = next_message(mp); in thread_on_reference()
969 parent = marray[0].mp->m_plink; in thread_on_reference()
974 marray[0].mp->m_clink = NULL; in thread_on_reference()
976 marray[i].mp->m_depth = marray[0].mp->m_depth; in thread_on_reference()
977 marray[i].mp->m_plink = marray[0].mp->m_plink; in thread_on_reference()
978 marray[i].mp->m_clink = NULL; in thread_on_reference()
979 marray[i].mp->m_blink = marray[i - 1].mp; in thread_on_reference()
980 marray[i - 1].mp->m_flink = marray[i].mp; in thread_on_reference()
982 marray[i - 1].mp->m_flink = NULL; in thread_on_reference()
995 child = marray[i].mp; in thread_on_reference()
1023 adopt_child(marray[j].mp, child); in thread_on_reference()
1094 struct message *mp; in tagbelowcmd() local
1101 mp = get_message(*msgvec); in tagbelowcmd()
1102 if (mp) { in tagbelowcmd()
1103 depth = mp->m_depth; in tagbelowcmd()
1104 for (mp = first_message(current_thread.t_head); mp; mp = next_message(mp)) in tagbelowcmd()
1105 if (mp->m_depth > depth) { in tagbelowcmd()
1106 mp->m_flag |= MTAGGED; in tagbelowcmd()
1107 touch(mp); in tagbelowcmd()
1208 struct message *mp; in upcmd() local
1210 for (mp = parent; mp && mp->m_blink; mp = mp->m_blink) in upcmd()
1212 current_thread.t_head = mp; in upcmd()
1232 struct message *mp; in downcmd() local
1235 if ((mp = get_message(*msgvec)) == NULL || in downcmd()
1236 (child = mp->m_clink) == NULL) in downcmd()
1254 struct message *mp; in tsetcmd() local
1257 if ((mp = get_message(*msgvec)) == NULL) in tsetcmd()
1260 for (/*EMPTY*/; mp->m_blink; mp = mp->m_blink) in tsetcmd()
1262 current_thread.t_head = mp; in tsetcmd()
1277 struct message *mp; in reversecmd_core() local
1286 for (mp = thread_start; mp; mp = old_flink) { in reversecmd_core()
1287 old_flink = mp->m_flink; in reversecmd_core()
1288 mp->m_flink = mp->m_blink; in reversecmd_core()
1289 mp->m_blink = old_flink; in reversecmd_core()
1290 lastmp = mp; in reversecmd_core()
1435 field_load(struct key_sort_s *marray, size_t mcount, struct message *mp, in field_load() argument
1440 marray[i].mp = mp; in field_load()
1442 skin_it ? skin(hfield(key, mp)) : hfield(key, mp); in field_load()
1443 marray[i].index = mp->m_index; in field_load()
1444 mp = next_message(mp); in field_load()
1449 subj_load(struct key_sort_s *marray, size_t mcount, struct message *mp, in subj_load() argument
1458 char *subj = hfield(key, mp); in subj_load()
1461 marray[i].mp = mp; in subj_load()
1463 marray[i].index = mp->m_index; in subj_load()
1464 mp = next_message(mp); in subj_load()
1470 lines_load(struct key_sort_s *marray, size_t mcount, struct message *mp, in lines_load() argument
1486 marray[i].mp = mp; in lines_load()
1487 marray[i].key.lines = use_hlines ? mp->m_lines - mp->m_blines : in lines_load()
1488 use_blines ? mp->m_blines : mp->m_lines; in lines_load()
1489 marray[i].index = mp->m_index; in lines_load()
1490 mp = next_message(mp); in lines_load()
1495 size_load(struct key_sort_s *marray, size_t mcount, struct message *mp, in size_load() argument
1504 marray[i].mp = mp; in size_load()
1505 marray[i].key.size = mp->m_size; in size_load()
1506 marray[i].index = mp->m_index; in size_load()
1507 mp = next_message(mp); in size_load()
1512 date_load(struct key_sort_s *marray, size_t mcount, struct message *mp, in date_load() argument
1530 (void)dateof(&tm, mp, use_hl_date); in date_load()
1536 marray[i].mp = mp; in date_load()
1538 marray[i].index = mp->m_index; in date_load()
1539 mp = next_message(mp); in date_load()
1544 from_load(struct key_sort_s *marray, size_t mcount, struct message *mp, in from_load() argument
1553 marray[i].mp = mp; in from_load()
1554 marray[i].key.str = nameof(mp, 0); in from_load()
1555 marray[i].index = mp->m_index; in from_load()
1556 mp = next_message(mp); in from_load()
1715 struct message *mp; in deldupscmd() local
1725 for (mp = first_message(current_thread.t_head); mp; mp = next_message(mp)) { in deldupscmd()
1726 if (mp->m_depth > depth) { in deldupscmd()
1727 mp->m_flag &= ~(MPRESERVE | MSAVED | MBOX); in deldupscmd()
1728 mp->m_flag |= MDELETED | MTOUCH; in deldupscmd()
1729 touch(mp); in deldupscmd()