-
Notifications
You must be signed in to change notification settings - Fork 25
/
Copy pathmirc2egg.sed
231 lines (210 loc) · 7.79 KB
/
mirc2egg.sed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
#!/bin/sed -f
# mirc2egg.sed: convert mIRC log to eggdrop format - 01/12/02
# Useful in replacing missing eggdrop logs
# (supports mIRC 5.x, 6.x and 'Peace and Protection' formats)
#
# Usage: sed -f mirc2egg.sed channel.log > eggformat.log
#
# Geoff Simmons <[email protected]>
{
# Remove carriage returns, delete single hyphen and blank lines
s/$//
/^-$/d
/^$/d
# Strip color/formatting
s/[0-9][0-9],[0-9][0-9]//g
s/[0-9],[0-9][0-9]//g
s/[0-9][0-9],[0-9]//g
s/[0-9],[0-9]//g
s/[0-9][0-9]//g
s/[0-9]//g
s///g
s///g
s///g
s///g
s///g
s/—//g
# Remove seconds from timestamp
s/^\[\(..:..\):..\]/[\1]/
# PnP: reformat conversations to standard mIRC
/^\[..:..\] (.*): /{
s/(/</1
s/):/>/1
}
# Extract channel name from header, convert to lower-case,
# place in hold space, delete from pattern space
/^\[..:..\] \*\*\* Now talking in #/{
s/.*\(#.*\)/\1/1
y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/
h
d
}
/^Session Ident:/{
s/.*: \(.*\)/\1/1
y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/
h
d
}
# Change footer into end-of-log mark
s/^Session Close: \(...\) \(...\) \(..\) \(..:..\):.. \(....\)/[\4] --- \1 \2 \3 \5/
# Retain conversations, actions and events - purge everything else
/^\[..:..\] [<*-].*/!d
# Remove op/voice tags from talking/actions
s/^\[\(..:..\)\] <[@+]/[\1] </
s/^\[\(..:..\)\] \* [@+]/[\1] \* /
# Reformat nick changes (mIRC 5.x)
/^\[..:..\] \*\*\* .*is now known as/{
s/is now known as/->/1
s/^\[\(..:..\)\] \*\*\*/[\1]/
s/^\[\(..:..\)\]/[\1] Nick change:/
}
# Reformat nick changes (mIRC 6.x)
/^\[..:..\] \* .*is now known as/{
s/is now known as/->/1
s/^\[\(..:..\)\] \*/[\1]/
s/^\[\(..:..\)\]/[\1] Nick change:/
}
# Reformat quit actions (PnP)
/^\[..:..\] \*\*\* Quits: .* (.*@.*\..*\..*)/{
s/\*\*\* Quits: //1
s/) (/) left irc: /1
s/)$//
}
# Reformat quit actions, append fake hostmask (mIRC 5.x)
/^\[..:..\] \*\*\* Quits:/{
s/\*\*\* Quits: //1
s/] \(.*\) (\(.*\))$/] \1 ([email protected]) left irc: \2/
}
# Reformat quit actions (mIRC 6.x)
/^\[..:..\] \* .*) Quit.*)$/{
s/Quit/left irc:/1
s/^\[\(..:..\)\] \*/[\1]/
s/(//2
s/)$//
}
# Reformat part actions (mIRC 5.x)
/^\[..:..\] \*\*\* Parts:/{
s/\*\*\* Parts: //1
s/) (\(.*\))$/) left irc: \1/
s/)$/) left irc:/
}
# Reformat join actions (mIRC 5.x)
/^\[..:..\] \*\*\* Joins:/{
s/\*\*\* Joins: //1
G
s/\(.*\)\n\(#.*\)/\1 joined \2./1
}
# Reformat join actions (mIRC 6.x)
/^\[..:..\] \* .*) has joined/{
s/has //1
s/^\[\(..:..\)\] \*/[\1]/
G
s/\(.*\)\n\(.*joined \)\(#.*\)/\2\1/1
s/\(.*joined\).*\n\(.*\)/\1 \2/1
s/$/./
}
# Reformat kick actions (mIRC 5.x)
/^\[..:..\] \*\*\* .*was kicked by.*)$/{
s/by \(.*\) (/by \1: (/1
s/was //1
s/kicked/kicked from /1
s/^\[\(..:..\)\] \*\*\*/[\1]/
G
s/\(.*from \)\(.*\)\n\(.*\)/\1\3\2/1
s/(//1
s/)$//
}
# Reformat kick actions (mIRC 6.x)
/^\[..:..\] \* .*was kicked by.*)$/{
s/by \(.*\) (/by \1: (/1
s/was //1
s/kicked/kicked from /1
s/^\[\(..:..\)\] \*/[\1]/
G
s/\(.*from \)\(.*\)\n\(.*\)/\1\3\2/1
s/(//1
s/)$//
}
# Delete topic changes made by rejoining servers (mIRC 5.x)
/^\[..:..\] \*\*\* .*\..*\..*changes topic to/d
# Delete topic changes made by rejoining servers (mIRC 6.x)
/^\[..:..\] \* .*\..*\..*changes topic to/d
# Reformat topic changes, append fake hostmask (mIRC 5.x)
/^\[..:..\] \*\*\* .*changes topic to/{
s/ changes topic to/[email protected]:/1
s/^\[\(..:..\)\] \*\*\*/[\1]/1
s/^\[\(..:..\)\] /[\1] Topic changed on /1
G
s/\(.*on \)\(.*\)\n\(.*\)/\1\3 by \2/1
s/'//1
s/'$//
}
# Reformat topic changes, append fake hostmask (mIRC 6.x)
/^\[..:..\] \* .*changes topic to/{
s/ changes topic to/[email protected]:/1
s/^\[\(..:..\)\] \*/[\1]/1
s/^\[\(..:..\)\] /[\1] Topic changed on /1
G
s/\(.*on \)\(.*\)\n\(.*\)/\1\3 by \2/1
s/'//1
s/'$//
}
# Delete mode changes made by rejoining servers (mIRC 5.x)
/^\[..:..\] \*\*\* .*\..*\..*sets mode: /d
# Delete mode changes made by rejoining servers (mIRC 6.x)
/^\[..:..\] \* .*\..*\..*sets mode: /d
# Reformat multiple mode changes, append fake hostmask (mIRC 5.x)
/^\[..:..\] \*\*\* .*sets mode: [+-][ovbntsmelkip][+-ovbntsmelkip ]/{
s/sets mode: //1
s/^\[\(..:..\)\] \*\*\*/[\1]/
s/^\[\(..:..\)\] \(.*\) \([+-].*\)/[\1] \2 '\3'/
G
s/\] \(.*\) \('.*\)\n\(.*\)/] \3: mode change \2 by \[email protected]/1
}
# Reformat multiple mode changes, append fake hostmask (mIRC 6.x)
/^\[..:..\] \* .*sets mode: [+-][ovbntsmelkip][+-ovbntsmelkip ]/{
s/sets mode: //1
s/^\[\(..:..\)\] \*/[\1]/
s/^\[\(..:..\)\] \(.*\) \([+-].*\)/[\1] \2 '\3'/
G
s/\] \(.*\) \('.*\)\n\(.*\)/] \3: mode change \2 by \[email protected]/1
}
# Reformat single mode changes, append fake hostmask (mIRC 5.x)
/^\[..:..\] \*\*\* .*sets mode: [+-][imtnselp]$/{
s/sets mode: //1
s/^\[\(..:..\)\] \*\*\*/[\1]/
s/^\[\(..:..\)\] \(.*\) \([+-].*\)/[\1] \2 '\3'/
G
s/\] \(.*\) \('.*\)\n\(.*\)/] \3: mode change \2 by \[email protected]/1
}
# Reformat single mode changes, append fake hostmask (mIRC 6.x)
/^\[..:..\] \* .*sets mode: [+-][imtnselp]$/{
s/sets mode: //1
s/^\[\(..:..\)\] \*/[\1]/
s/^\[\(..:..\)\] \(.*\) \([+-].*\)/[\1] \2 '\3'/
G
s/\] \(.*\) \('.*\)\n\(.*\)/] \3: mode change \2 by \[email protected]/1
}
# Remove client-induced crap (mIRC 6.x)
/^\[..:..\] \* Disconnected/d
/^\[..:..\] \* Attempting to rejoin/d
/^\[..:..\] \* Rejoined channel/d
/^\[..:..\] \* Respond to/d
/^\[..:..\] \* Retrieving #.*info\.\.\./d
/^\[..:..\] \* Topic is/d
/^\[..:..\] \* Set by/d
/^\[..:..\] \* You/d
/^\[..:..\] \* \/msg/d
/^\[..:..\] \* Looking up.*user info/d
/^\[..:..\] \* Timer vote/d
/^\[..:..\] \* Break:/d
/^\[..:..\] \* Waiting.*for previous request/d
# Reformat actions
s/^\[\(..:..\)\] \* /[\1] Action: /
# Remove remaining crap
/^\[..:..\] \*/d
/^\[..:..\] \-/{
/-\{3\} /!d
}
}