wjrsonic / mentohust

Automatically exported from code.google.com/p/mentohust
0 stars 0 forks source link

计费提示是什么 #84

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1.运行后又有系统提示又有计费提示
2.
3.

What is the expected output? What do you see instead?
我用的是.0.3.4版本的,只有一个系统提示(server 
Msg),但编译了0.3.1后发现有计费提示。
没什么内容,但在inotify提示中,由于系统提示在前,计费提�
��在后,它会覆盖系统提示。

What version of the product are you using? On what operating system?

0.3.1 ubuntu 10.10
Please provide any additional information below.

Original issue reported on code.google.com by nasa4836 on 29 Dec 2010 at 7:31

GoogleCodeExporter commented 9 years ago
某些学校的提示信息有两个,第二个一般提示计费信息。
可以考虑将mentohust.c中static void showRuijieMsg(const u_char *buf, 
unsigned bufLen)函数替换:
static void showRuijieMsg(const u_char *buf, unsigned bufLen)
{
        char *serverMsg1=NULL, *serverMsg2=NULL, *serverMsg;
        int length1, length2;
        if ((length1=buf[0x1b]) > 0) {
                for (serverMsg1=(char *)(buf+0x1c); *serverMsg1=='\r'||*serverMsg1=='\n'; serverMsg1++,length1--);   /* 跳过开头的换行符 */
                if (strlen(serverMsg1) < length1)
                        length1 = strlen(serverMsg1);
        }
        if (!serverMsg1) length1 = 0;
        if ((length2=0x1c+buf[0x1b]+0x69+39) < bufLen) {
                serverMsg2=(char *)(buf+length2);
                if (buf[length2-1]-2 > bufLen-length2)
                        length2 = bufLen - length2;
                else
                        length2 = buf[length2-1]-2;
                for (; *serverMsg2=='\r'||*serverMsg2=='\n'; serverMsg2++,length2--);
        }
        if (!serverMsg2) length2 = 0;
        if (length1+length2) {
                serverMsg = (char *)malloc(length1+length2);
                if (length1) strncpy(serverMsg, serverMsg1, length1);
                if (length2) strncpy(serverMsg+length1, serverMsg2, length2);
                if ((serverMsg1=gbk2utf(serverMsg, length1+length2))!=NULL) {
                        if (strlen(serverMsg1)) {
                                printf(_("$$ 系统提示:\t%s\n"), serverMsg1);
#ifndef NO_NOTIFY
                                if (showNotify && show_notify(_("MentoHUST - 系统提示"),
                                        serverMsg1, 1000*showNotify) < 0)
                                        showNotify = 0;
#endif
                        }
                        free(serverMsg1);
                }
                free(serverMsg);
        }
}

Original comment by www.eh...@gmail.com on 30 Dec 2010 at 2:43

GoogleCodeExporter commented 9 years ago
我们学校就只有一个,我之前用的是0.3.4版本,就只跳出系统
提示。而这次用0.3.1编译,跳出有系统提示和计费提示,这个
计费提示是什么情况会用到的?不明白代码中关于buf的偏移��
�判断来决定是系统提示或计费提示的原因。

Original comment by nasa4836 on 30 Dec 2010 at 5:42

GoogleCodeExporter commented 9 years ago
两个版本代码是一样的,只能认为是贵校新增了一个消息。

Original comment by www.eh...@gmail.com on 25 Jun 2011 at 10:51