comparison libpurple/protocols/oscar/oscar.c @ 23777:62fda5f78f6a

Stu reckoned that having a new block to build the debug string is ugly; I think I agree with him.
author Will Thompson <will.thompson@collabora.co.uk>
date Wed, 13 Aug 2008 15:59:36 +0000
parents b4871d70e916
children 5e7a013bb75e e4fa83bb82e0
comparison
equal deleted inserted replaced
23776:b4871d70e916 23777:62fda5f78f6a
1633 struct pieceofcrap *pos = data; 1633 struct pieceofcrap *pos = data;
1634 OscarData *od = pos->gc->proto_data; 1634 OscarData *od = pos->gc->proto_data;
1635 char in = '\0'; 1635 char in = '\0';
1636 int x = 0; 1636 int x = 0;
1637 unsigned char m[17]; 1637 unsigned char m[17];
1638 GString *msg;
1638 1639
1639 while (read(pos->fd, &in, 1) == 1) { 1640 while (read(pos->fd, &in, 1) == 1) {
1640 if (in == '\n') 1641 if (in == '\n')
1641 x++; 1642 x++;
1642 else if (in != '\r') 1643 else if (in != '\r')
1663 { 1664 {
1664 purple_debug_warning("oscar", "Could not read full AIM login hash " 1665 purple_debug_warning("oscar", "Could not read full AIM login hash "
1665 "from " AIMHASHDATA "--that's bad.\n"); 1666 "from " AIMHASHDATA "--that's bad.\n");
1666 } 1667 }
1667 m[16] = '\0'; 1668 m[16] = '\0';
1668 { 1669
1669 GString *msg = g_string_new("Sending hash: "); 1670 msg = g_string_new("Sending hash: ");
1670 for (x = 0; x < 16; x++) 1671 for (x = 0; x < 16; x++)
1671 g_string_append_printf(msg, "%02hhx ", (unsigned char)m[x]); 1672 g_string_append_printf(msg, "%02hhx ", (unsigned char)m[x]);
1672 g_string_append(msg, "\n"); 1673 g_string_append(msg, "\n");
1673 purple_debug_misc("oscar", msg->str); 1674 purple_debug_misc("oscar", msg->str);
1674 g_string_free(msg, TRUE); 1675 g_string_free(msg, TRUE);
1675 } 1676
1676 purple_input_remove(pos->inpa); 1677 purple_input_remove(pos->inpa);
1677 close(pos->fd); 1678 close(pos->fd);
1678 aim_sendmemblock(od, pos->conn, 0, 16, m, AIM_SENDMEMBLOCK_FLAG_ISHASH); 1679 aim_sendmemblock(od, pos->conn, 0, 16, m, AIM_SENDMEMBLOCK_FLAG_ISHASH);
1679 g_free(pos); 1680 g_free(pos);
1680 } 1681 }
4927 static int purple_ssi_parserights(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) { 4928 static int purple_ssi_parserights(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) {
4928 int i; 4929 int i;
4929 va_list ap; 4930 va_list ap;
4930 int numtypes; 4931 int numtypes;
4931 guint16 *maxitems; 4932 guint16 *maxitems;
4933 GString *msg;
4932 4934
4933 va_start(ap, fr); 4935 va_start(ap, fr);
4934 numtypes = va_arg(ap, int); 4936 numtypes = va_arg(ap, int);
4935 maxitems = va_arg(ap, guint16 *); 4937 maxitems = va_arg(ap, guint16 *);
4936 va_end(ap); 4938 va_end(ap);
4937 4939
4938 { 4940 msg = g_string_new("ssi rights:");
4939 GString *msg = g_string_new("ssi rights:"); 4941 for (i=0; i<numtypes; i++)
4940 for (i=0; i<numtypes; i++) 4942 g_string_append_printf(msg, " max type 0x%04x=%hd,", i, maxitems[i]);
4941 g_string_append_printf(msg, " max type 0x%04x=%hd,", i, maxitems[i]); 4943 g_string_append(msg, "\n");
4942 g_string_append(msg, "\n"); 4944 purple_debug_misc("oscar", msg->str);
4943 purple_debug_misc("oscar", msg->str); 4945 g_string_free(msg, TRUE);
4944 g_string_free(msg, TRUE);
4945 }
4946 4946
4947 if (numtypes >= 0) 4947 if (numtypes >= 0)
4948 od->rights.maxbuddies = maxitems[0]; 4948 od->rights.maxbuddies = maxitems[0];
4949 if (numtypes >= 1) 4949 if (numtypes >= 1)
4950 od->rights.maxgroups = maxitems[1]; 4950 od->rights.maxgroups = maxitems[1];