diff options
author | pescuma <pescuma@c086bb3d-8645-0410-b8da-73a8550f86e7> | 2008-03-31 01:25:21 +0000 |
---|---|---|
committer | pescuma <pescuma@c086bb3d-8645-0410-b8da-73a8550f86e7> | 2008-03-31 01:25:21 +0000 |
commit | b563bfafc50adb84bace9e759128091a95821d63 (patch) | |
tree | 237ccafbafe4b452a27d305927de15695718be0a | |
parent | b1bcfe11e40f2eb7e53ef0f8d992df0fb179b173 (diff) |
Fix for emitcons without images (closes issue 35)
Better error handling for emoticon packs
git-svn-id: http://pescuma.googlecode.com/svn/trunk/Miranda@71 c086bb3d-8645-0410-b8da-73a8550f86e7
-rw-r--r-- | Plugins/emoticons/emoticons.cpp | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/Plugins/emoticons/emoticons.cpp b/Plugins/emoticons/emoticons.cpp index c964fd5..5bb9c70 100644 --- a/Plugins/emoticons/emoticons.cpp +++ b/Plugins/emoticons/emoticons.cpp @@ -407,8 +407,8 @@ int ReplaceEmoticonBackwards(RichEditCtrl &rec, Contact *contact, Module *module for(int i = 0; i < module->emoticons.getCount(); i++)
{
Emoticon *e = module->emoticons[i];
- if (e->img == NULL)
- continue;
+// if (e->img == NULL)
+// continue;
for(int j = 0; j < e->texts.getCount(); j++)
{
@@ -427,7 +427,10 @@ int ReplaceEmoticonBackwards(RichEditCtrl &rec, Contact *contact, Module *module && !_istspace(text[text_len - len - 1]))
continue;
- mir_snprintf(found_path, MAX_REGS(found_path), "%s\\%s", e->img->pack->path, e->img->relPath);
+ if (e->img == NULL)
+ found_path[0] = '\0';
+ else
+ mir_snprintf(found_path, MAX_REGS(found_path), "%s\\%s", e->img->pack->path, e->img->relPath);
found_len = len;
found_text = txt;
}
@@ -460,7 +463,7 @@ int ReplaceEmoticonBackwards(RichEditCtrl &rec, Contact *contact, Module *module int ret = 0;
- if (found_len > 0)
+ if (found_len > 0 && found_path[0] != '\0')
{
// Found ya
CHARRANGE sel = { last_pos - found_len, last_pos };
@@ -1555,14 +1558,14 @@ EmoticonImage * HandleMepLine(EmoticonPack *p, char *line) {
delete img;
img = NULL;
- break;
+ return img;
}
if (strncmp("http://", txt, 7) == 0)
{
img->url = txt;
- char *p = strrchr(txt, '//');
+ char *p = strrchr(txt, '/');
p++;
char tmp[1024];
|