From ee4d38cae0ad415c7f1c649b0364e9170506545d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johan=20Sch=C3=B6n?= <js@opera.com> Date: Mon, 10 Apr 2000 13:47:43 +0200 Subject: [PATCH] Added support for retrieving author names etc from aux items Rev: lib/modules/Protocols.pmod/LysKOM.pmod/Threads.pike:1.5 --- .../Protocols.pmod/LysKOM.pmod/Threads.pike | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/lib/modules/Protocols.pmod/LysKOM.pmod/Threads.pike b/lib/modules/Protocols.pmod/LysKOM.pmod/Threads.pike index 8f6d77856e..980988090f 100644 --- a/lib/modules/Protocols.pmod/LysKOM.pmod/Threads.pike +++ b/lib/modules/Protocols.pmod/LysKOM.pmod/Threads.pike @@ -17,6 +17,23 @@ class Thread array(Node) children = ({ }); + string get_aux_item_author(object text) + { + string name, email; + if(sizeof(text->aux_items["mx-author"])) + name=text->aux_items["mx-author"][0]->data; + if(sizeof(text->aux_items["mx-from"])) + email=text->aux_items["mx-from"][0]->data; + if(name && email) + return sprintf("%s <%s>",name,email); + if(name) + return name; + if(email) + return email; + return 0; + } + + array(mapping) flatten(int depth) { string author_name; @@ -27,7 +44,7 @@ class Thread author_name="Deleted person"; return ({ ([ "no": (string)text->no, "author_no": (string)text->author->no, - "author_name":author_name, + "author_name":get_aux_item_author(text)||author_name, "subject": text->subject, "unread": (unread?"un":""), "depth": (string)depth ]), -- GitLab