sipmsg: handle Pidgin 3.x paragraph separators
WebKitWebView, which Pidgin 3.x uses as message editor, encloses text
paragraphs between <div></div> tags. For the purpose of converting the
message into plaintext, we replace <div> tags with \r\n. The closing </div>
can be ignored (Sipe's HTML parser will strip unhandled tag from the output).
There is a special case of an empty paragraph, which WebKit encodes as
<div><br></div>. We handle it separately and replace the whole sequence with
a single \r\n, not two line breaks <div> and <br> would normally (wrongly)
get converted to, and thus
a<div><br></div><div><br></div><div>b</div><div>c</div>
transforms to
a\r\n
\r\n
\r\n
b\r\n
c
which is a good approximation of the HTML input.
Thanks to Rickard Claesson for bringing this issue to attention.