TL;DR: Scroll to the end of this answer for the real tl;dr.
Oi, such a feature is quite localized, and I'm afraid there is no such thing.
But, I can bring you about two-thirds of a step closer to a custom-constructed chat log file.
1. We Need a Chat Log Converter
There is no longer any effective standardization of chat logs in the world today.
Pidgin chat logs are stored in libpurple's HTML format or a legacy plaintext format (warning: no software can interpret the TXT format accurately because message line breaks are not distinguished from line breaks within the message).
In order to write a program that satisfies your basic criteria:
- Collect all messages sent by you.
- Collect all messages that contain your name.
... the Pidgin HTML chat logs must be interpreted so that the software understands the difference between who sent the message and the message itself. This is the first step.
There is one living project that has come close to interpreting Pidgin HTML chat logs:
What Log2Log Can Do
Today, Log2Log v1.0.1 can read all the Pidgin HTML chat log files you have and convert them into one giant JSON array that is standardized with all the different bits of information separated (time, timezone, who the sender was, sender's alias, message contents, etc.)
Gee, this could be the answer to step 1, right?
What Log2Log Can't Do
The developer of Log2Log (surprise, it's me!) admits that many capabilities of the Pidgin HTML format have not been coded into the software, so Log2Log can't recognize them. The conversion process from Pidgin HTML to Log2Log's JSON format has not been tested before.
I'd say that Log2Log only gets step 1 done only 2/3 of the way. :(
Development for Log2Log hasn't continued very far due to a lack of interest. From a quick survey I did, it looks like most people don't even know what a chat log is.
Although this is written as an answer, I'd like to ask you, reader, a question.
Would you support the Log2Log Chat Log Converter project? If so, you can find my contact information in my Super User profile.
(Note that I'm not trying to spam Super User with a promotional advertisement. This is really how far we are in software chat log conversion today. Do a Google search for "chat log converter" if you don't believe me.)
2. The Software for Custom-Built Logs
Is there a plugin like that for pidgin?
Ahaha, there's no such thing. >:(
Not even beyond the scope of Pidgin. I've been looking for over a year now.
But the question didn't state that the software had to exist already.
What's the best way about scripting this? ... I'd also like to be able to click on lines to add.
OP's description seems very much like another project I had planning since 03 April 2011.
Loguntu Chat Log Manager
The plans for Loguntu have been revised and updated multiple times, but relevant to this question, its description includes comprehensive manipulation of each line in every chat log it manages.
Why Loguntu Doesn't Exist
Firstly and directly, I don't have the manpower to make this exist. It's way too much work for me alone, even just the part about selecting individual lines from chat logs.
Secondly, nobody cares or nobody wants this. Remember that I found that most people don't even know what a chat log is. No wonder nobody has made anything like Loguntu.
Loguntu Is the Last Step
The full blueprint of Loguntu is very comprehensive, and it covers everything that this question is asking for, and far more. If only it would exist...
TL;DR / Conclusion
TL;DR: I offer my help to make what is described in this question exist, except I would like to take it beyond the scope of Pidgin (not necessarily meaning that it doesn't start with Pidgin) as well.
Note: Simply having a Pidgin plugin may have drawbacks that are not visible at first. Essentially, it would have to process step 1 and do step 2. When chat logs are huge (like my 19.41 MiB for thousands of HTML files with a single contact), Pidgin freezes for over a minute or two when you try to search through it (applies to hard disk drives, not solid-state drives). This is why I'd gravitate towards an incremental solution like Loguntu.