Skip to content

Commit 8ca2836

Browse files
committed
release 3.0.3
1 parent af3e80c commit 8ca2836

File tree

9 files changed

+104
-11
lines changed

9 files changed

+104
-11
lines changed

cn.ieclipse.smartqq.feature/feature.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<feature
33
id="cn.ieclipse.smartqq.feature"
44
label="SmartQQ Feature"
5-
version="3.0.1.qualifier"
5+
version="3.0.3.qualifier"
66
provider-name="ieclipse.cn"
77
plugin="cn.ieclipse.smartqq">
88

cn.ieclipse.smartqq/META-INF/MANIFEST.MF

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
22
Bundle-ManifestVersion: 2
33
Bundle-Name: SmartQQ
44
Bundle-SymbolicName: cn.ieclipse.smartqq;singleton:=true
5-
Bundle-Version: 3.0.1.qualifier
5+
Bundle-Version: 3.0.3.qualifier
66
Bundle-Activator: cn.ieclipse.smartim.IMPlugin
77
Bundle-Vendor: ieclipse.cn
88
Require-Bundle: org.eclipse.ui,
-103 Bytes
Binary file not shown.

cn.ieclipse.smartqq/src/cn/ieclipse/smartqq/QQReceiveCallback.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ protected String getMsgContent(AbstractMessage message, AbstractFrom from) {
8989
if (message instanceof QQMessage) {
9090
QQMessage m = (QQMessage) message;
9191
msg = IMUtils.formatHtmlMsg(m.getTime(), name, m.getContent());
92+
msg = QQUtils.decodeEmoji(msg);
9293
}
9394
return msg;
9495
}
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
/*
2+
* Copyright 2014-2017 ieclipse.cn.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
package cn.ieclipse.smartqq;
17+
18+
import java.util.ArrayList;
19+
import java.util.List;
20+
import java.util.regex.Matcher;
21+
import java.util.regex.Pattern;
22+
23+
import com.scienjus.smartqq.model.Discuss;
24+
import com.scienjus.smartqq.model.DiscussInfo;
25+
import com.scienjus.smartqq.model.Group;
26+
import com.scienjus.smartqq.model.GroupInfo;
27+
28+
import cn.ieclipse.smartim.common.IMUtils;
29+
import cn.ieclipse.smartim.model.IContact;
30+
import cn.ieclipse.util.StringUtils;
31+
import io.github.biezhi.wechat.model.Contact;
32+
33+
/**
34+
* 类/接口描述
35+
*
36+
* @author Jamling
37+
* @date 2018年2月12日
38+
*
39+
*/
40+
public class QQUtils {
41+
public static char getContactChar(IContact target) {
42+
char ch = 'F';
43+
if (target instanceof Group || target instanceof GroupInfo) {
44+
ch = 'G';
45+
}
46+
else if (target instanceof Discuss || target instanceof DiscussInfo) {
47+
ch = 'D';
48+
}
49+
return ch;
50+
}
51+
52+
public static String decodeEmoji(String src) {
53+
return src;
54+
// String regex = "\\[\"face\",([1-9][0-9])\\]";
55+
// if (src != null) {
56+
// String n = src.replaceAll(regex,
57+
// "<span class=\"qqemoji qq_face qqface$1\" alt=\"QQ表情$1\"></span>");
58+
// return n;
59+
// }
60+
// else {
61+
// return "";
62+
// }
63+
}
64+
65+
public static void main(String[] args) {
66+
String src = IMUtils.formatHtmlMsg(true, true,
67+
System.currentTimeMillis(), "Me",
68+
"1毛9[\"face\",0] [\"face\",71] 哈哈");
69+
System.out.println(src);
70+
System.out.println(decodeEmoji(src));
71+
}
72+
}

cn.ieclipse.smartqq/src/cn/ieclipse/smartqq/console/QQChatConsole.java

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -31,18 +31,13 @@
3131
import cn.ieclipse.smartim.preferences.QiniuPerferencePage;
3232
import cn.ieclipse.smartim.preferences.SettingsPerferencePage;
3333
import cn.ieclipse.smartim.views.IMContactView;
34+
import cn.ieclipse.smartqq.QQUtils;
3435

3536
public class QQChatConsole extends IMChatConsole {
3637

3738
public QQChatConsole(IContact target, IMContactView imPanel) {
3839
super(target, imPanel);
39-
char ch = 'F';
40-
if (target instanceof Group || target instanceof GroupInfo) {
41-
ch = 'G';
42-
}
43-
else if (target instanceof Discuss || target instanceof DiscussInfo) {
44-
ch = 'D';
45-
}
40+
char ch = QQUtils.getContactChar(target);
4641
IMG_NORMAL = LetterImageFactory.create(ch, SWT.COLOR_BLACK);
4742
IMG_SELECTED = LetterImageFactory.create(ch, SWT.COLOR_RED);
4843
setImage(IMG_NORMAL);

cn.ieclipse.smartqq/src/cn/ieclipse/smartqq/views/FriendLabelProvider.java

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,11 @@
88
import com.scienjus.smartqq.model.Recent;
99

1010
import cn.ieclipse.smartim.common.LetterImageFactory;
11+
import cn.ieclipse.smartim.model.IContact;
1112
import cn.ieclipse.smartim.model.VirtualCategory;
1213
import cn.ieclipse.smartim.views.IMContactLabelProvider;
1314
import cn.ieclipse.smartim.views.IMContactView;
15+
import cn.ieclipse.smartqq.QQUtils;
1416

1517
public class FriendLabelProvider extends IMContactLabelProvider {
1618

@@ -53,6 +55,19 @@ else if (type == 2) {
5355
return LetterImageFactory.create('D', SWT.COLOR_DARK_CYAN);
5456
}
5557
}
58+
if (obj instanceof IContact) {
59+
IContact target = (IContact) obj;
60+
char ch = QQUtils.getContactChar(target);
61+
if (ch == 'F') {
62+
return LetterImageFactory.create(ch, SWT.COLOR_DARK_GREEN);
63+
}
64+
else if (ch == 'G') {
65+
return LetterImageFactory.create(ch, SWT.COLOR_DARK_BLUE);
66+
}
67+
else if (ch == 'D') {
68+
return LetterImageFactory.create(ch, SWT.COLOR_DARK_CYAN);
69+
}
70+
}
5671
return null;
5772
}
5873
}

cn.ieclipse.smartqq/src/cn/ieclipse/wechat/WXUtils.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
import java.util.regex.Pattern;
2222

2323
import cn.ieclipse.smartim.model.IContact;
24-
import cn.ieclipse.util.FileUtils;
2524
import cn.ieclipse.util.StringUtils;
2625
import io.github.biezhi.wechat.model.Contact;
2726

cn.ieclipse.smartqq/src/cn/ieclipse/wechat/views/WXContactLabelProvider.java

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,18 @@ public Image getContactImage(Object obj) {
4343
Contact c = (Contact) obj;
4444
char ch = WXUtils.getContactChar(c);
4545
if (ch > 0) {
46-
return LetterImageFactory.create(ch, SWT.COLOR_DARK_GREEN);
46+
if (ch == 'F') {
47+
return LetterImageFactory.create(ch, SWT.COLOR_DARK_GREEN);
48+
}
49+
else if (ch == 'G') {
50+
return LetterImageFactory.create(ch, SWT.COLOR_DARK_BLUE);
51+
}
52+
else if (ch == 'P') {
53+
return LetterImageFactory.create(ch, SWT.COLOR_DARK_CYAN);
54+
}
55+
else if (ch == 'S') {
56+
return LetterImageFactory.create(ch, SWT.COLOR_DARK_RED);
57+
}
4758
}
4859
}
4960
return null;

0 commit comments

Comments
 (0)