Permalink
Browse files

Fix many crash bug.

Add gtkqq.desktop.
  • Loading branch information...
1 parent 68d2bfd commit 366d6944465d7630f11ab2557c4cd2120a43b762 @mathslinux mathslinux committed Dec 9, 2011
Showing with 156 additions and 34 deletions.
  1. +2 −0 .gitignore
  2. +1 −1 Makefile.am
  3. +1 −1 autogen.sh
  4. +3 −2 configure.ac
  5. +8 −0 pixmaps/Makefile.am
  6. +14 −0 pixmaps/gtkqq.desktop
  7. BIN pixmaps/gtkqq.png
  8. +8 −1 src/libqq/qqimg.c
  9. +48 −19 src/libqq/qqlogin.c
  10. +49 −7 src/libqq/qqmanageinfo.c
  11. +8 −1 src/libqq/qqpoll.c
  12. +14 −2 src/libqq/qqsendmsg.c
View
@@ -11,3 +11,5 @@
Makefile
aclocal.m4
autom4te.cache
+build-aux/ltmain.sh
+cscope*
View
@@ -1,2 +1,2 @@
-SUBDIRS=src
+SUBDIRS= src pixmaps
ACLOCAL_AMFLAGS = -I m4
View
@@ -5,4 +5,4 @@ aclocal \
&& libtoolize --copy --force --automake \
&& autoreconf --install \
&& [ -d usr ] || mkdir usr \
-&& ./configure --enable-debug --prefix=`pwd`/usr/
+&& ./configure --enable-debug --prefix=/usr
View
@@ -224,7 +224,7 @@ AC_FUNC_MALLOC
AC_CHECK_FUNCS([bzero gethostbyname memset mkdir select socket strstr strtol])
AC_CHECK_FUNCS([inet_ntoa])
-AC_CONFIG_FILES([Makefile
+AC_CONFIG_FILES([Makefile
src/Makefile
src/comm/Makefile
src/libqq/Makefile
@@ -237,7 +237,8 @@ AC_CONFIG_FILES([Makefile
src/misc/status/Makefile
src/misc/qqfaces/Makefile
src/misc/sound/Makefile
- src/test/Makefile])
+ src/test/Makefile]
+ pixmaps/Makefile)
AC_OUTPUT
#echo Use libnotify................. : $enable_libnotify
View
@@ -0,0 +1,8 @@
+appicondir = $(datadir)/pixmaps
+appicon_DATA = gtkqq.png
+
+desktopdir = $(datadir)/applications
+desktop_DATA = gtkqq.desktop
+
+EXTRA_DIST = $(appicon_DATA) $(desktop_DATA)
+
View
@@ -0,0 +1,14 @@
+[Desktop Entry]
+Version=1.0
+Name=GTKQQ
+Name[es]=GTKQQ
+GenericName=QQ Client
+GenericName[es]=QQ Client
+Comment=QQ client written in GTK
+Comment[es]=QQ client written in GTK
+Exec=gtkqq
+Icon=gtkqq
+Terminal=false
+Type=Application
+Categories=Network;
+StartupNotify=true
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
@@ -40,6 +40,7 @@ gint qq_get_face_img(QQInfo *info, QQFaceImg *img, GError **err)
}
gint ret_code = NO_ERR;
gchar params[300];
+ gint res = 0;
g_debug("Get face image of %s!(%s, %d)", img -> uin -> str
, __FILE__, __LINE__);
@@ -65,10 +66,16 @@ gint qq_get_face_img(QQInfo *info, QQFaceImg *img, GError **err)
}
send_request(con, req);
- rcv_response(con, &rps);
+ res = rcv_response(con, &rps);
close_con(con);
connection_free(con);
+ if (-1 == res || !rps) {
+ g_warning("Null point access (%s, %d)\n", __FILE__, __LINE__);
+ ret_code = -1;
+ goto error;
+ }
+
const gchar *retstatus = rps -> status -> str;
if(g_strstr_len(retstatus, -1, "200") == NULL){
/*
View
@@ -48,6 +48,7 @@ static gint check_verify_code(QQInfo *info)
Request *req = request_new();
Response *rps = NULL;
+ int res = 0;
request_set_method(req, "GET");
request_set_version(req, "HTTP/1.1");
g_sprintf(params, VCCHECKPATH"?uin=%s&appid="APPID"&r=%.16f"
@@ -59,7 +60,15 @@ static gint check_verify_code(QQInfo *info)
Connection *con = connect_to_host(LOGINHOST, 80);
send_request(con, req);
- rcv_response(con, &rps);
+ res = rcv_response(con, &rps);
+ close_con(con);
+ connection_free(con);
+
+ if (-1 == res || !rps) {
+ g_warning("Null point access (%s, %d)\n", __FILE__, __LINE__);
+ ret = -1;
+ goto error;
+ }
const gchar *retstatus = rps -> status -> str;
if(g_strstr_len(retstatus, -1, "200") == NULL){
g_warning("Server status %s (%s, %d)", retstatus
@@ -68,9 +77,6 @@ static gint check_verify_code(QQInfo *info)
goto error;
}
- close_con(con);
- connection_free(con);
-
/*
* The http message body has two format:
*
@@ -150,7 +156,8 @@ static gint get_vc_image(QQInfo *info)
return PARAMETER_ERR;
}
gint ret = 0;
- gchar params[500];
+ gchar params[500];
+ gint res = 0;
Request *req = request_new();
Response *rps = NULL;
@@ -172,7 +179,9 @@ static gint get_vc_image(QQInfo *info)
}
send_request(con, req);
- rcv_response(con, &rps);
+ res = rcv_response(con, &rps);
+ close_con(con);
+ connection_free(con);
const gchar *retstatus = rps -> status -> str;
if(g_strstr_len(retstatus, -1, "200") == NULL){
g_warning("Server status %s (%s, %d)", retstatus
@@ -181,9 +190,6 @@ static gint get_vc_image(QQInfo *info)
goto error;
}
- close_con(con);
- connection_free(con);
-
info -> vc_image_data = g_string_new(NULL);
g_string_append_len(info -> vc_image_data, rps -> msg -> str
, rps -> msg -> len);
@@ -222,6 +228,7 @@ static gint get_version(QQInfo *info)
int ret = NO_ERR;
Request *req = request_new();
Response *rps = NULL;
+ gint res = 0;
request_set_method(req, "GET");
request_set_version(req, "HTTP/1.1");
request_set_uri(req, VERPATH);
@@ -236,17 +243,21 @@ static gint get_version(QQInfo *info)
return NETWORK_ERR;
}
send_request(con, req);
- rcv_response(con, &rps);
+ res = rcv_response(con, &rps);
+ close_con(con);
+ connection_free(con);
const gchar *retstatus = rps -> status -> str;
+ if (-1 == res || !rps) {
+ g_warning("Null point access (%s, %d)\n", __FILE__, __LINE__);
+ ret = -1;
+ goto error;
+ }
if(g_strstr_len(retstatus, -1, "200") == NULL){
g_warning("Server status %s (%s, %d)", retstatus
, __FILE__, __LINE__);
ret = NETWORK_ERR;
goto error;
}
-
- close_con(con);
- connection_free(con);
gchar *lb, *rb;
gchar *ms = rps -> msg -> str;
@@ -317,6 +328,7 @@ GString* get_pwvc_md5(const gchar *pwd, const gchar *vc, GError **err)
static gint get_ptcz_skey(QQInfo *info, const gchar *p)
{
gint ret = 0;
+ gint res = 0;
gchar params[300];
Request *req = request_new();
@@ -352,7 +364,15 @@ static gint get_ptcz_skey(QQInfo *info, const gchar *p)
}
send_request(con, req);
- rcv_response(con, &rps);
+ res = rcv_response(con, &rps);
+ close_con(con);
+ connection_free(con);
+
+ if (-1 == res || !rps) {
+ g_warning("Null point access (%s, %d)\n", __FILE__, __LINE__);
+ ret = -1;
+ goto error;
+ }
const gchar *retstatus = rps -> status -> str;
if(g_strstr_len(retstatus, -1, "200") == NULL){
g_warning("Server status %s (%s, %d)", retstatus
@@ -361,9 +381,6 @@ static gint get_ptcz_skey(QQInfo *info, const gchar *p)
goto error;
}
- close_con(con);
- connection_free(con);
-
gint status;
gchar *sbe = g_strstr_len(rps -> msg -> str, -1, "'");
++sbe;
@@ -474,6 +491,7 @@ static GString *generate_clientid()
static int get_psessionid(QQInfo *info)
{
int ret = NO_ERR;
+ gint res = 0;
if(info -> ptwebqq == NULL || info -> ptwebqq -> len <= 0){
g_warning("Need ptwebqq!!(%s, %d)", __FILE__, __LINE__);
return PARAMETER_ERR;
@@ -532,8 +550,13 @@ static int get_psessionid(QQInfo *info)
}
send_request(con, req);
- rcv_response(con, &rps);
+ res = rcv_response(con, &rps);
+ if (-1 == res || !rps) {
+ g_warning("Null point access (%s, %d)\n", __FILE__, __LINE__);
+ ret = -1;
+ goto error;
+ }
const gchar *retstatus = rps -> status -> str;
if(g_strstr_len(retstatus, -1, "200") == NULL){
g_warning("Server status %s (%s, %d)", retstatus
@@ -716,6 +739,7 @@ gint qq_login(QQInfo *info, const gchar *qqnum, const gchar *passwd
static gint do_logout(QQInfo *info, GError **err)
{
gint ret_code = 0;
+ gint res = 0;
g_debug("Logout... (%s, %d)", __FILE__, __LINE__);
if(info -> psessionid == NULL || info -> psessionid -> len <= 0){
g_warning("Need psessionid !!(%s, %d)", __FILE__, __LINE__);
@@ -745,10 +769,15 @@ static gint do_logout(QQInfo *info, GError **err)
}
send_request(con, req);
- rcv_response(con, &rps);
+ res = rcv_response(con, &rps);
close_con(con);
connection_free(con);
+ if (-1 == res || !rps) {
+ g_warning("Null point access (%s, %d)\n", __FILE__, __LINE__);
+ ret_code = -1;
+ goto error;
+ }
const gchar *retstatus = rps -> status -> str;
if(g_strstr_len(retstatus, -1, "200") == NULL){
/*
Oops, something went wrong.

0 comments on commit 366d694

Please sign in to comment.