From svn w toxygen.net Wed Oct 1 00:31:00 2008 From: svn w toxygen.net (SVN commit) Date: Wed, 1 Oct 2008 00:31:00 +0200 (CEST) Subject: [ekg2-commit] r4695 - trunk/plugins/icq: trunk/plugins/icq/icq.c trunk/plugins/icq/icq.h trunk/plugins/icq/icq_caps.h trunk/plugins/icq/icq_const.h Message-ID: <20080930223100.1E21B17B1F@toxygen.net> Author: wiechu Date: 2008-10-01 00:30:59 +0200 (Wed, 01 Oct 2008) New Revision: 4695 Modified: trunk/plugins/icq/icq.c trunk/plugins/icq/icq.h trunk/plugins/icq/icq_caps.h trunk/plugins/icq/icq_const.h Log: - add security options: /session hide_ip, webaware, require_auth - few fix & clean Modified: trunk/plugins/icq/icq.c =================================================================== --- trunk/plugins/icq/icq.c 2008-09-30 21:35:58 UTC (rev 4694) +++ trunk/plugins/icq/icq.c 2008-09-30 22:30:59 UTC (rev 4695) @@ -48,6 +48,7 @@ #include "misc.h" #include "icq_caps.h" +#include "icq_const.h" #include "icq_flap_handlers.h" #include "icq_snac_handlers.h" @@ -116,19 +117,21 @@ } int icq_write_status(session_t *s) { - uint16_t status; + icq_private_t *j = s->priv; + uint32_t status; if (!s) return 0; - status = icq_status(s->status); + status = (j->status_flags << 16) | icq_status(s->status); icq_send_snac(s, 0x01, 0x001e, 0, 0, "tI", - icq_pack_tlv_dword(0x06, (0x00 << 8 | status))); /* TLV 6: Status mode and security flags */ + icq_pack_tlv_dword(0x06, status)); /* TLV 6: Status mode and security flags */ return 1; } + int icq_write_info(session_t *s) { icq_private_t *j; @@ -201,10 +204,43 @@ return 0; } -void icq_session_connected(session_t *s) { +void icq_set_sequrity(session_t *s) { icq_private_t *j; string_t pkt; + uint8_t auth, webaware; + if (!s || !(j = s->priv)) + return; + + webaware = atoi(session_get(s, "webaware")); + if (webaware) + j->status_flags |= STATUS_WEBAWARE; + else + j->status_flags &= ~STATUS_WEBAWARE; + + if (!(s->connected)) + return; + + auth = atoi(session_get(s, "require_auth")); + pkt = icq_pack("w iwww wwc wwc", + (uint32_t) 4+2+2+2 + 5 + 5, /* data chunk size */ + + (uint32_t) atoi(s->uid+4), /* request owner uin */ + (uint32_t) 0x7d0, /* data type: META_DATA_REQ */ + (uint32_t) j->snac_seq++, /* request sequence number */ + (uint32_t) 0x0c3a, /* data subtype: CLI_SET_FULLINFO */ + + (uint32_t) 0x30c, (uint32_t) 1, (uint32_t) webaware, /* TLV(0x30c) (LE!) */ + (uint32_t) 0x2f8, (uint32_t) 1, (uint32_t) !auth /* TLV(0x2f8) (LE!) */ + ); + icq_send_snac(s, 0x15, 0x02, NULL, NULL, "T", icq_pack_tlv(0x1, pkt->str, pkt->len)); + string_free(pkt, 1); +} + +void icq_session_connected(session_t *s) { + icq_private_t *j = s->priv; + string_t pkt; + icq_write_info(s); /* SNAC 3,4: Tell server who's on our list */ @@ -225,10 +261,7 @@ else updateServVisibilityCode(3); #endif - } - - if (s->status != EKG_STATUS_INVISIBLE) - { + } else { /* Tell server who's on our invisible list */ #if MIRANDA if (!j->ssi) @@ -236,94 +269,88 @@ else updateServVisibilityCode(4); #endif - ; } /* SNAC 1,1E: Set status */ { -#if MIRANDA - DWORD dwDirectCookie = rand() ^ (rand() << 16); - BYTE bXStatus = getContactXStatus(NULL); - char szMoodId[32]; - WORD cbMoodId = 0; - WORD cbMoodData = 0; - - if (bXStatus && moodXStatus[bXStatus-1] != -1) - { // prepare mood id - null_snprintf(szMoodId, SIZEOF(szMoodId), "icqmood%d", moodXStatus[bXStatus-1]); - cbMoodId = strlennull(szMoodId); - cbMoodData = 8; - } -#endif string_t pkt; string_t tlv_c; - uint16_t status; + uint32_t cookie, status; - status = icq_status(s->status); + cookie = rand() <<16 | rand(); + status = (j->status_flags << 16) | icq_status(s->status); pkt = string_init(NULL); - icq_pack_append(pkt, "tI", icq_pack_tlv_dword(0x06, (0x00 << 8 | status))); /* TLV 6: Status mode and security flags */ - icq_pack_append(pkt, "tW", icq_pack_tlv_word(0x08, 0x00)); /* TLV 8: Error code */ + icq_pack_append(pkt, "tI", icq_pack_tlv_dword(0x06, status)); /* TLV 6: Status mode and security flags */ + icq_pack_append(pkt, "tW", icq_pack_tlv_word(0x08, 0x00)); /* TLV 8: Error code */ - /* TLV C: Direct connection info */ + /* TLV C: Direct connection info */ tlv_c = string_init(NULL); icq_pack_append(tlv_c, "I", (uint32_t) 0x00000000); /* XXX, getSettingDword(NULL, "RealIP", 0) */ icq_pack_append(tlv_c, "I", (uint32_t) 0x00000000); /* XXX, nPort */ - icq_pack_append(tlv_c, "C", (uint32_t) 0x04); /* Normal direct connection (without proxy/firewall) */ - icq_pack_append(tlv_c, "W", (uint32_t) 0x08); /* Protocol version */ - icq_pack_append(tlv_c, "I", (uint32_t) 0x00); /* XXX, DC Cookie */ - icq_pack_append(tlv_c, "I", (uint32_t) 0x50); /* WEBFRONTPORT */ - icq_pack_append(tlv_c, "I", (uint32_t) 0x03); /* CLIENTFEATURES */ + icq_pack_append(tlv_c, "C", DC_NORMAL); /* Normal direct connection (without proxy/firewall) */ + icq_pack_append(tlv_c, "W", ICQ_VERSION); /* Protocol version */ + icq_pack_append(tlv_c, "I", cookie); /* DC Cookie */ + icq_pack_append(tlv_c, "I", WEBFRONTPORT); /* Web front port */ + icq_pack_append(tlv_c, "I", CLIENTFEATURES); /* Client features*/ icq_pack_append(tlv_c, "I", (uint32_t) 0xffffffff); /* gbUnicodeCore ? 0x7fffffff : 0xffffffff */ /* Abused timestamp */ icq_pack_append(tlv_c, "I", (uint32_t) 0x80050003); /* Abused timestamp */ icq_pack_append(tlv_c, "I", (uint32_t) 0x00000000); /* XXX, Timestamp */ icq_pack_append(tlv_c, "W", (uint32_t) 0x0000); /* Unknown */ icq_pack_append(pkt, "T", icq_pack_tlv(0x0C, tlv_c->str, tlv_c->len)); - /* XXX, assert(tlv_c->len == 0x25) */ + string_free(tlv_c, 1); + /* TLV(0x1F) - unknown? */ icq_pack_append(pkt, "tW", icq_pack_tlv_word(0x1F, 0x00)); -#if MIRANDA - if (cbMoodId) - { // Pack mood data - packWord(&packet, 0x1D); // TLV 1D - packWord(&packet, (WORD)(cbMoodId + 4)); // TLV length - packWord(&packet, 0x0E); // Item Type - packWord(&packet, cbMoodId); // Flags + Item Length - packBuffer(&packet, (LPBYTE)szMoodId, cbMoodId); // Mood + /* TLV(0x1D) -- xstatus (icqmood) */ + if (j->xstatus && (j->xstatus - 1 <= MAX_ICQMOOD)) { + char *mood = saprintf("icqmood%d", j->xstatus - 1); + + string_t tlv_1d = icq_pack("WCC", + (uint32_t) 0x0e, // item type + (uint32_t) 0, // item flags + xstrlen(mood)); + string_append(tlv_1d, mood); + + icq_pack_append(pkt, "T", icq_pack_tlv(0x1d, tlv_1d->str, tlv_1d->len)); + + string_free(tlv_1d, 1); + xfree(mood); } -#endif - icq_makesnac(s, pkt, 0x01, 0x1E, 0, 0); - icq_send_pkt(s, pkt); pkt = NULL; + + icq_makesnac(s, pkt, 0x01, 0x1e, NULL, NULL); /* Set status (set location info) */ + icq_send_pkt(s, pkt); } - /* SNAC 1,11 */ - icq_send_snac(s, 0x01, 0x11, 0, 0, "I", (uint32_t) 0x00000000); + /* SNAC(1,0x11) - Set idle time */ + icq_send_snac(s, 0x01, 0x11, NULL, NULL, "I", (uint32_t) 0); /* j->idleAllow = 0; */ /* Finish Login sequence */ - pkt = string_init(NULL); + /* SNAC(1,2) - Client is now online and ready for normal function */ + /* imitate ICQ 6 behaviour */ + icq_send_snac(s, 0x01, 0x02, NULL, NULL, + "WWWW WWWW WWWW WWWW WWWW WWWW WWWW WWWW WWWW WWWW WWWW", + /* family number, family version, family tool id, family tool version */ + (uint32_t) 0x01, (uint32_t) 0x04, (uint32_t) 0x0110, (uint32_t) 0x161b, + (uint32_t) 0x02, (uint32_t) 0x01, (uint32_t) 0x0110, (uint32_t) 0x161b, + (uint32_t) 0x03, (uint32_t) 0x01, (uint32_t) 0x0110, (uint32_t) 0x161b, + (uint32_t) 0x04, (uint32_t) 0x01, (uint32_t) 0x0110, (uint32_t) 0x161b, + (uint32_t) 0x06, (uint32_t) 0x01, (uint32_t) 0x0110, (uint32_t) 0x161b, + (uint32_t) 0x09, (uint32_t) 0x01, (uint32_t) 0x0110, (uint32_t) 0x161b, + (uint32_t) 0x0a, (uint32_t) 0x01, (uint32_t) 0x0110, (uint32_t) 0x161b, + (uint32_t) 0x0b, (uint32_t) 0x01, (uint32_t) 0x0110, (uint32_t) 0x161b, + (uint32_t) 0x13, (uint32_t) 0x04, (uint32_t) 0x0110, (uint32_t) 0x161b, + (uint32_t) 0x15, (uint32_t) 0x01, (uint32_t) 0x0110, (uint32_t) 0x161b, + (uint32_t) 0x22, (uint32_t) 0x01, (uint32_t) 0x0110, (uint32_t) 0x161b + ); - icq_pack_append(pkt, "WWI", (uint32_t) 0x22, (uint32_t) 0x01, (uint32_t) 0x0110161b); /* imitate ICQ 6 behaviour */ - icq_pack_append(pkt, "WWI", (uint32_t) 0x01, (uint32_t) 0x04, (uint32_t) 0x0110161b); - icq_pack_append(pkt, "WWI", (uint32_t) 0x13, (uint32_t) 0x04, (uint32_t) 0x0110161b); - icq_pack_append(pkt, "WWI", (uint32_t) 0x02, (uint32_t) 0x01, (uint32_t) 0x0110161b); - icq_pack_append(pkt, "WWI", (uint32_t) 0x03, (uint32_t) 0x01, (uint32_t) 0x0110161b); - icq_pack_append(pkt, "WWI", (uint32_t) 0x15, (uint32_t) 0x01, (uint32_t) 0x0110161b); - icq_pack_append(pkt, "WWI", (uint32_t) 0x04, (uint32_t) 0x01, (uint32_t) 0x0110161b); - icq_pack_append(pkt, "WWI", (uint32_t) 0x06, (uint32_t) 0x01, (uint32_t) 0x0110161b); - icq_pack_append(pkt, "WWI", (uint32_t) 0x09, (uint32_t) 0x01, (uint32_t) 0x0110161b); - icq_pack_append(pkt, "WWI", (uint32_t) 0x0a, (uint32_t) 0x01, (uint32_t) 0x0110161b); - icq_pack_append(pkt, "WWI", (uint32_t) 0x0b, (uint32_t) 0x01, (uint32_t) 0x0110161b); - - icq_makesnac(s, pkt, 0x01, 0x02, 0, 0); - icq_send_pkt(s, pkt); pkt = NULL; - debug_ok(" *** Yeehah, login sequence complete\n"); @@ -365,10 +392,11 @@ } protocol_connected_emit(s); + icq_set_sequrity(s); icq_write_status_msg(s); { /* XXX ?wo? find better place for it */ - if (s && (j = s->priv) && (!j->default_group_id)) { + if (!j->default_group_id) { /* No groups on server!!! */ /* Once executed ugly code: */ icq_send_snac(s, 0x13, 0x11, 0, 0, ""); // Contacts edit start (begin transaction) @@ -1464,6 +1492,34 @@ return 0; } + +static void icq_changed_our_sequrity(session_t *s, const char *var) { + const char *val; + icq_private_t *j; + int webaware; + + if (!s || !(j = s->priv)) + return; + + if (!(val = session_get(s, var)) || !*val) + return; + + if ((webaware = !xstrcasecmp(var, "webaware")) || !xstrcasecmp(var, "require_auth")) { + icq_set_sequrity(s); + if (webaware) + icq_write_status(s); + } else if (!xstrcasecmp(var, "hide_ip")) { + if (*val & 1) { + j->status_flags |= STATUS_DCAUTH; + j->status_flags &= ~STATUS_SHOWIP; + } else { + j->status_flags |= STATUS_SHOWIP; + j->status_flags &= ~STATUS_DCAUTH; + } + icq_write_status(s); + } +} + static plugins_params_t icq_plugin_vars[] = { PLUGIN_VAR_ADD("alias", VAR_STR, NULL, 0, NULL), PLUGIN_VAR_ADD("auto_connect", VAR_BOOL, "0", 0, NULL), @@ -1472,6 +1528,11 @@ PLUGIN_VAR_ADD("password", VAR_STR, NULL, 1, NULL), PLUGIN_VAR_ADD("plaintext_passwd", VAR_BOOL, "0", 0, NULL), PLUGIN_VAR_ADD("server", VAR_STR, NULL, 0, NULL), + + PLUGIN_VAR_ADD("hide_ip", VAR_BOOL, "1", 0, icq_changed_our_sequrity), + PLUGIN_VAR_ADD("require_auth", VAR_BOOL, "1", 0, icq_changed_our_sequrity), + PLUGIN_VAR_ADD("webaware", VAR_BOOL, "0", 0, icq_changed_our_sequrity), + PLUGIN_VAR_END() }; Modified: trunk/plugins/icq/icq.h =================================================================== --- trunk/plugins/icq/icq.h 2008-09-30 21:35:58 UTC (rev 4694) +++ trunk/plugins/icq/icq.h 2008-09-30 22:30:59 UTC (rev 4695) @@ -43,7 +43,8 @@ int ssi; /* server-side-userlist? */ int aim; /* aim-ok? */ int default_group_id; /* XXX ?wo? TEMP! We should support list of groups */ - int xstatus; + int status_flags; /* XXX ?wo? set it! */ + int xstatus; /* XXX ?wo? set it! */ private_data_t *whoami; char *default_group_name; string_t cookie; /* connection login cookie */ Modified: trunk/plugins/icq/icq_caps.h =================================================================== --- trunk/plugins/icq/icq_caps.h 2008-09-30 21:35:58 UTC (rev 4694) +++ trunk/plugins/icq/icq_caps.h 2008-09-30 22:30:59 UTC (rev 4695) @@ -44,6 +44,7 @@ */ #define XSTATUS_COUNT 32 +#define MAX_ICQMOOD 23 const char *icq_xstatus_name(int id); Modified: trunk/plugins/icq/icq_const.h =================================================================== --- trunk/plugins/icq/icq_const.h 2008-09-30 21:35:58 UTC (rev 4694) +++ trunk/plugins/icq/icq_const.h 2008-09-30 22:30:59 UTC (rev 4695) @@ -130,4 +130,33 @@ #define ACKTYPE_AVATAR 14 //send/recv of avatars from a protocol #define ACKTYPE_EMAIL 15 //notify if the unread emails changed +/* + * Status flags + */ +#define STATUS_WEBAWARE 0x0001 // Status webaware flag +#define STATUS_SHOWIP 0x0002 // Status show ip flag +#define STATUS_BIRTHDAY 0x0008 // User birthday flag +#define STATUS_WEBFRONT 0x0020 // User active webfront flag +#define STATUS_DCDISABLED 0x0100 // Direct connection not supported +#define STATUS_DCAUTH 0x1000 // Direct connection upon authorization +#define STATUS_DCCONT 0x2000 // DC only with contact users + +/* + * DC types + */ +#define DC_DISABLED 0x0000 // Direct connection disabled / auth required +#define DC_HTTPS 0x0001 // Direct connection thru firewall or https proxy +#define DC_SOCKS 0x0002 // Direct connection thru socks4/5 proxy server +#define DC_NORMAL 0x0004 // Normal direct connection (without proxy/firewall) +#define DC_WEB 0x0006 // Web client - no direct connection + + +/* + * Internal constants + */ +#define ICQ_VERSION 8 /* Protocol version */ +#define CLIENTFEATURES 0x3 +#define WEBFRONTPORT 0x50 + + #endif From svn w toxygen.net Wed Oct 1 20:12:30 2008 From: svn w toxygen.net (SVN commit) Date: Wed, 1 Oct 2008 20:12:30 +0200 (CEST) Subject: [ekg2-commit] r4696 - trunk/ekg: trunk/ekg/plugins.h Message-ID: <20081001181230.67C4C17B1F@toxygen.net> Author: darkjames Date: 2008-10-01 20:12:29 +0200 (Wed, 01 Oct 2008) New Revision: 4696 Modified: trunk/ekg/plugins.h Log: fix USINGANANTIQUECOMPILER Modified: trunk/ekg/plugins.h =================================================================== --- trunk/ekg/plugins.h 2008-09-30 22:30:59 UTC (rev 4695) +++ trunk/ekg/plugins.h 2008-10-01 18:12:29 UTC (rev 4696) @@ -104,6 +104,7 @@ static int x##_plugin_destroy(); \ \ plugin_t x##_plugin = { \ + NULL, \ #x, \ 0, \ y, \ From svn w toxygen.net Thu Oct 2 23:06:38 2008 From: svn w toxygen.net (SVN commit) Date: Thu, 2 Oct 2008 23:06:38 +0200 (CEST) Subject: [ekg2-commit] r4697 - trunk/plugins/icq: trunk/plugins/icq/icq.c trunk/plugins/icq/icq.h trunk/plugins/icq/icq_snac_handlers_01service.inc Message-ID: <20081002210638.3A51517B1F@toxygen.net> Author: wiechu Date: 2008-10-02 23:06:37 +0200 (Thu, 02 Oct 2008) New Revision: 4697 Modified: trunk/plugins/icq/icq.c trunk/plugins/icq/icq.h trunk/plugins/icq/icq_snac_handlers_01service.inc Log: - fix memleak - fix, comment & clean code Modified: trunk/plugins/icq/icq.c =================================================================== --- trunk/plugins/icq/icq.c 2008-10-01 18:12:29 UTC (rev 4696) +++ trunk/plugins/icq/icq.c 2008-10-02 21:06:37 UTC (rev 4697) @@ -62,14 +62,17 @@ icq_private_t *j; int fd; - if (!s || !(j = s->priv) || !buf) + if (!s || !(j = s->priv) || !buf) { + string_free(buf, 1); return -1; + } fd = j->fd; debug_io("icq_send_pkt(%s) fd: %d len: %d\n", s->uid, fd, buf->len); icq_hexdump(DEBUG_IO, (unsigned char *) buf->str, buf->len); ekg_write(fd, buf->str, buf->len); + string_free(buf, 1); return 0; } Modified: trunk/plugins/icq/icq.h =================================================================== --- trunk/plugins/icq/icq.h 2008-10-01 18:12:29 UTC (rev 4696) +++ trunk/plugins/icq/icq.h 2008-10-02 21:06:37 UTC (rev 4697) @@ -19,6 +19,7 @@ int discn_lvl; // Disconnect level int curr_lvl; // Current level int max_lvl; // Max level + time_t last_time; // Last time int n_groups; uint32_t *groups; } icq_rate_t; @@ -43,7 +44,7 @@ int ssi; /* server-side-userlist? */ int aim; /* aim-ok? */ int default_group_id; /* XXX ?wo? TEMP! We should support list of groups */ - int status_flags; /* XXX ?wo? set it! */ + int status_flags; int xstatus; /* XXX ?wo? set it! */ private_data_t *whoami; char *default_group_name; Modified: trunk/plugins/icq/icq_snac_handlers_01service.inc =================================================================== --- trunk/plugins/icq/icq_snac_handlers_01service.inc 2008-10-01 18:12:29 UTC (rev 4696) +++ trunk/plugins/icq/icq_snac_handlers_01service.inc 2008-10-02 21:06:37 UTC (rev 4697) @@ -65,7 +65,7 @@ pkt = string_init(NULL); icq_pack_append(pkt, "WW", (uint32_t) 0x22, (uint32_t) 0x01); - icq_pack_append(pkt, "WW", (uint32_t) 0x01, (uint32_t) 0x03); // Generic service controls + icq_pack_append(pkt, "WW", (uint32_t) 0x01, (uint32_t) 0x04); // Generic service controls icq_pack_append(pkt, "WW", (uint32_t) 0x13, (uint32_t) 0x04); // Server Side Information (SSI) service icq_pack_append(pkt, "WW", (uint32_t) 0x02, (uint32_t) 0x01); // Location services icq_pack_append(pkt, "WW", (uint32_t) 0x03, (uint32_t) 0x01); // Buddy List management service @@ -97,6 +97,12 @@ } SNAC_SUBHANDLER(icq_snac_service_redirect) { + /* + * SNAC(01,05) SRV_REDIRECTxSERVICE -- Redirect (for 0x0004 subtype) + * + * Server replies with this to SNAC(01,04) CLI_SERVICE_REQ -- Client service request. + * After receiving this snac client should connect to specified server to use requested service. + */ debug_error("icq_snac_service_redirect() XXX\n"); return 0; } @@ -122,18 +128,23 @@ icq_rates_init(s, pkt.no); for (i=0; in_rates)) { - id--; - j->rates[id]->win_size = x0; // Window size - j->rates[id]->clear_lvl = x1; // Clear level - j->rates[id]->alert_lvl = x2; // Alert level - j->rates[id]->limit_lvl = x3; // Limit level - j->rates[id]->discn_lvl = x4; // Disconnect level - j->rates[id]->curr_lvl = x5; // Current level - j->rates[id]->max_lvl = x6; // Max level + r = j->rates[id - 1]; + r->last_time = time(NULL); + ICQ_UNPACK(&buf, "IIII III 5", + &r->win_size, // Window size + &r->clear_lvl, // Clear level + &r->alert_lvl, // Alert level + &r->limit_lvl, // Limit level + &r->discn_lvl, // Disconnect level + &r->curr_lvl, // Current level + &r->max_lvl // Max level + ); + } else { + buf += 7*4 + 5; + len -= 7*4 + 5; } } // store rate groups @@ -278,22 +289,49 @@ } SNAC_SUBHANDLER(icq_snac_service_pause) { + /* + * SNAC(01,0B) SRV_PAUSE -- Server pause command + * + * This is the first SNAC in client migration sequence. + * + * Client should ack pause command with SNAC(01,0C) and stop send packets until it receive server + * resume SNAC(01,0D), or migration notice SNAC(01,12). + * + * Migration sequence used to redirect client to new BOS server during current BOS shutdown. + */ debug("icq_snac_service_pause() Server is going down in a few seconds...\n"); - /* This is the list of groups that we want to have on the next server */ + icq_send_snac(s, 0x01, 0x0c, NULL, NULL, /* CLI_PAUSE_ACK -- Client pause ack */ + "WWWW WWWW WW", + /* This is the list of families that we want to have on the next server */ + (uint32_t) 0x01, /* Generic service controls */ + (uint32_t) 0x02, /* Location services */ + (uint32_t) 0x03, /* Buddy List management service */ + (uint32_t) 0x04, /* ICBM (messages) service */ - icq_send_snac(s, 0x01, 0x0c, 0, 0, - "WWWWWWWWWW", - (uint32_t) 0x01, (uint32_t) 0x13, - (uint32_t) 0x02, (uint32_t) 0x03, - (uint32_t) 0x17, (uint32_t) 0x04, - (uint32_t) 0x06, (uint32_t) 0x09, - (uint32_t) 0x0a, (uint32_t) 0x0b); + (uint32_t) 0x09, /* Privacy management service */ + (uint32_t) 0x0a, /* User lookup service (not used any more) (XXX ??? - This service used by old AIM clients to search users by email) */ + (uint32_t) 0x0b, /* Usage stats service */ + (uint32_t) 0x13, /* Server Side Information (SSI) service */ + (uint32_t) 0x15, /* ICQ specific extensions service */ + (uint32_t) 0x17 /* Authorization/registration service */ + ); + return 0; } +SNAC_SUBHANDLER(icq_snac_service_resume) { + /* + * SNAC(01,0D) SRV_RESUME -- Server resume command + * + * After this SNAC client, paused by SNAC(01,0B) may continue send packets to BOS. + * Migration sequence used to redirect client to new BOS server during current BOS shutdown. + */ + return 0; +} + SNAC_SUBHANDLER(icq_snac_service_reqinfo) { icq_private_t *j = s->priv; unsigned char *databuf; @@ -372,11 +410,27 @@ } SNAC_SUBHANDLER(icq_snac_service_migrate) { + /* + * SNAC(01,12) SRV_MIGRATION -- Migration notice and info + * + * This is the last SNAC in client migration sequence. + * Client should open new connection to specified server and use this connection for specified families. + * If there is no family list (empty) or it contain all connection families - client should close current + * connection and use new one. + */ debug_error("!!! icq_snac_service_migrate() XXX\n"); return -3; } SNAC_SUBHANDLER(icq_snac_service_motd) { + /* SNAC(01,0x13) SRV_MOTD -- Message of the day (MOTD) */ + struct icq_tlv_list *tlvs; + icq_tlv_t *t; + + tlvs = icq_unpack_tlvs(&buf, &len, 0); + if ( (t = icq_tlv_get(tlvs, 0x0b)) ) + debug_white("icq_snac_service_motd() MOTD: %s\n", t->buf); + icq_tlvs_destroy(&tlvs); return 0; } @@ -393,7 +447,7 @@ } #endif - icq_send_snac(s, 0x01, 0x06, 0, 0, ""); + icq_send_snac(s, 0x01, 0x06, NULL, NULL, ""); // Request rate limits information return 0; } @@ -414,6 +468,7 @@ case 0x07: handler = icq_snac_service_rateinfo; break; /* Miranda: OK */ case 0x0A: handler = icq_snac_service_ratechange;break; /* Miranda: 2/3 OK */ case 0x0B: handler = icq_snac_service_pause; break; /* Miranda: OK */ + case 0x0D: handler = icq_snac_service_resume; break; case 0x0F: handler = icq_snac_service_reqinfo; break; /* Miranda: OK */ case 0x12: handler = icq_snac_service_migrate; break; case 0x13: handler = icq_snac_service_motd; break; /* Miranda: OK */ From svn w toxygen.net Fri Oct 3 00:21:33 2008 From: svn w toxygen.net (SVN commit) Date: Fri, 3 Oct 2008 00:21:33 +0200 (CEST) Subject: [ekg2-commit] r4698 - trunk/plugins/icq: trunk/plugins/icq/icq.c trunk/plugins/icq/icq_snac_handlers_03buddy.inc trunk/plugins/icq/icq_snac_handlers_04message.inc trunk/plugins/icq/misc.c Message-ID: <20081002222133.777F917B1F@toxygen.net> Author: wiechu Date: 2008-10-03 00:21:33 +0200 (Fri, 03 Oct 2008) New Revision: 4698 Modified: trunk/plugins/icq/icq.c trunk/plugins/icq/icq_snac_handlers_03buddy.inc trunk/plugins/icq/icq_snac_handlers_04message.inc trunk/plugins/icq/misc.c Log: add format "s" to icq_pack() Modified: trunk/plugins/icq/icq.c =================================================================== --- trunk/plugins/icq/icq.c 2008-10-02 21:06:37 UTC (rev 4697) +++ trunk/plugins/icq/icq.c 2008-10-02 22:21:33 UTC (rev 4698) @@ -533,8 +533,8 @@ if (len>0) typing = (first == 1) ? 2 : 1; - icq_send_snac(s, 0x04, 0x14, 0, 0, - "iiWuW", q1, q2, (uint16_t) 1, atoi(uid + 4), typing); + icq_send_snac(s, 0x04, 0x14, NULL, NULL, + "iiWsW", q1, q2, (uint16_t) 1, uid + 4, typing); return 0; } Modified: trunk/plugins/icq/icq_snac_handlers_03buddy.inc =================================================================== --- trunk/plugins/icq/icq_snac_handlers_03buddy.inc 2008-10-02 21:06:37 UTC (rev 4697) +++ trunk/plugins/icq/icq_snac_handlers_03buddy.inc 2008-10-02 22:21:33 UTC (rev 4698) @@ -77,7 +77,7 @@ pkt = string_init(NULL); icq_pack_append(pkt, "II", cookie1, cookie2); // cookie icq_pack_append(pkt, "W", (uint32_t) 2); // message type - icq_pack_append(pkt, "u", atoi(uin)); + icq_pack_append(pkt, "s", uin); tlv5 = string_init(NULL); icq_pack_append(tlv5, "W", (uint32_t) 0); @@ -460,9 +460,9 @@ if (!descr) icq_send_snac(s, 0x02, 0x05, NULL, NULL, /* Request user info */ - "Wu", + "Ws", (uint32_t) 1, /* request type (1 - general info, 2 - short user info, 3 - away message, 4 - client capabilities) */ - atoi(uid+4)); + uid+4); if ((u = userlist_find(s, uid))) { user_private_item_set_int(u, "online", 0); Modified: trunk/plugins/icq/icq_snac_handlers_04message.inc =================================================================== --- trunk/plugins/icq/icq_snac_handlers_04message.inc 2008-10-02 21:06:37 UTC (rev 4697) +++ trunk/plugins/icq/icq_snac_handlers_04message.inc 2008-10-02 22:21:33 UTC (rev 4698) @@ -191,11 +191,11 @@ debug_function("icq_send_status_descr() to %s\n", msg_param->uid); pkt = string_init(NULL); - icq_pack_append(pkt, "IIWuW", + icq_pack_append(pkt, "IIWsW", msg_param->id1, // message id part 1 msg_param->id2, // message id part 2 (uint32_t) 2, // channel - atoi(msg_param->sender), + msg_param->sender, (uint32_t) 3 // message formating ); Modified: trunk/plugins/icq/misc.c =================================================================== --- trunk/plugins/icq/misc.c 2008-10-02 21:06:37 UTC (rev 4697) +++ trunk/plugins/icq/misc.c 2008-10-02 22:21:33 UTC (rev 4698) @@ -182,6 +182,14 @@ break; } + case 's': + { + char *buf = va_arg(ap, char *); + + icq_pack_append(str, "C", (uint32_t) xstrlen(buf)); + string_append(str, buf); + break; + } case 'P': /* caps */ { uint32_t t_new = 0x09460000 | va_arg(ap, uint32_t); From svn w toxygen.net Fri Oct 3 23:21:31 2008 From: svn w toxygen.net (SVN commit) Date: Fri, 3 Oct 2008 23:21:31 +0200 (CEST) Subject: [ekg2-commit] r4699 - trunk/plugins/icq: trunk/plugins/icq/icq_snac_handlers_03buddy.inc trunk/plugins/icq/icq_snac_handlers_04message.inc Message-ID: <20081003212131.F3C0317B1F@toxygen.net> Author: wiechu Date: 2008-10-03 23:21:31 +0200 (Fri, 03 Oct 2008) New Revision: 4699 Modified: trunk/plugins/icq/icq_snac_handlers_03buddy.inc trunk/plugins/icq/icq_snac_handlers_04message.inc Log: start send message ack Modified: trunk/plugins/icq/icq_snac_handlers_03buddy.inc =================================================================== --- trunk/plugins/icq/icq_snac_handlers_03buddy.inc 2008-10-02 22:21:33 UTC (rev 4698) +++ trunk/plugins/icq/icq_snac_handlers_03buddy.inc 2008-10-03 21:21:31 UTC (rev 4699) @@ -57,6 +57,34 @@ return 0; } + +static void icq_pack_append_nullterm_msg(string_t pkt, char *msg) { + icq_pack_append(pkt, "w", (uint32_t) xstrlen(msg)+1); // null-terminated msg length + if (xstrlen(msg)) + string_append(pkt, msg); + icq_pack_append(pkt, "c", (uint32_t) 0); // msg terminate +} + +static void icq_pack_append_rendezvous(string_t pkt, int version, int cookie, int mtype, int mflags, int accept, int priority) { + icq_pack_append(pkt, "wwiiiiwicw wwiiiccww", + (uint32_t) 27, // length of this data segment, always 27 + (uint32_t) version, // protocol version + (uint32_t) 0, (uint32_t) 0, (uint32_t) 0, (uint32_t) 0, // PSIG_MESSAGE + (uint32_t) 0, // unknown + (uint32_t) 3, // client capabilities flag + (uint32_t) 0, // unknown byte + cookie, // cookie + + (uint32_t) 14, // length of this data segment, always 14 + cookie, // cookie + (uint32_t) 0, (uint32_t) 0, (uint32_t) 0, // unknown, usually all zeros + mtype, // msg type + mflags, // msg flags + (uint32_t) accept, // status code - accepted + (uint32_t) priority // priority ??? XXX + ); +} + static void icq_get_description(session_t *s, char *uin, int status) { icq_private_t *j = s->priv; string_t pkt, tlv5, rdv; @@ -88,25 +116,8 @@ // RendezvousMessageData rdv = string_init(NULL); - icq_pack_append(rdv, "wwiiiiwicw wwiiiccwwwc", - (uint32_t) 27, // length of this data segment, always 27 - (uint32_t) 9, // protocol version (we want utf-8 description) - (uint32_t) 0, (uint32_t) 0, (uint32_t) 0, (uint32_t) 0, // pluginID - (uint32_t) 0, // unknown - (uint32_t) 3, // client capabilities flag - (uint32_t) 0, // unknown byte - cookie, // cookie - - (uint32_t) 14, // length of this data segment, always 14 - cookie, // cookie - (uint32_t) 0, (uint32_t) 0, (uint32_t) 0, // unknown, usually all zeros - mtype, // msg type - (uint32_t) MFLAG_AUTO, // msg flags - (uint32_t) 1, // status code ??? XXX - (uint32_t) 1, // priority ??? XXX - (uint32_t) 1, // msg length - (uint32_t) 0); // msg - + icq_pack_append_rendezvous(rdv, 9, cookie, mtype, MFLAG_AUTO, 1, 1); + icq_pack_append_nullterm_msg(rdv, ""); icq_pack_append(tlv5, "T", icq_pack_tlv(0x2711, rdv->str, rdv->len)); string_free(rdv, 1); Modified: trunk/plugins/icq/icq_snac_handlers_04message.inc =================================================================== --- trunk/plugins/icq/icq_snac_handlers_04message.inc 2008-10-02 22:21:33 UTC (rev 4698) +++ trunk/plugins/icq/icq_snac_handlers_04message.inc 2008-10-03 21:21:31 UTC (rev 4699) @@ -31,6 +31,8 @@ */ char *sender; int ack_type; + int msg_type; /* message type */ + int msg_flags; /* message flags */ int version; int cookie; char uid[50]; @@ -86,6 +88,27 @@ return 0; } +static void icq_pack_append_msg_header(string_t pkt, msg_params_t *msg_param) { + icq_pack_append(pkt, "IIWsW", + msg_param->id1, // message id part 1 + msg_param->id2, // message id part 2 + (uint32_t) 2, // channel + msg_param->sender, + (uint32_t) 3 // message formating + ); +} + +static void icq_send_adv_msg_ack(session_t *s, msg_params_t *msg_param) { + string_t pkt = string_init(NULL); + + icq_pack_append_msg_header(pkt, msg_param); + icq_pack_append_rendezvous(pkt, ICQ_VERSION, msg_param->cookie, msg_param->msg_type, msg_param->msg_flags, 0, 0); + icq_pack_append_nullterm_msg(pkt, ""); + + icq_makesnac(s, pkt, 0x04, 0x0b, NULL, NULL); /* */ + icq_send_pkt(s, pkt); +} + static int icq_snac_message_recv_icbm_ch1(session_t *s, unsigned char *buf, int len, msg_params_t *msg_param) { struct icq_tlv_list *tlvs; struct icq_tlv_list *tlvs_msg; @@ -183,6 +206,7 @@ static void icq_send_status_descr(session_t *s, int msg_type, msg_params_t *msg_param) { string_t pkt; + char *desc; if (!msg_param->u) { debug_warn("icq_send_status_descr(). Ignore request from %s\n", msg_param->uid); @@ -191,43 +215,16 @@ debug_function("icq_send_status_descr() to %s\n", msg_param->uid); pkt = string_init(NULL); - icq_pack_append(pkt, "IIWsW", - msg_param->id1, // message id part 1 - msg_param->id2, // message id part 2 - (uint32_t) 2, // channel - msg_param->sender, - (uint32_t) 3 // message formating - ); - icq_pack_append(pkt, "wwiiiiwicw wwiiiccww", - (uint32_t) 27, // length of this data segment, always 27 - (uint32_t) msg_param->version, // protocol version (we want utf-8 description) - (uint32_t) 0, (uint32_t) 0, (uint32_t) 0, (uint32_t) 0, // PSIG_MESSAGE - (uint32_t) 0, // unknown - (uint32_t) 3, // client capabilities flag - (uint32_t) 0, // unknown byte (dc type?) - msg_param->cookie, // cookie - - (uint32_t) 14, // length of this data segment, always 14 - msg_param->cookie, // cookie - (uint32_t) 0, (uint32_t) 0, (uint32_t) 0, // unknown, usually all zeros - msg_type, // msg type - (uint32_t) MFLAG_AUTO, // msg flags - (uint32_t) 0, // status code: 0 - accepted - (uint32_t) 0); // priority - - char *desc = xstrdup(s->descr); - + desc = xstrdup(s->descr); + icq_pack_append_msg_header(pkt, msg_param); + icq_pack_append_rendezvous(pkt, msg_param->version, msg_param->cookie, msg_type, MFLAG_AUTO, 0, 0); if (msg_param->version == 9) /* unicode */ desc = ekg_locale_to_utf8(desc); else { /* XXX recode? */ } - - icq_pack_append(pkt, "w", xstrlen(desc)+1); - string_append(pkt, desc); - icq_pack_append(pkt, "c", 0); - + icq_pack_append_nullterm_msg(pkt, desc); xfree(desc); icq_makesnac(s, pkt, 0x04, 0x0b, NULL, NULL); @@ -291,6 +288,11 @@ ICQ_UNPACK(&buf, "ccwww", &msg.type, &msg.flags, &msg.status, &msg.prio, &msg.len); msg.str = (char *)buf; + debug_white("icq_snac_message_recv_rtf2711() PSIG_MESSAGE, msg type:0x%x, flags:0x%x, ack:0x%x\n", msg.type, msg.flags, msg_param->ack_type); + + msg_param->msg_type = msg.type; + msg_param->msg_flags = msg.flags; + switch (msg.type) { /* strange types - XXX ?wo? handle? */ case MTYPE_FILEREQ: @@ -306,9 +308,11 @@ /* Somebody ask for our status */ icq_send_status_descr(s, msg.type, msg_param); break; - default: - /* normal message */ - if (msg.len) { + case MTYPE_PLAIN: /* plain message */ + { + buf += msg.len; + len -= msg.len; + if (msg.len > 0) { time_t sent = time(NULL); char *tmp = ekg_utf8_to_locale(xstrdup(msg.str)); @@ -316,7 +320,13 @@ xfree(tmp); } + icq_send_adv_msg_ack(s, msg_param); break; + } + + default: + debug_error("icq_snac_message_recv_rtf2711() PSIG_MESSAGE, Not supported message type:0x%x\n", msg.type); + break; } break; } @@ -399,7 +409,7 @@ else msg_param->ack_type = 1; - if ( msg_param->u && (t = icq_tlv_get(tlvs5, 0x0a)) ) // External IP + if ( msg_param->u && (t = icq_tlv_get(tlvs5, 0x03)) ) // External IP user_private_item_set_int(msg_param->u, "IP", t->nr); if (!(t2711 = icq_tlv_get(tlvs5, 0x2711))) { @@ -470,7 +480,6 @@ /* XXX, spamer? */ tlvs = icq_unpack_tlvs(&buf, &len, pkt.tlv_count); - /* XXX ?wo? Handle tvls? */ /* * TLV.Type(0x01) - user class * TLV.Type(0x03) - account creation time From svn w toxygen.net Sat Oct 4 16:48:11 2008 From: svn w toxygen.net (SVN commit) Date: Sat, 4 Oct 2008 16:48:11 +0200 (CEST) Subject: [ekg2-commit] r4700 - in trunk: ekg scons.d: trunk/ekg/xmalloc.c trunk/scons.d/standard Message-ID: <20081004144811.BD82817B3A@toxygen.net> Author: peres Date: 2008-10-04 16:48:11 +0200 (Sat, 04 Oct 2008) New Revision: 4700 Modified: trunk/ekg/xmalloc.c trunk/scons.d/standard Log: Use vasprintf() when available. Modified: trunk/ekg/xmalloc.c =================================================================== --- trunk/ekg/xmalloc.c 2008-10-03 21:21:31 UTC (rev 4699) +++ trunk/ekg/xmalloc.c 2008-10-04 14:48:11 UTC (rev 4700) @@ -222,6 +222,14 @@ */ char *vsaprintf(const char *format, va_list ap) { + char *res; +#ifdef HAVE_VASPRINTF + + if (vasprintf(&res, format, ap) == -1 || res == NULL) + ekg_oom_handler(); + +#else /* HAVE_VASPRINTF */ + #ifdef NO_POSIX_SYSTEM char tmp[10000]; #else @@ -230,7 +238,6 @@ #if defined(va_copy) || defined(__va_copy) va_list aq; #endif - char *res; int size; #if defined(va_copy) @@ -246,6 +253,8 @@ #else vsnprintf(res, size + 1, format, ap); #endif + +#endif return res; } Modified: trunk/scons.d/standard =================================================================== --- trunk/scons.d/standard 2008-10-03 21:21:31 UTC (rev 4699) +++ trunk/scons.d/standard 2008-10-04 14:48:11 UTC (rev 4700) @@ -6,7 +6,8 @@ std_funcs = [ 'inet_aton', 'inet_ntop', 'inet_pton', 'getaddrinfo', 'utimes', 'flock', - 'mkstemp' + 'mkstemp', + 'vasprintf' ] std_headers = [ From svn w toxygen.net Sat Oct 4 22:50:02 2008 From: svn w toxygen.net (SVN commit) Date: Sat, 4 Oct 2008 22:50:02 +0200 (CEST) Subject: [ekg2-commit] r4701 - trunk/plugins/icq: trunk/plugins/icq/icq.c trunk/plugins/icq/icq_caps.c trunk/plugins/icq/icq_caps.h trunk/plugins/icq/icq_snac_handlers.h trunk/plugins/icq/icq_snac_handlers_03buddy.inc Message-ID: <20081004205002.19D1317B3A@toxygen.net> Author: wiechu Date: 2008-10-04 22:50:01 +0200 (Sat, 04 Oct 2008) New Revision: 4701 Modified: trunk/plugins/icq/icq.c trunk/plugins/icq/icq_caps.c trunk/plugins/icq/icq_caps.h trunk/plugins/icq/icq_snac_handlers.h trunk/plugins/icq/icq_snac_handlers_03buddy.inc Log: start sending channel 2 (TLV 0x2711) messages Modified: trunk/plugins/icq/icq.c =================================================================== --- trunk/plugins/icq/icq.c 2008-10-04 14:48:11 UTC (rev 4700) +++ trunk/plugins/icq/icq.c 2008-10-04 20:50:01 UTC (rev 4701) @@ -835,7 +835,7 @@ array_free(argv); } - /* sent packet */ + /* send packet */ if (nickname) { uint16_t min = 0xffff, max = 0, count = 0, iid; string_t buddies = string_init(NULL), data = string_init(NULL); @@ -921,9 +921,96 @@ return 0; } +static void icq_send_msg_ch1(session_t *session, const char *uid, const char *message) { + string_t pkt; + string_t tlv_2, tlv_101; + userlist_t *u = userlist_find(session, uid); + uint16_t enc = 0; /* ASCII */ + const char *tmp = message; + + while (*tmp) { + if ((*tmp++ & 0x80)) { + enc = 2; /* not ascii char */ + break; + } + } + if ( enc && !(u || user_private_item_get_int(u, "utf")) ) + enc = 3; /* ANSI -- XXX ?wo? what should we do now? */ + + /* TLV(101) */ + tlv_101 = icq_pack("WW", enc, 0x00); // encoding, codepage + if (enc == 2) { + /* send unicode message */ + string_t recode = icq_convert_to_ucs2be((char *) message); + string_append_raw(tlv_101, recode->str, recode->len); + string_free(recode, 1); + } else { + /* send ASCII/ANSII message */ + string_append(tlv_101, message); + } + + /* TLV(2) */ + tlv_2 = icq_pack("tcT", + icq_pack_tlv_char(0x501, 0x1), /* TLV(501) features, meaning unknown, duplicated from ICQ Lite */ + icq_pack_tlv(0x0101, tlv_101->str, tlv_101->len)/* TLV(101) text TLV. */ + ); + string_free(tlv_101, 1); + + /* main packet */ + pkt = icq_pack("iiWs", (uint32_t) rand(), (uint32_t) rand(), 1, uid+4); // msgid1, msgid2, channel, recipient + icq_pack_append(pkt, "TTT", + icq_pack_tlv(0x02, tlv_2->str, tlv_2->len), /* TLV(2) message-block */ + icq_pack_tlv(0x03, NULL, 0), /* TLV(3) server-ack */ + icq_pack_tlv(0x06, NULL, 0) /* TLV(6) received-offline */ + ); + + string_free(tlv_2, 1); + + /* message-header */ + icq_makesnac(session, pkt, 0x04, 0x06, NULL, NULL); // CLI_SEND_ICBM -- Send message thru server + icq_send_pkt(session, pkt); +} + +static void icq_send_msg_ch2(session_t *session, const char *uid, const char *message) { + string_t pkt, t5, t2711; + uint32_t msgid1 = rand(), msgid2 = rand(); + int prio = 1; + icq_private_t *j = session->priv; + int cookie = j->snac_seq++; + + t5 = string_init(NULL); + icq_pack_append(t5, "WII", 0, msgid1, msgid2); // + icq_pack_append_cap(t5, CAP_SRV_RELAY); + icq_pack_append(t5, "tW", icq_pack_tlv_word(0x0a, 1)); + icq_pack_append(t5, "T", icq_pack_tlv(0x0f, NULL, 0)); // empty TLV(0x0f) + + t2711 = string_init(NULL); +{ + icq_pack_append_rendezvous(t2711, ICQ_VERSION, cookie, MTYPE_PLAIN, 0, 1, prio); + char *recode = ekg_locale_to_utf8(xstrdup(message)); + icq_pack_append_nullterm_msg(t2711, recode); + xfree(recode); + icq_pack_append(t2711, "II", 0, 0xffffffff); // XXX text & background colors + icq_pack_append(t2711, "i", xstrlen(CAP_UTF8_str)); + string_append(t2711, CAP_UTF8_str); +} + icq_pack_append(t5, "T", icq_pack_tlv(0x2711, t2711->str, t2711->len)); + string_free(t2711, 1); + + + /* main packet */ + pkt = icq_pack("iiWs", msgid1, msgid2, 2, uid+4); // msgid1, msgid2, channel, recipient + icq_pack_append(pkt, "T", icq_pack_tlv(0x05, t5->str, t5->len)); + + /* message-header */ + icq_makesnac(session, pkt, 0x04, 0x06, NULL, NULL); // CLI_SEND_ICBM -- Send message thru server + icq_send_pkt(session, pkt); +} + static COMMAND(icq_command_msg) { uint32_t uin; char *uid; + userlist_t *u; if (!xstrcmp(target, "*")) { if (msg_all(session, name, params[1]) == -1) @@ -951,56 +1038,11 @@ query_emit_id(NULL, PROTOCOL_TYPING_OUT, &sid, &uid, &len, &first); } - /* sent message */ - { - string_t pkt; - string_t tlv_2, tlv_101; - userlist_t *u = userlist_find(session, uid); - uint16_t enc = 0; /* ASCII */ - const char *tmp = params[1]; - - while (*tmp) { - if ((*tmp++ & ~0x7f)) { - enc = 2; /* not ascii char */ - break; - } - } - if ( enc && !(u || user_private_item_get_int(u, "utf")) ) - enc = 3; /* ANSI -- XXX ?wo? what should we do now? */ - - /* TLV(101) */ - if (enc == 2) { - /* send unicode message */ - string_t recode = icq_convert_to_ucs2be((char *) params[1]); - tlv_101 = icq_pack("WW", 0x02, 0x00); - string_append_raw(tlv_101, recode->str, recode->len); - string_free(recode, 1); - } else { - /* send ASCII/ANSII message */ - tlv_101 = icq_pack("WW", enc, 0x00); // encoding, codepage, copied from ICQ lite - string_append(tlv_101, params[1]); - } - - /* TLV(2) */ - tlv_2 = icq_pack("tcT", - icq_pack_tlv_char(0x501, 0x1), /* TLV(501) features, meaning unknown, duplicated from ICQ Lite */ - icq_pack_tlv(0x0101, tlv_101->str, tlv_101->len)/* TLV(101) text TLV. */ - ); - string_free(tlv_101, 1); - - /* main packet */ - pkt = icq_pack("iiWu", (uint32_t) rand(), (uint32_t) rand(), 0x01, (uint32_t) uin); - icq_pack_append(pkt, "TTT", - icq_pack_tlv(0x02, tlv_2->str, tlv_2->len), /* TLV(2) message-block */ - icq_pack_tlv(0x03, NULL, 0), /* TLV(3) server-ack */ - icq_pack_tlv(0x06, NULL, 0) /* TLV(6) received-offline */ - ); - - /* message-header */ - icq_makesnac(session, pkt, 0x04, 0x06, NULL, NULL); - icq_send_pkt(session, pkt); - - string_free(tlv_2, 1); + u = userlist_find(session, uid); + if (u && (u->status != EKG_STATUS_NA) && (user_private_item_get_int(u, "caps") & 1< Author: peres Date: 2008-10-05 09:47:11 +0200 (Sun, 05 Oct 2008) New Revision: 4702 Modified: trunk/ekg/audio.h trunk/ekg/bindings.h trunk/ekg/commands.h trunk/ekg/configfile.h trunk/ekg/debug.h trunk/ekg/dynstuff.h trunk/ekg/dynstuff_inline.h trunk/ekg/emoticons.h trunk/ekg/events.h trunk/ekg/log.h trunk/ekg/metacontacts.h trunk/ekg/msgqueue.h trunk/ekg/net.h trunk/ekg/objects.h trunk/ekg/plugins.h trunk/ekg/protocol.h trunk/ekg/queries.h trunk/ekg/recode.h trunk/ekg/scripts.h trunk/ekg/sessions.h trunk/ekg/srv.h trunk/ekg/strings.h trunk/ekg/stuff.h trunk/ekg/themes.h trunk/ekg/userlist.h trunk/ekg/vars.h trunk/ekg/win32.h trunk/ekg/windows.h Log: Maybe that helps dmil, maybe not. Either, good to have one. Modified: trunk/ekg/audio.h =================================================================== --- trunk/ekg/audio.h 2008-10-04 20:50:01 UTC (rev 4701) +++ trunk/ekg/audio.h 2008-10-05 07:47:11 UTC (rev 4702) @@ -23,6 +23,10 @@ #include "dynstuff.h" #include "plugins.h" +#ifdef __cplusplus +extern "C" { +#endif + typedef enum { AUDIO_CONTROL_INIT = 0, AUDIO_CONTROL_SET, AUDIO_CONTROL_GET, AUDIO_CONTROL_DEINIT, AUDIO_CONTROL_HELP } audio_control_t; typedef enum { AUDIO_READ = 0, AUDIO_WRITE, AUDIO_RDWR, } @@ -131,6 +135,9 @@ int audio_initialize(); int audio_deinitialize(); +#ifdef __cplusplus +} +#endif #endif /* __EKG_AUDIO_H */ Modified: trunk/ekg/bindings.h =================================================================== --- trunk/ekg/bindings.h 2008-10-04 20:50:01 UTC (rev 4701) +++ trunk/ekg/bindings.h 2008-10-05 07:47:11 UTC (rev 4702) @@ -1,6 +1,10 @@ #ifndef __EKG_BINDINGS_H #define __EKG_BINDINGS_H +#ifdef __cplusplus +extern "C" { +#endif + #define BINDING_FUNCTION(x) void x(const char *arg) struct binding { @@ -35,4 +39,8 @@ void binding_free(); +#ifdef __cplusplus +} #endif + +#endif Modified: trunk/ekg/commands.h =================================================================== --- trunk/ekg/commands.h 2008-10-04 20:50:01 UTC (rev 4701) +++ trunk/ekg/commands.h 2008-10-05 07:47:11 UTC (rev 4702) @@ -26,6 +26,10 @@ #include "themes.h" #include "sessions.h" +#ifdef __cplusplus +extern "C" { +#endif + #define printq(x...) do { if (!quiet) { print(x); } } while(0) #define COMMAND(x) int x(const char *name, const char **params, session_t *session, const char *target, int quiet) @@ -117,6 +121,10 @@ extern char *last_search_uid; #endif +#ifdef __cplusplus +} +#endif + #endif /* __EKG_COMMANDS_H */ /* Modified: trunk/ekg/configfile.h =================================================================== --- trunk/ekg/configfile.h 2008-10-04 20:50:01 UTC (rev 4701) +++ trunk/ekg/configfile.h 2008-10-05 07:47:11 UTC (rev 4702) @@ -28,6 +28,10 @@ #include "plugins.h" +#ifdef __cplusplus +extern "C" { +#endif + void config_postread(); int config_read(const char *filename); int config_read_plugins(); @@ -37,8 +41,12 @@ void config_write_crash(); void debug_write_crash(); +#ifdef __cplusplus +} #endif +#endif + #endif /* __EKG_CONFIGFILE_H */ /* Modified: trunk/ekg/debug.h =================================================================== --- trunk/ekg/debug.h 2008-10-04 20:50:01 UTC (rev 4701) +++ trunk/ekg/debug.h 2008-10-05 07:47:11 UTC (rev 4702) @@ -3,6 +3,10 @@ #ifndef __EKG_DEBUG_H #define __EKG_DEBUG_H +#ifdef __cplusplus +extern "C" { +#endif + typedef enum { DEBUG_IO = 1, DEBUG_IORECV, @@ -32,9 +36,13 @@ #define debug_ok(args...) debug_ext(DEBUG_OK, args) #define debug_wtf(args...) debug_ext(DEBUG_WTF, args) +#ifdef __cplusplus +} #endif +#endif + /* * Local Variables: * mode: c Modified: trunk/ekg/dynstuff.h =================================================================== --- trunk/ekg/dynstuff.h 2008-10-04 20:50:01 UTC (rev 4701) +++ trunk/ekg/dynstuff.h 2008-10-05 07:47:11 UTC (rev 4702) @@ -22,6 +22,10 @@ #ifndef __EKG_DYNSTUFF_H #define __EKG_DYNSTUFF_H +#ifdef __cplusplus +extern "C" { +#endif + /* * typedef list_t * @@ -203,6 +207,9 @@ void private_items_destroy(private_data_t **data); +#ifdef __cplusplus +} +#endif #endif /* __EKG_DYNSTUFF_H */ Modified: trunk/ekg/dynstuff_inline.h =================================================================== --- trunk/ekg/dynstuff_inline.h 2008-10-04 20:50:01 UTC (rev 4701) +++ trunk/ekg/dynstuff_inline.h 2008-10-05 07:47:11 UTC (rev 4702) @@ -9,6 +9,10 @@ # include #endif +#ifdef __cplusplus +extern "C" { +#endif + #if DYNSTUFF_USE_LIST3 #define __DYNSTUFF_LIST_ADD(lista, typ, __notused) \ @@ -415,5 +419,8 @@ #define DYNSTUFF_LIST_DECLARE_SORTED_NF(lista, type, compare_func, list_add, list_unlink) \ DYNSTUFF_LIST_DECLARE_FULL(lista, type, compare_func, NULL, list_add, __DYNSTUFF_NOREMOVE, __DYNSTUFF_NOREMOVE, list_unlink, __DYNSTUFF_NODESTROY, __DYNSTUFF_NOCOUNT) +#ifdef __cplusplus +} +#endif #endif Modified: trunk/ekg/emoticons.h =================================================================== --- trunk/ekg/emoticons.h 2008-10-04 20:50:01 UTC (rev 4701) +++ trunk/ekg/emoticons.h 2008-10-05 07:47:11 UTC (rev 4702) @@ -24,10 +24,18 @@ #ifndef __EKG_EMOTICONS_H #define __EKG_EMOTICONS_H +#ifdef __cplusplus +extern "C" { +#endif + int emoticon_read(); char *emoticon_expand(const char *s); void emoticons_destroy(); +#ifdef __cplusplus +} +#endif + #endif /* __EKG_EMOTICONS_H */ /* Modified: trunk/ekg/events.h =================================================================== --- trunk/ekg/events.h 2008-10-04 20:50:01 UTC (rev 4701) +++ trunk/ekg/events.h 2008-10-05 07:47:11 UTC (rev 4702) @@ -24,6 +24,10 @@ #include "plugins.h" #include "stuff.h" +#ifdef __cplusplus +extern "C" { +#endif + typedef struct event { struct event *next; @@ -42,6 +46,10 @@ void event_free(); int events_init(); +#ifdef __cplusplus +} +#endif + #endif /* __EKG_EVENTS_H */ Modified: trunk/ekg/log.h =================================================================== --- trunk/ekg/log.h 2008-10-04 20:50:01 UTC (rev 4701) +++ trunk/ekg/log.h 2008-10-05 07:47:11 UTC (rev 4702) @@ -29,6 +29,10 @@ #include "dynstuff.h" +#ifdef __cplusplus +extern "C" { +#endif + struct last { struct last *next; unsigned int type : 1; /* 0 - przychodząca, 1 - wychodząca */ @@ -50,6 +54,10 @@ #endif +#ifdef __cplusplus +} +#endif + #endif /* __EKG_LOG_H */ /* Modified: trunk/ekg/metacontacts.h =================================================================== --- trunk/ekg/metacontacts.h 2008-10-04 20:50:01 UTC (rev 4701) +++ trunk/ekg/metacontacts.h 2008-10-05 07:47:11 UTC (rev 4702) @@ -21,6 +21,10 @@ #define __EKG_METACONTACTS_H #include "dynstuff.h" +#ifdef __cplusplus +extern "C" { +#endif + typedef struct metacontact_item { struct metacontact_item *next; @@ -51,6 +55,10 @@ #endif +#ifdef __cplusplus +} +#endif + #endif /* __EKG_METACONTACTS_H */ Modified: trunk/ekg/msgqueue.h =================================================================== --- trunk/ekg/msgqueue.h 2008-10-04 20:50:01 UTC (rev 4701) +++ trunk/ekg/msgqueue.h 2008-10-05 07:47:11 UTC (rev 4702) @@ -27,6 +27,10 @@ #include "dynstuff.h" #include "protocol.h" +#ifdef __cplusplus +extern "C" { +#endif + typedef struct msg_queue { struct msg_queue *next; @@ -50,6 +54,10 @@ int msg_queue_read(); int msg_queue_write(); +#ifdef __cplusplus +} +#endif + #endif /* __EKG_MSGQUEUE_H */ /* Modified: trunk/ekg/net.h =================================================================== --- trunk/ekg/net.h 2008-10-04 20:50:01 UTC (rev 4701) +++ trunk/ekg/net.h 2008-10-05 07:47:11 UTC (rev 4702) @@ -25,6 +25,10 @@ #include "sessions.h" #include "srv.h" +#ifdef __cplusplus +extern "C" { +#endif + #ifndef INADDR_NONE # define INADDR_NONE (unsigned long) 0xffffffff #endif @@ -35,6 +39,10 @@ watch_t *ekg_connect(session_t *session, const char *server, const int proto_port, const int port, watcher_handler_func_t async); +#ifdef __cplusplus +} +#endif + #endif /* EKG2_WIN32_NOFUNCTION */ #endif /* __EKG_NET_H */ Modified: trunk/ekg/objects.h =================================================================== --- trunk/ekg/objects.h 2008-10-04 20:50:01 UTC (rev 4701) +++ trunk/ekg/objects.h 2008-10-05 07:47:11 UTC (rev 4702) @@ -22,6 +22,10 @@ #include "xmalloc.h" +#ifdef __cplusplus +extern "C" { +#endif + #define PROPERTY_INT_GET(object,property,type) \ \ type object##_##property##_get(object##_t *o) \ @@ -124,8 +128,10 @@ PROPERTY_MISC_GET(object,property,type,null) \ PROPERTY_MISC_SET(object,property,type) +#ifdef __cplusplus +} +#endif - #endif /* __EKG_OOP_H */ Modified: trunk/ekg/plugins.h =================================================================== --- trunk/ekg/plugins.h 2008-10-04 20:50:01 UTC (rev 4701) +++ trunk/ekg/plugins.h 2008-10-05 07:47:11 UTC (rev 4702) @@ -26,6 +26,10 @@ #include "dynstuff.h" #include "sessions.h" +#ifdef __cplusplus +extern "C" { +#endif + #define EKG_ABI_VER 4633 #define EXPORT __attribute__ ((visibility("default"))) @@ -252,6 +256,10 @@ extern query_t *queries[]; #endif +#ifdef __cplusplus +} +#endif + #endif /* __EKG_PLUGINS_H */ /* Modified: trunk/ekg/protocol.h =================================================================== --- trunk/ekg/protocol.h 2008-10-04 20:50:01 UTC (rev 4701) +++ trunk/ekg/protocol.h 2008-10-05 07:47:11 UTC (rev 4702) @@ -30,6 +30,10 @@ #include /* size_t */ #include /* off_t */ +#ifdef __cplusplus +extern "C" { +#endif + #define EKG_FORMAT_RGB_MASK 0x00ffffffL /* 0x00BBGGRR */ #define EKG_FORMAT_R_MASK 0x00ff0000L #define EKG_FORMAT_G_MASK 0x0000ff00L @@ -149,6 +153,10 @@ #endif +#ifdef __cplusplus +} +#endif + #endif /* __EKG_PROTOCOL_H */ /* Modified: trunk/ekg/queries.h =================================================================== --- trunk/ekg/queries.h 2008-10-04 20:50:01 UTC (rev 4701) +++ trunk/ekg/queries.h 2008-10-05 07:47:11 UTC (rev 4702) @@ -1,6 +1,10 @@ #ifndef __EKG_QUERIES #define __EKG_QUERIES +#ifdef __cplusplus +extern "C" { +#endif + #define QUERY_ARGS_MAX 12 enum query_arg_type { @@ -469,5 +473,9 @@ #endif +#ifdef __cplusplus +} #endif +#endif + Modified: trunk/ekg/recode.h =================================================================== --- trunk/ekg/recode.h 2008-10-04 20:50:01 UTC (rev 4701) +++ trunk/ekg/recode.h 2008-10-05 07:47:11 UTC (rev 4702) @@ -3,6 +3,10 @@ #include "dynstuff.h" +#ifdef __cplusplus +extern "C" { +#endif + enum ekg_recode_name { EKG_RECODE_CP = 0, EKG_RECODE_LATIN2, @@ -38,5 +42,8 @@ char *ekg_any_to_locale(char *buf, char *inp); char *ekg_locale_to_any(char *buf, char *inp); +#ifdef __cplusplus +} +#endif #endif Modified: trunk/ekg/scripts.h =================================================================== --- trunk/ekg/scripts.h 2008-10-04 20:50:01 UTC (rev 4701) +++ trunk/ekg/scripts.h 2008-10-05 07:47:11 UTC (rev 4702) @@ -9,6 +9,10 @@ #include "vars.h" #include "queries.h" +#ifdef __cplusplus +extern "C" { +#endif + #define SCRIPT_HANDLE_UNBIND -666 #define MAX_ARGS QUERY_ARGS_MAX+1 @@ -199,7 +203,6 @@ SCRIPT_HANDLER_HEADER(script_free_bind_t);\ SCRIPT_HANDLER_FOOTER(script_free_bind, type, temp->private, args);\ } -#endif /* BINDING && UNBINDING */ @@ -247,3 +250,8 @@ /* foreach y->list->next do SCRIPT_HANDLER_FOOTER(y->list->data, _args); */\ SCRIPT_HANDLER_FOOTER(y, _args) +#ifdef __cplusplus +} +#endif + +#endif Modified: trunk/ekg/sessions.h =================================================================== --- trunk/ekg/sessions.h 2008-10-04 20:50:01 UTC (rev 4701) +++ trunk/ekg/sessions.h 2008-10-05 07:47:11 UTC (rev 4702) @@ -24,6 +24,10 @@ #include #include "dynstuff.h" +#ifdef __cplusplus +extern "C" { +#endif + /* --NOTE-- * When modifying status_t, remember to update status tables in stuff.c! */ @@ -208,6 +212,10 @@ void session_help(session_t *s, const char *name); #endif +#ifdef __cplusplus +} +#endif + #endif /* __EKG_SESSIONS_H */ /* Modified: trunk/ekg/srv.h =================================================================== --- trunk/ekg/srv.h 2008-10-04 20:50:01 UTC (rev 4701) +++ trunk/ekg/srv.h 2008-10-05 07:47:11 UTC (rev 4702) @@ -18,6 +18,10 @@ #ifndef __EKG_SRV_H #define __EKG_SRV_H +#ifdef __cplusplus +extern "C" { +#endif + typedef struct _gim_host gim_host; char *ekg_inet_ntostr(int family, void *buf); @@ -33,6 +37,10 @@ #define DNS_SRV_MAX_PRIO 0xffff extern const int DNS_NS_MAXDNAME; +#ifdef __cplusplus +} +#endif + #endif /* __EKG_SRV_H */ /* Modified: trunk/ekg/strings.h =================================================================== --- trunk/ekg/strings.h 2008-10-04 20:50:01 UTC (rev 4701) +++ trunk/ekg/strings.h 2008-10-05 07:47:11 UTC (rev 4702) @@ -28,6 +28,10 @@ #include /* wchar_t stuff */ +#ifdef __cplusplus +extern "C" { +#endif + extern int config_use_unicode; /* not everyone want to include stuff.h */ #define CHAR_T wchar_t @@ -55,6 +59,10 @@ #include +#ifdef __cplusplus +extern "C" { +#endif + #define CHAR_T unsigned char #define TEXT(x) x #define CHAR(x) x @@ -76,5 +84,8 @@ #endif /* USE_UNICODE */ +#ifdef __cplusplus +} +#endif #endif /* __EKG_STRINGS_H */ Modified: trunk/ekg/stuff.h =================================================================== --- trunk/ekg/stuff.h 2008-10-04 20:50:01 UTC (rev 4701) +++ trunk/ekg/stuff.h 2008-10-05 07:47:11 UTC (rev 4702) @@ -46,6 +46,10 @@ #include "sessions.h" #include "userlist.h" +#ifdef __cplusplus +extern "C" { +#endif + #define DEBUG_MAX_LINES 50 /* ile linii z debug zrzucać do pliku */ /* obsługa procesów potomnych */ @@ -387,6 +391,10 @@ #endif +#ifdef __cplusplus +} +#endif + #endif /* __EKG_STUFF_H */ /* Modified: trunk/ekg/themes.h =================================================================== --- trunk/ekg/themes.h 2008-10-04 20:50:01 UTC (rev 4701) +++ trunk/ekg/themes.h 2008-10-05 07:47:11 UTC (rev 4702) @@ -29,6 +29,10 @@ #include "dynstuff.h" #include "sessions.h" +#ifdef __cplusplus +extern "C" { +#endif + typedef struct { union { char *b; /* possibly multibyte string */ @@ -101,6 +105,10 @@ FSTR_ALTCHARSET = 2048 } fstr_t; +#ifdef __cplusplus +} +#endif + #endif /* __EKG_THEMES_H */ /* Modified: trunk/ekg/userlist.h =================================================================== --- trunk/ekg/userlist.h 2008-10-04 20:50:01 UTC (rev 4701) +++ trunk/ekg/userlist.h 2008-10-05 07:47:11 UTC (rev 4702) @@ -40,6 +40,10 @@ #include "plugins.h" #include "windows.h" +#ifdef __cplusplus +extern "C" { +#endif + /** * userlist_t is used to manage all info about user.
* It's used not only to manage contacts in roster, but also to manage people in chat or conference @@ -208,6 +212,10 @@ #define user_private_items_destroy(user) \ private_items_destroy(&(user)->priv_list); +#ifdef __cplusplus +} +#endif + #endif /* __EKG_USERLIST_H */ /* Modified: trunk/ekg/vars.h =================================================================== --- trunk/ekg/vars.h 2008-10-04 20:50:01 UTC (rev 4701) +++ trunk/ekg/vars.h 2008-10-05 07:47:11 UTC (rev 4702) @@ -23,6 +23,10 @@ #include "dynstuff.h" #include "plugins.h" +#ifdef __cplusplus +extern "C" { +#endif + typedef enum { VAR_STR, /* ciąg znaków */ VAR_INT, /* liczba całkowita */ @@ -92,6 +96,10 @@ #endif +#ifdef __cplusplus +} +#endif + #endif /* __EKG_VARS_H */ /* Modified: trunk/ekg/win32.h =================================================================== --- trunk/ekg/win32.h 2008-10-04 20:50:01 UTC (rev 4701) +++ trunk/ekg/win32.h 2008-10-05 07:47:11 UTC (rev 4702) @@ -31,6 +31,10 @@ #include #include +#ifdef __cplusplus +extern "C" { +#endif + #undef pipe typedef unsigned __int64 u_int64_t; @@ -81,5 +85,9 @@ #define fileno(__F) ((__F)->_file) #define sleep(x) Sleep(x * 1000) +#ifdef __cplusplus +} #endif +#endif + Modified: trunk/ekg/windows.h =================================================================== --- trunk/ekg/windows.h 2008-10-04 20:50:01 UTC (rev 4701) +++ trunk/ekg/windows.h 2008-10-05 07:47:11 UTC (rev 4702) @@ -33,6 +33,10 @@ #include #endif +#ifdef __cplusplus +extern "C" { +#endif + typedef struct { void *w; /* window, if NULL it means current */ int casense : 2; /* 0 - ignore case; 1 - don't ignore case, -1 - use global variable */ @@ -120,6 +124,10 @@ COMMAND(cmd_window); +#ifdef __cplusplus +} +#endif + #endif /* __EKG_WINDOW_H */ /* From svn w toxygen.net Tue Oct 7 21:04:17 2008 From: svn w toxygen.net (SVN commit) Date: Tue, 7 Oct 2008 21:04:17 +0200 (CEST) Subject: [ekg2-commit] r4703 - trunk/plugins/remote: trunk/plugins/remote/remote.c Message-ID: <20081007190417.A663A17B3A@toxygen.net> Author: darkjames Date: 2008-10-07 21:04:17 +0200 (Tue, 07 Oct 2008) New Revision: 4703 Modified: trunk/plugins/remote/remote.c Log: - send session params Modified: trunk/plugins/remote/remote.c =================================================================== --- trunk/plugins/remote/remote.c 2008-10-05 07:47:11 UTC (rev 4702) +++ trunk/plugins/remote/remote.c 2008-10-07 19:04:17 UTC (rev 4703) @@ -450,8 +450,18 @@ } else if (!xstrcmp(cmd, "REQPLUGINS")) { plugin_t *p; - for (p = plugins; p; p = p->next) + for (p = plugins; p; p = p->next) { remote_writefd(fd, "PLUGIN", p->name, itoa(p->prio), NULL); + + if (p->params) { + int i; + + for (i = 0; p->params[i].key; i++) { + remote_writefd(fd, "PLUGINPARAM", p->name, p->params[i].key, NULL); + } + } + } + remote_writefd(fd, "+PLUGIN", NULL); } else if (!xstrcmp(cmd, "REQFORMATS")) { @@ -1439,7 +1449,6 @@ query_connect_id(&remote_plugin, METACONTACT_ITEM_ADDED, remote_all_contacts_changed, NULL); query_connect_id(&remote_plugin, METACONTACT_ITEM_REMOVED, remote_all_contacts_changed, NULL); - query_connect_id(&remote_plugin, USERLIST_CHANGED, remote_all_contacts_changed, NULL); query_connect_id(&remote_plugin, USERLIST_ADDED, remote_all_contacts_changed, NULL); query_connect_id(&remote_plugin, USERLIST_REMOVED, remote_all_contacts_changed, NULL); query_connect_id(&remote_plugin, USERLIST_RENAMED, remote_all_contacts_changed, NULL); From svn w toxygen.net Wed Oct 8 13:01:31 2008 From: svn w toxygen.net (SVN commit) Date: Wed, 8 Oct 2008 13:01:31 +0200 (CEST) Subject: [ekg2-commit] r4704 - trunk/ekg: trunk/ekg/ekg.c Message-ID: <20081008110132.0882817B3A@toxygen.net> Author: darkjames Date: 2008-10-08 13:01:31 +0200 (Wed, 08 Oct 2008) New Revision: 4704 Modified: trunk/ekg/ekg.c Log: never used Modified: trunk/ekg/ekg.c =================================================================== --- trunk/ekg/ekg.c 2008-10-07 19:04:17 UTC (rev 4703) +++ trunk/ekg/ekg.c 2008-10-08 11:01:31 UTC (rev 4704) @@ -111,7 +111,6 @@ int mesg_startup; int ekg_watches_removed; struct timeval ekg_tv; -static pid_t ekg_pid = 0; static char argv0[PATH_MAX]; pid_t speech_pid = 0; @@ -688,7 +687,6 @@ #endif ekg_started = time(NULL); - ekg_pid = getpid(); ekg2_dlinit(); setlocale(LC_ALL, ""); From svn w toxygen.net Wed Oct 8 13:23:29 2008 From: svn w toxygen.net (SVN commit) Date: Wed, 8 Oct 2008 13:23:29 +0200 (CEST) Subject: [ekg2-commit] r4705 - trunk/plugins/remote: trunk/plugins/remote/remote.c Message-ID: <20081008112330.0833017B3A@toxygen.net> Author: darkjames Date: 2008-10-08 13:23:29 +0200 (Wed, 08 Oct 2008) New Revision: 4705 Modified: trunk/plugins/remote/remote.c Log: - support for detaching from control terminal, we don't need screen any more! Modified: trunk/plugins/remote/remote.c =================================================================== --- trunk/plugins/remote/remote.c 2008-10-08 11:01:31 UTC (rev 4704) +++ trunk/plugins/remote/remote.c 2008-10-08 11:23:29 UTC (rev 4705) @@ -83,6 +83,7 @@ static char *rc_paths = NULL; static char *rc_password = NULL; static int rc_first = 1; +static int rc_detach = 0; /* note: * zmienne gtk: ncurses: readline: dla -F remote @@ -418,6 +419,7 @@ /* BIGNOTE: * here send all remote-vars, which we want to show outside */ + remote_writefd(fd, "CONFIG", "remote:detach", itoa(rc_detach), NULL); remote_writefd(fd, "CONFIG", "remote:remote_control", rc_paths, NULL); remote_writefd(fd, "+CONFIG", NULL); @@ -863,14 +865,51 @@ return fd; } +static void rc_detach_changed(const char *name) { + static int detached = 0; + + debug("rc_detach_changed() detached: %d rc_detach: %d\n"); + + if (detached) + return; + + if (rc_detach) { + int pid; + int fd_null; + + printf("[detached]\n"); + + if ((pid = fork()) < 0) { + printf("\tCouldn't detach\n"); + return; + } + + if (pid > 0) { + /* parent */ + exit(0); + } + + setsid(); + + /* XXX: in ekg2 we redirect stderr to another file */ + fd_null = open("/dev/null", O_RDWR); + + dup2(fd_null, 0); + dup2(fd_null, 1); + dup2(fd_null, 2); + + close(fd_null); + } else + printf("Not detaching, if you like to, set remote:detach to true\n"); +} + /* * rc_paths_changed() * * zmieniono zmienną remote_control. dodaj nowe kanały wejściowe, usuń te, * których już nie ma. */ -static void rc_paths_changed(const char *name) -{ +static void rc_paths_changed(const char *name) { char **paths = array_make(rc_paths, ",; ", 0, 1, 1); list_t l; int i; @@ -1070,6 +1109,7 @@ printf("ekg2-remote-plugin: configured!\n"); printf("remember to change password (/set remote:password yournewpassword) and to save configuration after connect!\n"); + rc_detach_changed(NULL); return 0; } @@ -1394,8 +1434,9 @@ plugin_register(&remote_plugin, prio); + variable_add(&remote_plugin, ("detach"), VAR_BOOL, 1, &rc_detach, rc_detach_changed, NULL, NULL); + variable_add(&remote_plugin, ("first_run"), VAR_INT, 2, &rc_first, NULL, NULL, NULL); variable_add(&remote_plugin, ("remote_control"), VAR_STR, 1, &rc_paths, rc_paths_changed, NULL, NULL); - variable_add(&remote_plugin, ("first_run"), VAR_INT, 2, &rc_first, NULL, NULL, NULL); variable_add(&remote_plugin, ("password"), VAR_STR, 0, &rc_password, NULL, NULL, NULL); query_connect_id(&remote_plugin, UI_IS_INITIALIZED, remote_ui_is_initialized, NULL); From svn w toxygen.net Wed Oct 8 13:28:57 2008 From: svn w toxygen.net (SVN commit) Date: Wed, 8 Oct 2008 13:28:57 +0200 (CEST) Subject: [ekg2-commit] r4706 - trunk/plugins/remote: trunk/plugins/remote/remote.c Message-ID: <20081008112857.C15A917B3A@toxygen.net> Author: darkjames Date: 2008-10-08 13:28:57 +0200 (Wed, 08 Oct 2008) New Revision: 4706 Modified: trunk/plugins/remote/remote.c Log: drobne poprawki Modified: trunk/plugins/remote/remote.c =================================================================== --- trunk/plugins/remote/remote.c 2008-10-08 11:23:29 UTC (rev 4705) +++ trunk/plugins/remote/remote.c 2008-10-08 11:28:57 UTC (rev 4706) @@ -868,9 +868,9 @@ static void rc_detach_changed(const char *name) { static int detached = 0; - debug("rc_detach_changed() detached: %d rc_detach: %d\n"); + debug("rc_detach_changed() detached: %d rc_detach: %d rc_inputs: %x\n", detached, rc_detach, rc_inputs); - if (detached) + if (detached || (rc_inputs == NULL)) return; if (rc_detach) { @@ -1067,8 +1067,10 @@ /* XXX, pipe: && udp: sucks */ /* XXX, ssl: zlib: ? */ static QUERY(remote_postinit) { - if (rc_inputs) + if (rc_inputs) { + rc_detach_changed(NULL); return 1; + } if (!rc_first) printf("!!! rc_inputs == NULL, need reconfiguration of remote plugin!\n"); From svn w toxygen.net Wed Oct 8 21:19:54 2008 From: svn w toxygen.net (SVN commit) Date: Wed, 8 Oct 2008 21:19:54 +0200 (CEST) Subject: [ekg2-commit] r4707 - trunk/plugins/remote: trunk/plugins/remote/remote.c Message-ID: <20081008191954.15B2A17B3A@toxygen.net> Author: darkjames Date: 2008-10-08 21:19:53 +0200 (Wed, 08 Oct 2008) New Revision: 4707 Modified: trunk/plugins/remote/remote.c Log: - fix default value for ncurses:contacts_groups_all_sessons (shouldbe 0, not NULL!) Modified: trunk/plugins/remote/remote.c =================================================================== --- trunk/plugins/remote/remote.c 2008-10-08 11:28:57 UTC (rev 4706) +++ trunk/plugins/remote/remote.c 2008-10-08 19:19:53 UTC (rev 4707) @@ -90,6 +90,7 @@ * sa zapisywane w config-remote */ +#define UI_VAR(name, defval) { name, defval, NULL, 0 } static struct { const char *name; char *value_def; @@ -98,45 +99,45 @@ } ui_vars[] = { /* gtk: */ - { "gtk:backlog_size", "1000", NULL, 0 }, - { "gtk:tab_layout", "2", NULL, 0 }, + UI_VAR("gtk:backlog_size", "1000"), + UI_VAR("gtk:tab_layout", "2"), /* ncurses: */ - { "ncurses:aspell", "0", NULL, 0 }, - { "ncurses:aspell_lang", "pl", NULL, 0 }, - { "ncurses:backlog_size", "1000", NULL, 0 }, - { "ncurses:contacts", "2", NULL, 0 }, - { "ncurses:contacts_descr", "0", NULL, 0 }, - { "ncurses:contacts_edge", "2", NULL, 0 }, - { "ncurses:contacts_frame", "1", NULL, 0 }, - { "ncurses:contacts_groups", NULL, NULL, 0 }, - { "ncurses:contacts_groups_all_sessons", NULL, NULL, 0 }, - { "ncurses:contacts_margin", "1", NULL, 0 }, - { "ncurses:contacts_metacontacts_swallow", "1", NULL, 0 }, - { "ncurses:contacts_order", NULL, NULL, 0 }, - { "ncurses:contacts_orderbystate", "1", NULL, 0 }, - { "ncurses:contacts_size", "9", NULL, 0 }, - { "ncurses:contacts_wrap", "0", NULL, 0 }, - { "ncurses:display_transparent", "1", NULL, 0 }, - { "ncurses:enter_scrolls", "0", NULL, 0 }, - { "ncurses:header_size", "0", NULL, 0 }, - { "ncurses:kill_irc_window", "1", NULL, 0 }, - { "ncurses:lastlog_lock", "1", NULL, 0 }, - { "ncurses:lastlog_size", "10", NULL, 0 }, - { "ncurses:margin_size", "15", NULL, 0 }, - { "ncurses:mark_on_window_change", "0", NULL, 0 }, - { "ncurses:statusbar_size", "1", NULL, 0 }, - { "ncurses:text_bottomalign", "0", NULL, 0 }, - { "ncurses:traditional_clear", "1", NULL, 0 }, - { "ncurses:typing_interval", "1", NULL, 0 }, - { "ncurses:typing_timeout", "10", NULL, 0 }, - { "ncurses:typing_timeout_empty", "5", NULL, 0 }, + UI_VAR("ncurses:aspell", "0"), + UI_VAR("ncurses:aspell_lang", "pl"), + UI_VAR("ncurses:backlog_size", "1000"), + UI_VAR("ncurses:contacts", "2"), + UI_VAR("ncurses:contacts_descr", "0"), + UI_VAR("ncurses:contacts_edge", "2"), + UI_VAR("ncurses:contacts_frame", "1"), + UI_VAR("ncurses:contacts_groups", NULL), + UI_VAR("ncurses:contacts_groups_all_sessons", "0"), + UI_VAR("ncurses:contacts_margin", "1"), + UI_VAR("ncurses:contacts_metacontacts_swallow", "1"), + UI_VAR("ncurses:contacts_order", NULL), + UI_VAR("ncurses:contacts_orderbystate", "1"), + UI_VAR("ncurses:contacts_size", "9"), + UI_VAR("ncurses:contacts_wrap", "0"), + UI_VAR("ncurses:display_transparent", "1"), + UI_VAR("ncurses:enter_scrolls", "0"), + UI_VAR("ncurses:header_size", "0"), + UI_VAR("ncurses:kill_irc_window", "1"), + UI_VAR("ncurses:lastlog_lock", "1"), + UI_VAR("ncurses:lastlog_size", "10"), + UI_VAR("ncurses:margin_size", "15"), + UI_VAR("ncurses:mark_on_window_change", "0"), + UI_VAR("ncurses:statusbar_size", "1"), + UI_VAR("ncurses:text_bottomalign", "0"), + UI_VAR("ncurses:traditional_clear", "1"), + UI_VAR("ncurses:typing_interval", "1"), + UI_VAR("ncurses:typing_timeout", "10"), + UI_VAR("ncurses:typing_timeout_empty", "5"), /* readline: */ - { "readline:ctrld_quits", "1", NULL, 0 }, - + UI_VAR("readline:ctrld_quits", "1"), { NULL, NULL, NULL, 0 } }; +#undef UI_VAR static const char *rc_var_get_value(variable_t *v) { if (!v) From svn w toxygen.net Wed Oct 8 22:35:10 2008 From: svn w toxygen.net (SVN commit) Date: Wed, 8 Oct 2008 22:35:10 +0200 (CEST) Subject: [ekg2-commit] r4708 - trunk/ekg: trunk/ekg/legacyconfig.c Message-ID: <20081008203510.7A60F17B3A@toxygen.net> Author: porridge Date: 2008-10-08 22:35:10 +0200 (Wed, 08 Oct 2008) New Revision: 4708 Modified: trunk/ekg/legacyconfig.c Log: do not warn about configuration upgrades when user starts the program for the first time Modified: trunk/ekg/legacyconfig.c =================================================================== --- trunk/ekg/legacyconfig.c 2008-10-08 19:19:53 UTC (rev 4707) +++ trunk/ekg/legacyconfig.c 2008-10-08 20:35:10 UTC (rev 4708) @@ -42,7 +42,7 @@ else if (config_version == 0) print("console_charset_using", config_console_charset); - if (config_version >= current_config_version) + if (config_version == 0 || config_version >= current_config_version) return; print("config_upgrade_begin"); From svn w toxygen.net Wed Oct 8 22:37:09 2008 From: svn w toxygen.net (SVN commit) Date: Wed, 8 Oct 2008 22:37:09 +0200 (CEST) Subject: [ekg2-commit] r4709 - trunk/ekg: trunk/ekg/commands.c trunk/ekg/dynstuff.c trunk/ekg/sessions.c trunk/ekg/stuff.c trunk/ekg/themes.c trunk/ekg/windows.c Message-ID: <20081008203709.C048117B3A@toxygen.net> Author: porridge Date: 2008-10-08 22:37:09 +0200 (Wed, 08 Oct 2008) New Revision: 4709 Modified: trunk/ekg/commands.c trunk/ekg/dynstuff.c trunk/ekg/sessions.c trunk/ekg/stuff.c trunk/ekg/themes.c trunk/ekg/windows.c Log: wording fixes. "eventually" is a false friend (i.e. has a completly different meaning than the similar word in Polish) Modified: trunk/ekg/commands.c =================================================================== --- trunk/ekg/commands.c 2008-10-08 20:35:10 UTC (rev 4708) +++ trunk/ekg/commands.c 2008-10-08 20:37:09 UTC (rev 4709) @@ -4166,7 +4166,7 @@ * @param params - space seperated paramlist (read note for more details!) * @param function - function handler * @param flags - bitmask from commands.h (read note for more details!) - * @param possibilities - eventually space separated list of possible params.. completion useful + * @param possibilities - optional space separated list of possible params.. completion useful * * @return Pointer to added command_t *, or NULL if name was NULL. * Modified: trunk/ekg/dynstuff.c =================================================================== --- trunk/ekg/dynstuff.c 2008-10-08 20:35:10 UTC (rev 4708) +++ trunk/ekg/dynstuff.c 2008-10-08 20:37:09 UTC (rev 4709) @@ -855,7 +855,7 @@ /** * string_free() * - * Cleanup memory after string_t @a s, and eventually (if @a free_string set) cleanup memory after char buffer. + * Cleanup memory after string_t @a s, and perhaps (if @a free_string set) cleanup memory after char buffer. * * @param s - string_t which we want to free. * @param free_string - do we want to free memory after char buffer? Modified: trunk/ekg/sessions.c =================================================================== --- trunk/ekg/sessions.c 2008-10-08 20:35:10 UTC (rev 4708) +++ trunk/ekg/sessions.c 2008-10-08 20:37:09 UTC (rev 4709) @@ -1225,7 +1225,7 @@ if (pa->secret) var = var ? "(...)" : NULL; } else { - /* XXX, idea, here we can do: session_localvar_find() to check if this is _local_ variable, and eventually print other info.. + /* XXX, idea, here we can do: session_localvar_find() to check if this is _local_ variable, and perhaps print other info.. * The same at --set ? */ printq("session_variable_doesnt_exist", session_name(s), key); Modified: trunk/ekg/stuff.c =================================================================== --- trunk/ekg/stuff.c 2008-10-08 20:35:10 UTC (rev 4708) +++ trunk/ekg/stuff.c 2008-10-08 20:37:09 UTC (rev 4709) @@ -1096,7 +1096,7 @@ /* fallback on locale enviroments.. (man 5 locale) */ if ((tmp = getenv("LC_ALL"))) break; if ((tmp = getenv("LANG"))) break; - /* eventually fallback, fallback on en language */ + /* fallback to en language */ tmp = "en"; } while (0); Modified: trunk/ekg/themes.c =================================================================== --- trunk/ekg/themes.c 2008-10-08 20:35:10 UTC (rev 4708) +++ trunk/ekg/themes.c 2008-10-08 20:37:09 UTC (rev 4709) @@ -940,10 +940,10 @@ * * Like print_window() but it takes window_t struct instead of target+session. * - * @note The same in print_window_c() we don't check if @a w is valid window ptr. - * Just be carefull. If you are not sure call:
+ * @note The same as in print_window_c(): we don't check if @a w is valid window ptr. + * Just be careful. If you are not sure call:
* print_window_c(window_find_ptr(w), separate, theme, ...) - * And eventually it will be displayed in (__status / or __current) window instead of good one.. But ekg2 won't crash. + * And in worst case text will be displayed in (__status / or __current) window instead of a usual one.. But ekg2 won't crash. * * @param w - window to display,
* if NULL than __status or __current will be used. it depends on: config_default_status_window and config_display_crap variables. @@ -1632,7 +1632,7 @@ format_add("autosaved", _("%> Automatically saved settings\n"), 1); /* config_upgrade() */ - format_add("config_upgrade_begin", _("%) EKG2 upgrade detected. In the meantime, following changes were made:\n"), 1); + format_add("config_upgrade_begin", _("%) EKG2 upgrade detected. The following changes were made since your previous version:\n"), 1); format_add("config_upgrade_important", "%) %W%2) %y*%n %1\n", 1); format_add("config_upgrade_major", "%) %W%2) %Y*%n %1\n", 1); format_add("config_upgrade_minor", "%) %W%2) %c*%n %1\n", 1); @@ -2076,7 +2076,7 @@ format_add("directory_cant_create", _("%! Can't create directory: %1 (%2)"), 1); /* charset stuff */ - format_add("console_charset_using", _("%) EKG2 detected that your console works under: %W%1%n Please verify and eventually change %Gconsole_charset%n variable"), 1); + format_add("console_charset_using", _("%) EKG2 detected that your console works under: %W%1%n Please verify and change %Gconsole_charset%n variable if needed"), 1); format_add("console_charset_bad", _("%! EKG2 detected that your console works under: %W%1%n, but in %Gconsole_charset%n variable you've got: %W%2%n Please verify."), 1); format_add("iconv_fail", _("%! iconv_open() fail to initialize charset conversion between %W%1%n and %W%2%n. Check %Gconsole_charset%n variable, if it won't help inform ekg2 dev team and/or upgrade iconv"), 1); format_add("iconv_list", _("%) %g%[-10]1%n %c<==> %g%[-10]2%n %b(%nIn use: %W%3, %4%b)"), 1); Modified: trunk/ekg/windows.c =================================================================== --- trunk/ekg/windows.c 2008-10-08 20:35:10 UTC (rev 4708) +++ trunk/ekg/windows.c 2008-10-08 20:37:09 UTC (rev 4709) @@ -244,8 +244,10 @@ * If window with such target [it can also be u->uid/u->nickname combination] exists. * than it'll return it. * - * @note You shouldn't pass @a new_id here. Because it can broke UI stuff. don't ask. it's wrong. Just don't use it. - * It'll be possible removed... Really eventually you can talk with devs, and ask for id from class: 1000 to 1999 + * @note You shouldn't pass @a new_id here. Because it can break UI stuff. don't ask. it's wrong. Just don't use it. + * It'll be possible removed... In case you really need it, you + * can talk to the devs, and ask for an id from class: 1000 to + * 1999 * * @todo See XXX's * From svn w toxygen.net Thu Oct 9 10:02:34 2008 From: svn w toxygen.net (SVN commit) Date: Thu, 9 Oct 2008 10:02:34 +0200 (CEST) Subject: [ekg2-commit] r4710 - trunk/docs: trunk/docs/session-pl.txt Message-ID: <20081009080234.BB1F617B1F@toxygen.net> Author: porridge Date: 2008-10-09 10:02:34 +0200 (Thu, 09 Oct 2008) New Revision: 4710 Modified: trunk/docs/session-pl.txt Log: fixed doc tag which prevented the book from building Modified: trunk/docs/session-pl.txt =================================================================== --- trunk/docs/session-pl.txt 2008-10-08 20:37:09 UTC (rev 4709) +++ trunk/docs/session-pl.txt 2008-10-09 08:02:34 UTC (rev 4710) @@ -78,7 +78,7 @@ ma ponowić próbę. jeśli równa 0, nie próbuje więcej. connect_timeout - type: liczba + typ: liczba domyślna wartość: 30 liczba sekund, po których upływie próba łączenia z danym serwerem From svn w toxygen.net Thu Oct 9 12:25:57 2008 From: svn w toxygen.net (SVN commit) Date: Thu, 9 Oct 2008 12:25:57 +0200 (CEST) Subject: [ekg2-commit] r4711 - in trunk: . plugins: trunk/configure.ac trunk/plugins/Makefile.am Message-ID: <20081009102557.BB10817B1F@toxygen.net> Author: porridge Date: 2008-10-09 12:25:57 +0200 (Thu, 09 Oct 2008) New Revision: 4711 Modified: trunk/configure.ac trunk/plugins/Makefile.am Log: enable rivchat and remote plugins Modified: trunk/configure.ac =================================================================== --- trunk/configure.ac 2008-10-09 08:02:34 UTC (rev 4710) +++ trunk/configure.ac 2008-10-09 10:25:57 UTC (rev 4711) @@ -127,9 +127,9 @@ dnl core AC_CONFIG_FILES([Makefile ekg/Makefile contrib/Makefile compat/Makefile docs/Makefile plugins/Makefile po/Makefile.in]) dnl protocol-plugins -AC_CONFIG_FILES([plugins/feed/Makefile plugins/gg/Makefile plugins/icq/Makefile plugins/irc/Makefile plugins/jabber/Makefile plugins/polchat/Makefile]) +AC_CONFIG_FILES([plugins/feed/Makefile plugins/gg/Makefile plugins/icq/Makefile plugins/irc/Makefile plugins/jabber/Makefile plugins/polchat/Makefile plugins/rivchat/Makefile]) dnl ui-plugins -AC_CONFIG_FILES([plugins/gtk/Makefile plugins/httprc_xajax/Makefile plugins/ncurses/Makefile plugins/rc/Makefile plugins/readline/Makefile]) +AC_CONFIG_FILES([plugins/gtk/Makefile plugins/httprc_xajax/Makefile plugins/ncurses/Makefile plugins/rc/Makefile plugins/readline/Makefile plugins/remote/Makefile]) dnl log-plugins AC_CONFIG_FILES([plugins/logs/Makefile plugins/logsoracle/Makefile plugins/logsqlite/Makefile]) dnl scripting-plugins and samples-scripts @@ -140,7 +140,7 @@ dnl misc-plugins AC_CONFIG_FILES([plugins/mail/Makefile plugins/sms/Makefile plugins/pcm/Makefile plugins/xmsg/Makefile plugins/ioctld/Makefile plugins/gsm/Makefile plugins/xosd/Makefile plugins/autoresponder/Makefile plugins/jogger/Makefile]) -PLUGINS="logs mail rc sms pcm icq irc polchat rot13 httprc_xajax xmsg autoresponder jogger" +PLUGINS="logs mail rc sms pcm icq irc polchat rot13 httprc_xajax xmsg autoresponder jogger rivchat remote" export PKG_CONFIG_PATH="$PKG_CONFIG_PATH:/usr/local/lib/pkgconfig" AC_CHECK_PROG([PKGCONFIG], [pkg-config], [pkg-config], [no]) Modified: trunk/plugins/Makefile.am =================================================================== --- trunk/plugins/Makefile.am 2008-10-09 08:02:34 UTC (rev 4710) +++ trunk/plugins/Makefile.am 2008-10-09 10:25:57 UTC (rev 4711) @@ -1,5 +1,5 @@ SUBDIRS = @PLUGINS@ -DIST_SUBDIRS = autoresponder feed gg gpg gsm gtk httprc_xajax ioctld icq irc jabber jogger logs logsqlite logsoracle mail ncurses pcm perl polchat python rc readline rot13 sim sms xmsg xosd +DIST_SUBDIRS = autoresponder feed gg gpg gsm gtk httprc_xajax ioctld icq irc jabber jogger logs logsqlite logsoracle mail ncurses pcm perl polchat python rc readline remote rivchat rot13 sim sms xmsg xosd EXTRA_DIST = README From svn w toxygen.net Thu Oct 9 22:02:34 2008 From: svn w toxygen.net (SVN commit) Date: Thu, 9 Oct 2008 22:02:34 +0200 (CEST) Subject: [ekg2-commit] r4712 - in trunk: contrib/patches plugins/ncurses: -trunk/contrib/patches/ncurses-unicode-fix.diff trunk/plugins/ncurses/old.c Message-ID: <20081009200234.A12C117B1F@toxygen.net> Author: porridge Date: 2008-10-09 22:02:34 +0200 (Thu, 09 Oct 2008) New Revision: 4712 Removed: trunk/contrib/patches/ncurses-unicode-fix.diff Modified: trunk/plugins/ncurses/old.c Log: Apply contrib/patches/ncurses-unicode-fix.diff With this change, ekg2 built with --enable-unicode works correctly in a latin2 locale (without any extra flags needed). Deleted: trunk/contrib/patches/ncurses-unicode-fix.diff =================================================================== --- trunk/contrib/patches/ncurses-unicode-fix.diff 2008-10-09 10:25:57 UTC (rev 4711) +++ trunk/contrib/patches/ncurses-unicode-fix.diff 2008-10-09 20:02:34 UTC (rev 4712) @@ -1,136 +0,0 @@ -Index: old.c -=================================================================== ---- old.c (wersja 4164) -+++ old.c (kopia robocza) -@@ -946,7 +946,7 @@ - - if (ch > 127 && ch < 160 && - #if USE_UNICODE -- !config_use_unicode && -+ 0 && - #endif - config_use_iso) - { -@@ -1165,11 +1165,10 @@ - if (!fixup && (l->margin_left != -1 && x >= l->margin_left)) - fixup = l->margin_left + config_margin_size; - #if USE_UNICODE -- if (config_use_unicode) { -- mvwaddnwstr(n->window, cur_y, cur_x - fixup, &ch, 1); -- } else -+ mvwaddnwstr(n->window, cur_y, cur_x - fixup, &ch, 1); -+#else -+ mvwaddch(n->window, cur_y, cur_x - fixup, ch); - #endif -- mvwaddch(n->window, cur_y, cur_x - fixup, ch); - } - } - -@@ -1182,11 +1181,10 @@ - if (!fixup && (l->margin_left != -1 && (x + l->prompt_len) >= l->margin_left)) - fixup = l->margin_left + config_margin_size; - #if USE_UNICODE -- if (config_use_unicode) { -- mvwaddnwstr(n->window, cur_y, cur_x - fixup, &ch, 1); -- } else -+ mvwaddnwstr(n->window, cur_y, cur_x - fixup, &ch, 1); -+#else -+ mvwaddch(n->window, cur_y, cur_x - fixup, ch); - #endif -- mvwaddch(n->window, cur_y, cur_x - fixup, ch); - } - } - -@@ -1858,7 +1856,7 @@ - #ifdef HAVE_NCURSES_ULC - if (!config_use_iso - #if USE_UNICODE -- && !config_use_unicode -+ && 0 - #endif - ) - use_legacy_coding(2); -@@ -2102,11 +2100,10 @@ - wattrset(w, attr); - - #if USE_UNICODE -- if (config_use_unicode) -- mvwaddnwstr(w, y, x, &ch, 1); -- else -+ mvwaddnwstr(w, y, x, &ch, 1); -+#else -+ mvwaddch(w, y, x, ch); - #endif -- mvwaddch(w, y, x, ch); - wattrset(w, A_NORMAL); - } - -@@ -2122,13 +2119,11 @@ - */ - static int ekg_getch(int meta, unsigned int *ch) { - #if USE_UNICODE -- int retcode; -- if (config_use_unicode) { -- retcode = wget_wch(input, ch); -- if (retcode == ERR) *ch = ERR; -- } else retcode = -+ int retcode = wget_wch(input, ch); -+ if (retcode == ERR) *ch = ERR; -+#else -+ *ch = wgetch(input); - #endif -- *ch = wgetch(input); - - /* Debian screen incomplete terminfo workaround */ - -@@ -2258,11 +2253,10 @@ - - static inline int isalpha_locale(int x) { - #ifdef USE_UNICODE -- if (config_use_unicode) -- return (isalpha(x) || (x > 0x7f)); /* moze i nie najlepsze wyjscie... */ -- else -+ return (isalpha(x) || (x > 0x7f)); /* moze i nie najlepsze wyjscie... */ -+#else -+ return isalpha_pl(x); - #endif -- return isalpha_pl(x); - } - - /* -@@ -2419,7 +2413,7 @@ - /* const */size_t linelen = xwcslen(ncurses_line); - - if (ncurses_current->prompt) --#ifdef USE_UNICODE /* XXX: should we check config_use_unicode here? */ -+#ifdef USE_UNICODE - mvwaddwstr(input, 0, 0, ncurses_current->prompt_real); - #else - mvwaddstr(input, 0, 0, (char *) ncurses_current->prompt_real); -@@ -2594,7 +2588,7 @@ - } else { - if ( - #if USE_UNICODE -- !config_use_unicode && -+ 0 && - #endif - ch > KEY_MAX) { - -@@ -2604,7 +2598,7 @@ - - if ( - #if USE_UNICODE -- ( (config_use_unicode && (tmp == KEY_CODE_YES || ch < 0x100 /* TODO CHECK */)) || !config_use_unicode) && -+ (((tmp == KEY_CODE_YES || ch < 0x100 /* TODO CHECK */))) && - #endif - (b = ncurses_binding_map[ch]) && b->action) { - -@@ -2617,7 +2611,7 @@ - } - } else if ( - #if USE_UNICODE -- ((config_use_unicode && ch != KEY_MOUSE) || (!config_use_unicode && ch < 255)) && -+ ((ch != KEY_MOUSE) || (0 && ch < 255)) && - #else - ch < 255 && - #endif Modified: trunk/plugins/ncurses/old.c =================================================================== --- trunk/plugins/ncurses/old.c 2008-10-09 10:25:57 UTC (rev 4711) +++ trunk/plugins/ncurses/old.c 2008-10-09 20:02:34 UTC (rev 4712) @@ -947,7 +947,7 @@ if (ch > 127 && ch < 160 && #if USE_UNICODE - !config_use_unicode && + 0 && #endif config_use_iso) { @@ -1166,11 +1166,10 @@ if (!fixup && (l->margin_left != -1 && x >= l->margin_left)) fixup = l->margin_left + config_margin_size; #if USE_UNICODE - if (config_use_unicode) { - mvwaddnwstr(n->window, cur_y, cur_x - fixup, &ch, 1); - } else + mvwaddnwstr(n->window, cur_y, cur_x - fixup, &ch, 1); +#else + mvwaddch(n->window, cur_y, cur_x - fixup, ch); #endif - mvwaddch(n->window, cur_y, cur_x - fixup, ch); } } @@ -1183,11 +1182,10 @@ if (!fixup && (l->margin_left != -1 && (x + l->prompt_len) >= l->margin_left)) fixup = l->margin_left + config_margin_size; #if USE_UNICODE - if (config_use_unicode) { - mvwaddnwstr(n->window, cur_y, cur_x - fixup, &ch, 1); - } else + mvwaddnwstr(n->window, cur_y, cur_x - fixup, &ch, 1); +#else + mvwaddch(n->window, cur_y, cur_x - fixup, ch); #endif - mvwaddch(n->window, cur_y, cur_x - fixup, ch); } } @@ -1867,7 +1865,7 @@ #ifdef HAVE_NCURSES_ULC if (!config_use_iso #if USE_UNICODE - && !config_use_unicode + && 0 #endif ) use_legacy_coding(2); @@ -2111,11 +2109,10 @@ wattrset(w, attr); #if USE_UNICODE - if (config_use_unicode) - mvwaddnwstr(w, y, x, &ch, 1); - else + mvwaddnwstr(w, y, x, &ch, 1); +#else + mvwaddch(w, y, x, ch); #endif - mvwaddch(w, y, x, ch); wattrset(w, A_NORMAL); } @@ -2131,13 +2128,11 @@ */ static int ekg_getch(int meta, unsigned int *ch) { #if USE_UNICODE - int retcode; - if (config_use_unicode) { - retcode = wget_wch(input, ch); - if (retcode == ERR) *ch = ERR; - } else retcode = + int retcode = wget_wch(input, ch); + if (retcode == ERR) *ch = ERR; +#else + *ch = wgetch(input); #endif - *ch = wgetch(input); #ifndef HAVE_USABLE_TERMINFO /* Debian screen incomplete terminfo workaround */ @@ -2269,11 +2264,10 @@ static inline int isalpha_locale(int x) { #ifdef USE_UNICODE - if (config_use_unicode) - return (isalpha(x) || (x > 0x7f)); /* moze i nie najlepsze wyjscie... */ - else + return (isalpha(x) || (x > 0x7f)); /* moze i nie najlepsze wyjscie... */ +#else + return isalpha_pl(x); #endif - return isalpha_pl(x); } /* @@ -2430,7 +2424,7 @@ /* const */size_t linelen = xwcslen(ncurses_line); if (ncurses_current->prompt) -#ifdef USE_UNICODE /* XXX: should we check config_use_unicode here? */ +#ifdef USE_UNICODE mvwaddwstr(input, 0, 0, ncurses_current->prompt_real); #else mvwaddstr(input, 0, 0, (char *) ncurses_current->prompt_real); @@ -2605,7 +2599,7 @@ } else { if ( #if USE_UNICODE - !config_use_unicode && + 0 && #endif ch > KEY_MAX) { @@ -2615,7 +2609,7 @@ if ( #if USE_UNICODE - ( (config_use_unicode && (tmp == KEY_CODE_YES || ch < 0x100 /* TODO CHECK */)) || !config_use_unicode) && + (((tmp == KEY_CODE_YES || ch < 0x100 /* TODO CHECK */))) && #endif (b = ncurses_binding_map[ch]) && b->action) { @@ -2628,7 +2622,7 @@ } } else if ( #if USE_UNICODE - ((config_use_unicode && ch != KEY_MOUSE) || (!config_use_unicode && ch < 255)) && + ((ch != KEY_MOUSE) || (0 && ch < 255)) && #else ch < 255 && #endif From svn w toxygen.net Sat Oct 11 17:58:15 2008 From: svn w toxygen.net (SVN commit) Date: Sat, 11 Oct 2008 17:58:15 +0200 (CEST) Subject: [ekg2-commit] r4713 - in trunk: ekg plugins/gg plugins/icq: trunk/ekg/sessions.c trunk/plugins/gg/commands.c trunk/plugins/icq/icq.c Message-ID: <20081011155815.54D4A17B1F@toxygen.net> Author: darkjames Date: 2008-10-11 17:58:14 +0200 (Sat, 11 Oct 2008) New Revision: 4713 Modified: trunk/ekg/sessions.c trunk/plugins/gg/commands.c trunk/plugins/icq/icq.c Log: http://lists.ziew.org/pipermail/ekg2-users/2008-October/001295.html - when we create new session, set status to avail (instead of notavail) - [gg, icq] probuj sie laczyc z innym stanem niz EKG_STATUS_NA a co z EKG_STATUS_UNKNOWN? Modified: trunk/ekg/sessions.c =================================================================== --- trunk/ekg/sessions.c 2008-10-09 20:02:34 UTC (rev 4712) +++ trunk/ekg/sessions.c 2008-10-11 15:58:14 UTC (rev 4713) @@ -151,7 +151,7 @@ s = xmalloc(sizeof(session_t)); s->uid = xstrdup(uid); - s->status = EKG_STATUS_NA; + s->status = EKG_STATUS_AVAIL; /* note: here we had EKG_STATUS_NA, but some protocol plugins doesn't like EKG_STATUS_NA at connect */ s->plugin = pl; #ifdef HAVE_FLOCK s->lock_fd = -1; Modified: trunk/plugins/gg/commands.c =================================================================== --- trunk/plugins/gg/commands.c 2008-10-09 20:02:34 UTC (rev 4712) +++ trunk/plugins/gg/commands.c 2008-10-11 15:58:14 UTC (rev 4713) @@ -138,7 +138,7 @@ struct gg_login_params p; const char *tmp, *local_ip = session_get(session, "local_ip"); int tmpi; - int _status = gg_text_to_status(session_status_get(session), session_descr_get(session)); + int _status; const char *realserver = session_get(session, "server"); int port = session_int_get(session, "port"); char *password = (char *) session_get(session, "password"); @@ -180,6 +180,8 @@ if ((session_status_get(session) == EKG_STATUS_NA)) session_status_set(session, EKG_STATUS_AVAIL); + + _status = gg_text_to_status(session_status_get(session), session_descr_get(session)); /* dcc */ if (gg_config_dcc) { Modified: trunk/plugins/icq/icq.c =================================================================== --- trunk/plugins/icq/icq.c 2008-10-09 20:02:34 UTC (rev 4712) +++ trunk/plugins/icq/icq.c 2008-10-11 15:58:14 UTC (rev 4713) @@ -1200,6 +1200,10 @@ return -1; } + printq("connecting", session_name(session)); + if ((session_status_get(session) == EKG_STATUS_NA)) + session_status_set(session, EKG_STATUS_AVAIL); + return 0; } From svn w toxygen.net Sun Oct 12 15:50:50 2008 From: svn w toxygen.net (SVN commit) Date: Sun, 12 Oct 2008 15:50:50 +0200 (CEST) Subject: [ekg2-commit] r4714 - trunk/docs: trunk/docs/vars-en.txt trunk/docs/vars-pl.txt Message-ID: <20081012135050.63D3617B1F@toxygen.net> Author: porridge Date: 2008-10-12 15:50:49 +0200 (Sun, 12 Oct 2008) New Revision: 4714 Modified: trunk/docs/vars-en.txt trunk/docs/vars-pl.txt Log: corrected description of display_notify and added an English translation Modified: trunk/docs/vars-en.txt =================================================================== --- trunk/docs/vars-en.txt 2008-10-11 15:58:14 UTC (rev 4713) +++ trunk/docs/vars-en.txt 2008-10-12 13:50:49 UTC (rev 4714) @@ -11,6 +11,16 @@ defines if information which weren't connected with interlocutor will be displayed in chat window. If it's 0, in chat window information only about interlocutor status are displayed. +display_notify + type: integer + default value: 1 + + a value of 0 causes state changes of your contacts to be ignored, a + value of 1 causes all state changes to be displayed, and a value of 2 + causes only state changes from unavailable to available and back to be + displayed. A session variable with the same name has a higher priority + and overrides this global one (unless it is set to -1). + exit_exec type: text default value: none Modified: trunk/docs/vars-pl.txt =================================================================== --- trunk/docs/vars-pl.txt 2008-10-11 15:58:14 UTC (rev 4713) +++ trunk/docs/vars-pl.txt 2008-10-12 13:50:49 UTC (rev 4714) @@ -151,10 +151,8 @@ wartość 0 powoduje ignorowanie zmian stanu znajomych, wartość 1 powoduje wyświetlanie wszystkich zmian, wartość 2 wyświetla - tylko zmiany z niedostępnego na dostępny i na odwrót. większy - priorytet ma zmienna ,,contacts'', która przy wartości 2 - ukrywa zmiany stanu. większy priorytet ma również zmienna - sesyjna (jeżeli nie równa -1) + tylko zmiany z niedostępnego na dostępny i na odwrót. Większy priorytet + ma zmienna sesyjna o tej samej nazwie (jeżeli nie równa -1) display_pl_chars typ: bool From svn w toxygen.net Thu Oct 16 12:15:46 2008 From: svn w toxygen.net (SVN commit) Date: Thu, 16 Oct 2008 12:15:46 +0200 (CEST) Subject: [ekg2-commit] r4715 - trunk/plugins/ncurses: trunk/plugins/ncurses/old.c Message-ID: <20081016101547.0000D17B1F@toxygen.net> Author: darkjames Date: 2008-10-16 12:15:46 +0200 (Thu, 16 Oct 2008) New Revision: 4715 Modified: trunk/plugins/ncurses/old.c Log: cleanup asking for mailcount and window-topic. query_emit_id() is fast enough (thx to peres) and cause IRC_TOPIC is used now not only by irc plugin, but also rivchat It's also needed by ekg2-remote. Modified: trunk/plugins/ncurses/old.c =================================================================== --- trunk/plugins/ncurses/old.c 2008-10-12 13:50:49 UTC (rev 4714) +++ trunk/plugins/ncurses/old.c 2008-10-16 10:15:46 UTC (rev 4715) @@ -1638,9 +1638,11 @@ int formats_count = 0, i = 0, y; session_t *sess = window_current->session; userlist_t *q = userlist_find(sess, window_current->target); - plugin_t *plug; - char *tmp; + char *query_tmp; + char *irctopic, *irctopicby, *ircmode; + int mail_count; + wattrset(ncurses_status, color_pair(COLOR_WHITE, COLOR_BLUE)); if (ncurses_header) wattrset(ncurses_header, color_pair(COLOR_WHITE, COLOR_BLUE)); @@ -1662,26 +1664,22 @@ __add_format_dup("session", (sess), (sess->alias) ? sess->alias : sess->uid); __add_format_dup("descr", (sess && sess->descr && sess->connected), sess->descr); - tmp = (sess && q && q->nickname) ? saprintf("%s/%s", q->nickname, q->uid) : xstrdup(window_current->alias ? window_current->alias : window_current->target); - __add_format("query", tmp); + query_tmp = (sess && q && q->nickname) ? saprintf("%s/%s", q->nickname, q->uid) : xstrdup(window_current->alias ? window_current->alias : window_current->target); + __add_format("query", query_tmp); __add_format_emp("debug", (!window_current->id)); __add_format_emp("more", (window_current->more)); - if ((plug = plugin_find(("mail")))) { - int mail_count = -1; - query_emit_id(plug, MAIL_COUNT, &mail_count); + mail_count = -1; + if (query_emit_id(NULL, MAIL_COUNT, &mail_count) != -2) __add_format_dup("mail", (mail_count > 0), itoa(mail_count)); + + irctopic = irctopicby = ircmode = NULL; + if (query_emit_id(NULL, IRC_TOPIC, &irctopic, &irctopicby, &ircmode) != -2) { + __add_format("irctopic", irctopic); + __add_format("irctopicby", irctopicby); + __add_format("ircmode", ircmode); } - if (session_check(window_current->session, 1, "irc") && (plug = plugin_find(("irc")))) { - char *t1 = NULL; - char *t2 = NULL; - char *t3 = NULL; - query_emit_id(plug, IRC_TOPIC, &t1, &t2, &t3); - __add_format("irctopic", t1); - __add_format("irctopicby", t2); - __add_format("ircmode", t3); - } __add_format("activity", ncurses_window_activity()); From svn w toxygen.net Thu Oct 16 13:17:25 2008 From: svn w toxygen.net (SVN commit) Date: Thu, 16 Oct 2008 13:17:25 +0200 (CEST) Subject: [ekg2-commit] r4716 - trunk/plugins/remote: trunk/plugins/remote/remote.c Message-ID: <20081016111725.21E8417B1F@toxygen.net> Author: darkjames Date: 2008-10-16 13:17:24 +0200 (Thu, 16 Oct 2008) New Revision: 4716 Modified: trunk/plugins/remote/remote.c Log: - wysylanie informacji o topicach, oraz liczbie maili w skrzynce (MAIL_COUNT / IRC_TOPIC) Modified: trunk/plugins/remote/remote.c =================================================================== --- trunk/plugins/remote/remote.c 2008-10-16 10:15:46 UTC (rev 4715) +++ trunk/plugins/remote/remote.c 2008-10-16 11:17:24 UTC (rev 4716) @@ -73,6 +73,10 @@ typedef struct { remote_backlog_t **backlog; /* bufor z liniami */ /* XXX, przerobic na liste */ int backlog_size; /* rozmiar backloga */ + + char *last_irctopic; + char *last_irctopicby; + char *last_ircmode; } remote_window_t; PLUGIN_DEFINE(remote, PLUGIN_UI, NULL); @@ -85,6 +89,8 @@ static int rc_first = 1; static int rc_detach = 0; +static int rc_last_mail_count = -1; + /* note: * zmienne gtk: ncurses: readline: dla -F remote * sa zapisywane w config-remote @@ -140,9 +146,6 @@ #undef UI_VAR static const char *rc_var_get_value(variable_t *v) { - if (!v) - return NULL; - switch (v->type) { case VAR_INT: case VAR_BOOL: @@ -385,6 +388,8 @@ } remote_writefd(fd, "+LOGIN", NULL); + if (rc_last_mail_count > 0) + remote_writefd(fd, "MAILCOUNT", itoa(rc_last_mail_count), NULL); /* nie najszczesliwsze miejsce, ale nie mam pomyslu gdzie indziej */ } else { debug_error("unknown command: %s\n", arr[0]); @@ -560,6 +565,8 @@ window_t *w; for (w = windows; w; w = w->next) { + remote_window_t *n; + remote_writefd(fd, "WINDOW", itoa(w->id), w->target, NULL); /* NOTE: w->target can be NULL */ if (w->alias) @@ -568,6 +575,15 @@ remote_writefd(fd, "WINDOWINFO", itoa(w->id), "SESSION", w->session->uid, NULL); if (w->act) remote_writefd(fd, "WINDOWINFO", itoa(w->id), "ACTIVITY", itoa(w->act), NULL); + + if ((n = w->private)) { + if (n->last_irctopic) + remote_writefd(fd, "WINDOWINFO", itoa(w->id), "IRCTOPIC", n->last_irctopic, NULL); + if (n->last_irctopicby) + remote_writefd(fd, "WINDOWINFO", itoa(w->id), "IRCTOPICBY", n->last_irctopicby, NULL); + if (n->last_ircmode) + remote_writefd(fd, "WINDOWINFO", itoa(w->id), "IRCTOPICMODE", n->last_ircmode, NULL); + } } remote_writefd(fd, "WINDOW_SWITCH", itoa(window_current->id), NULL); remote_writefd(fd, "+WINDOW", NULL); @@ -871,6 +887,8 @@ debug("rc_detach_changed() detached: %d rc_detach: %d rc_inputs: %x\n", detached, rc_detach, rc_inputs); + /* XXX, zamiast static detached, sprawdzaj czy wejscie/wyjscie jest terminalem */ + if (detached || (rc_inputs == NULL)) return; @@ -1061,6 +1079,10 @@ n->backlog_size = 0; } + xfree(n->last_irctopic); + xfree(n->last_irctopicby); + xfree(n->last_ircmode); + xfree(n); } @@ -1171,17 +1193,11 @@ if (w == window_debug) /* XXX! */ goto cleanup; - /* XXX, sanityzowac (? na pewno?)*/ - if (!(n = w->private)) { /* BUGFIX, cause @ ui-window-print handler (not ncurses plugin one, ncurses plugin one is called last cause of 0 prio) * plugin may call print_window() */ remote_window_new(w); - if (!(n = w->private)) { - debug("remote_ui_window_print() IInd CC still not w->private, quitting...\n"); - return -1; - } } fstr = rc_fstring_reverse(line); @@ -1333,13 +1349,82 @@ return 0; } - static QUERY(remote_all_contacts_changed) { // remote_broadcast((data) ? "REFRESH_USERLIST_FULL\n" : "REFRESH_USERLIST\n"); /* XXX, nie przetwarzane */ /* XXX, inaczej, to tak nie bedzie dzialac. trzeba zrobic wsparcie dla wszystkich */ return 0; } +/* + * remote_statusbar_timer() + * + * podobnie jak w ncurses, wykonywane co 1s + * sprawdzamy czy nie zmienila sie liczba odebranych maili / topic aktualnego okienka + * + * NOTE: + * mozna by sprawdzac topici wszystkich okien przez: + * for (w = windows; w; w = w->next) { + * window_current = w; + * IRC_TOPIC() + * } + * ale imho to jest srednio potrzebne. + * user i tak zeby widziec topic musi sie na to okienko przelaczyc, + * jak sie przelaczy to remote-plugin bedzie o tym wiedziec. + * + * remote_statusbar_timer() sie wykona, pobierze nowy topic, wysle informacje przez broadcasta. + * no moze user bedzie troche confused jak mu sie topic zmieni w ciagu 1s, ale na to tez sa sposoby. + * + * np. podczas UI_WINDOW_SWITCH() wywolywac remote_statusbar_timer(), etc, etc.. + * + * anyway, lepsze to niz nic. + */ + +static TIMER(remote_statusbar_timer) { + int mail_count = -1; + char *irctopic, *irctopicby, *ircmode; + + remote_window_t *r; + + if (type) + return 0; + + if (query_emit_id(NULL, MAIL_COUNT, &mail_count) != -2) { + if (mail_count != rc_last_mail_count) { + rc_last_mail_count = mail_count; + remote_broadcast("MAILCOUNT", itoa(mail_count), NULL); + } + } + + /* just in case */ + if (!(window_current->private)) + remote_window_new(window_current); + + r = window_current->private; + + irctopic = irctopicby = ircmode = NULL; + query_emit_id(NULL, IRC_TOPIC, &irctopic, &irctopicby, &ircmode); + + if (xstrcmp(irctopic, r->last_irctopic)) { + xfree(r->last_irctopic); + r->last_irctopic = irctopic; + remote_broadcast("WINDOWINFO", itoa(window_current->id), "IRCTOPIC", irctopic, NULL); + } + + if (xstrcmp(irctopicby, r->last_irctopicby)) { + xfree(r->last_irctopicby); + r->last_irctopicby = irctopicby; + remote_broadcast("WINDOWINFO", itoa(window_current->id), "IRCTOPICBY", irctopicby, NULL); + } + + if (xstrcmp(ircmode, r->last_ircmode)) { + xfree(r->last_ircmode); + r->last_ircmode = ircmode; + remote_broadcast("WINDOWINFO", itoa(window_current->id), "IRCTOPICMODE", ircmode, NULL); + } + + return 0; +} + static void rc_variable_set(const char *var, const char *val) { variable_t *v; void *ptr; @@ -1512,6 +1597,8 @@ } } + timer_add(&remote_plugin, "remote:clock", 1, 1, remote_statusbar_timer, NULL); + /* XXX, signal()? on ^C, do ekg_exit() etc..? */ return 0; From svn w toxygen.net Thu Oct 16 17:52:08 2008 From: svn w toxygen.net (SVN commit) Date: Thu, 16 Oct 2008 17:52:08 +0200 (CEST) Subject: [ekg2-commit] r4717 - trunk/plugins/ncurses: trunk/plugins/ncurses/old.c Message-ID: <20081016155208.2370117B1F@toxygen.net> Author: darkjames Date: 2008-10-16 17:52:07 +0200 (Thu, 16 Oct 2008) New Revision: 4717 Modified: trunk/plugins/ncurses/old.c Log: - cleanup code - don't put KEY_RESIZE into buffer (porridge/darkjames) Modified: trunk/plugins/ncurses/old.c =================================================================== --- trunk/plugins/ncurses/old.c 2008-10-16 11:17:24 UTC (rev 4716) +++ trunk/plugins/ncurses/old.c 2008-10-16 15:52:07 UTC (rev 4717) @@ -2484,14 +2484,14 @@ { static int lock = 0; struct binding *b = NULL; - int tmp; unsigned int ch; + int getch_ret; ncurses_redraw_input_already_exec = 0; if (type) return 0; - switch ((tmp = ekg_getch(0, &ch))) { + switch ((getch_ret = ekg_getch(0, &ch))) { case(-1): /* dziwna kombinacja, która by blokowała */ case(-2): /* przeszlo przez query_emit i mamy zignorowac (pytthon, perl) */ case(0): /* Ctrl-Space, głupie to */ @@ -2599,18 +2599,20 @@ #if USE_UNICODE 0 && #endif - ch > KEY_MAX) { - + ch > KEY_MAX) + { debug_error("%s:%d INTERNAL NCURSES/EKG2 FAULT. KEY-PRESSED: %d>%d TO PROTECT FROM SIGSEGV\n", __FILE__, __LINE__, ch, KEY_MAX); goto then; } + /* XXX, when we got KEY_RESIZE, should we do something like in ncurses_watch_winch() ? */ + if ( #if USE_UNICODE - (((tmp == KEY_CODE_YES || ch < 0x100 /* TODO CHECK */))) && + (getch_ret == KEY_CODE_YES || ch < 0x100 /* TODO CHECK */) && #endif - (b = ncurses_binding_map[ch]) && b->action) { - + (b = ncurses_binding_map[ch]) && b->action) + { if (b->function) b->function(b->arg); else { @@ -2620,12 +2622,12 @@ } } else if ( #if USE_UNICODE - ((ch != KEY_MOUSE) || (0 && ch < 255)) && + (ch != KEY_MOUSE && ch != KEY_RESIZE) && #else - ch < 255 && + (ch < 255) && #endif - xwcslen(ncurses_line) < LINE_MAXLEN - 1) { - + xwcslen(ncurses_line) < LINE_MAXLEN - 1) + { /* move &ncurses_line[index_line] to &ncurses_line[index_line+1] */ memmove(ncurses_line + line_index + 1, ncurses_line + line_index, sizeof(CHAR_T) * (LINE_MAXLEN - line_index - 1)); /* put in ncurses_line[lindex_index] current char */ From svn w toxygen.net Thu Oct 16 18:28:08 2008 From: svn w toxygen.net (SVN commit) Date: Thu, 16 Oct 2008 18:28:08 +0200 (CEST) Subject: [ekg2-commit] r4718 - trunk/plugins/ncurses: trunk/plugins/ncurses/old.c Message-ID: <20081016162808.8574417B1F@toxygen.net> Author: darkjames Date: 2008-10-16 18:28:08 +0200 (Thu, 16 Oct 2008) New Revision: 4718 Modified: trunk/plugins/ncurses/old.c Log: revert KEY_RESIZE part of previous commit, it doesn't work, sorry. Modified: trunk/plugins/ncurses/old.c =================================================================== --- trunk/plugins/ncurses/old.c 2008-10-16 15:52:07 UTC (rev 4717) +++ trunk/plugins/ncurses/old.c 2008-10-16 16:28:08 UTC (rev 4718) @@ -2605,8 +2605,6 @@ goto then; } - /* XXX, when we got KEY_RESIZE, should we do something like in ncurses_watch_winch() ? */ - if ( #if USE_UNICODE (getch_ret == KEY_CODE_YES || ch < 0x100 /* TODO CHECK */) && @@ -2622,7 +2620,7 @@ } } else if ( #if USE_UNICODE - (ch != KEY_MOUSE && ch != KEY_RESIZE) && + (ch != KEY_MOUSE) && #else (ch < 255) && #endif From svn w toxygen.net Mon Oct 20 11:39:50 2008 From: svn w toxygen.net (SVN commit) Date: Mon, 20 Oct 2008 11:39:50 +0200 (CEST) Subject: [ekg2-commit] r4719 - trunk/plugins/remote: trunk/plugins/remote/remote.c Message-ID: <20081020093950.6375517B1F@toxygen.net> Author: darkjames Date: 2008-10-20 11:39:49 +0200 (Mon, 20 Oct 2008) New Revision: 4719 Modified: trunk/plugins/remote/remote.c Log: - dont put %n at the end of translated fstring - dont send CONNECETED info when session is disconnected Modified: trunk/plugins/remote/remote.c =================================================================== --- trunk/plugins/remote/remote.c 2008-10-16 16:28:08 UTC (rev 4718) +++ trunk/plugins/remote/remote.c 2008-10-20 09:39:49 UTC (rev 4719) @@ -247,13 +247,10 @@ string_append_c(asc, '\\'); string_append_c(asc, str[i]); } - -/* reset, and return. */ - string_append(asc, "%n"); - return string_free(asc, 0); - #undef prev #undef cur + + return string_free(asc, 0); } static string_t remote_what_to_write(char *what, va_list ap) { @@ -554,8 +551,9 @@ for (s = sessions; s; s = s->next) { remote_writefd(fd, "SESSION", s->uid, (s->plugin) ? ((plugin_t *) s->plugin)->name : "-", NULL); remote_writefd(fd, "SESSIONINFO", s->uid, "STATUS", itoa(s->status), NULL); - remote_writefd(fd, "SESSIONINFO", s->uid, "CONNECTED", itoa(s->connected), NULL); + if (s->connected) + remote_writefd(fd, "SESSIONINFO", s->uid, "CONNECTED", itoa(s->connected), NULL); if (s->alias) remote_writefd(fd, "SESSIONINFO", s->uid, "ALIAS", s->alias, NULL); } From svn w toxygen.net Mon Oct 20 14:45:56 2008 From: svn w toxygen.net (SVN commit) Date: Mon, 20 Oct 2008 14:45:56 +0200 (CEST) Subject: [ekg2-commit] r4720 - trunk/plugins/sniff: trunk/plugins/sniff/sniff.c Message-ID: <20081020124556.1C6E517B1F@toxygen.net> Author: darkjames Date: 2008-10-20 14:45:55 +0200 (Mon, 20 Oct 2008) New Revision: 4720 Modified: trunk/plugins/sniff/sniff.c Log: fix hexdump output, broken @ -r4417 (peres retab) Modified: trunk/plugins/sniff/sniff.c =================================================================== --- trunk/plugins/sniff/sniff.c 2008-10-20 09:39:49 UTC (rev 4719) +++ trunk/plugins/sniff/sniff.c 2008-10-20 12:45:55 UTC (rev 4720) @@ -197,15 +197,15 @@ else display_len = len; /* offset */ - debug_iorecv("\t0x%.4x ", offset); + debug_iorecv("\t0x%.4x ", offset); /* hexdump */ for(i = 0; i < MAX_BYTES_PER_LINE; i++) { if (i < display_len) debug_iorecv("%.2x ", payload[i]); - else debug_iorecv(" "); + else debug_iorecv(" "); } /* seperate */ - debug_iorecv(" "); + debug_iorecv(" "); /* asciidump if printable, else '.' */ for(i = 0; i < display_len; i++) From svn w toxygen.net Mon Oct 20 14:59:20 2008 From: svn w toxygen.net (SVN commit) Date: Mon, 20 Oct 2008 14:59:20 +0200 (CEST) Subject: [ekg2-commit] r4721 - trunk/plugins/sniff: trunk/plugins/sniff/sniff.c trunk/plugins/sniff/sniff_dns.h trunk/plugins/sniff/sniff_dns.inc Message-ID: <20081020125921.07CC917B1F@toxygen.net> Author: darkjames Date: 2008-10-20 14:59:20 +0200 (Mon, 20 Oct 2008) New Revision: 4721 Modified: trunk/plugins/sniff/sniff.c trunk/plugins/sniff/sniff_dns.h trunk/plugins/sniff/sniff_dns.inc Log: support for T_NS Modified: trunk/plugins/sniff/sniff.c =================================================================== --- trunk/plugins/sniff/sniff.c 2008-10-20 12:45:55 UTC (rev 4720) +++ trunk/plugins/sniff/sniff.c 2008-10-20 12:59:20 UTC (rev 4721) @@ -707,6 +707,7 @@ format_add("sniff_dns_entry_cname", ("%) %b[IN_CNAME] %gDOMAIN: %W%1 %gCNAME: %W%2"), 1); format_add("sniff_dns_entry_ptr", ("%) %b[IN_PTR] %gIP_PTR: %W%1 %gDOMAIN: %W%2"), 1); format_add("sniff_dns_entry_mx", ("%) %b[IN_MX] %gDOMAIN: %W%1 %gENTRY: %W%2 %gPREF: %W%3"), 1); + format_add("sniff_dns_entry_ns", ("%) %b[IN_NS] %gDOMAIN: %W%1 %gIP: %W%2"), 1); format_add("sniff_dns_entry_srv", ("%) %b[IN_SRV] %gDOMAIN: %W%1 %gENTRY: %W%2 %gPORT: %W%3 %gPRIO: %W%4 %gWEIGHT: %W%5"), 1); format_add("sniff_dns_entry_?", ("%) %b[IN_?] %gDOMAIN: %W%1 %gTYPE: %W%2 %gLEN: %W%3"), 1); format_add("sniff_dns_entry_ndisplay", ("%) %rZADEN REKORD NIE WYSWIETLONY DLA ZAPYTANIE POWYZEJ ;), OBEJRZYJ DEBUG"), 1); Modified: trunk/plugins/sniff/sniff_dns.h =================================================================== --- trunk/plugins/sniff/sniff_dns.h 2008-10-20 12:45:55 UTC (rev 4720) +++ trunk/plugins/sniff/sniff_dns.h 2008-10-20 12:59:20 UTC (rev 4721) @@ -177,6 +177,7 @@ #define REFUSED 5 /* Operation refused */ #define T_A 1 /* (IN) A */ +#define T_NS 2 /* (IN) NS */ #define T_CNAME 5 /* (IN) CNAME */ #define T_PTR 12 /* (IN) PTR */ #define T_MX 15 /* (IN) MX */ Modified: trunk/plugins/sniff/sniff_dns.inc =================================================================== --- trunk/plugins/sniff/sniff_dns.inc 2008-10-20 12:45:55 UTC (rev 4720) +++ trunk/plugins/sniff/sniff_dns.inc 2008-10-20 12:59:20 UTC (rev 4721) @@ -117,6 +117,18 @@ displayed = 1; break; + case T_NS: + if ((len = dn_expand(beg, eom, cur, tmp_addr, sizeof(tmp_addr))) < 0) { + debug_error("dn_expand() on T_NS failed\n"); + break; + } + + print_window_w(window_status, EKG_WINACT_MSG, "sniff_dns_entry_ns", + host, tmp_addr); + + displayed = 1; + break; + case T_AAAA: if (payload != 16) { debug_error("T_AAAA record but size != 16 [%d]\n", payload); From svn w toxygen.net Mon Oct 20 15:22:00 2008 From: svn w toxygen.net (SVN commit) Date: Mon, 20 Oct 2008 15:22:00 +0200 (CEST) Subject: [ekg2-commit] r4722 - trunk/contrib: trunk/contrib/log_raw_viewer.c Message-ID: <20081020132201.0AC6F17B1F@toxygen.net> Author: darkjames Date: 2008-10-20 15:22:00 +0200 (Mon, 20 Oct 2008) New Revision: 4722 Modified: trunk/contrib/log_raw_viewer.c Log: Huh! Wypadaloby to napisac jeszcze raz. Modified: trunk/contrib/log_raw_viewer.c =================================================================== --- trunk/contrib/log_raw_viewer.c 2008-10-20 12:59:20 UTC (rev 4721) +++ trunk/contrib/log_raw_viewer.c 2008-10-20 13:22:00 UTC (rev 4722) @@ -68,34 +68,22 @@ return (""); } -static const char *format_line(const char *str) { - while (*str) { - if (*str == '%') { - str++; - printf("%s", format_ansi(*str)); - str++; - } else { - putchar(*str); - str++; - } - } -} - int main() { char buf[4096]; - int len; int eaten = 0; + int len; - char *rbuf = buf; + while ((len = read(0, buf, sizeof(buf))) > 0) { + int begpos = 0; + int pos; - while ((len = read(0, buf, sizeof(buf)-1)) > 0) { if (eaten) { printf("%s", format_ansi(buf[0])); - rbuf++; + begpos = 1; eaten = 0; } - while (&(buf[len-1]) >= rbuf && buf[len-1] == '%') { + while (len > begpos && buf[len-1] == '%') { eaten++; len--; } @@ -108,14 +96,23 @@ eaten = 1; } - buf[len] = 0; - printf("%s", format_line(rbuf)); - rbuf = buf; + pos = begpos; + while (pos < len) { + if (buf[pos] == '%') { + pos++; + printf("%s", format_ansi(buf[pos])); + pos++; + } else { + putchar(buf[pos]); + pos++; + } + } + } printf("\n"); if (eaten) - fprintf(stderr, "BAD LOG-FILE? ended with: '%'\n"); + fprintf(stderr, "BAD LOG-FILE? ended with: '%%'\n"); return eaten; } From svn w toxygen.net Mon Oct 20 16:23:27 2008 From: svn w toxygen.net (SVN commit) Date: Mon, 20 Oct 2008 16:23:27 +0200 (CEST) Subject: [ekg2-commit] r4723 - trunk/contrib/patches: +trunk/contrib/patches/session-remove-fix-segv.diff Message-ID: <20081020142327.D20CE17B1F@toxygen.net> Author: darkjames Date: 2008-10-20 16:23:27 +0200 (Mon, 20 Oct 2008) New Revision: 4723 Added: trunk/contrib/patches/session-remove-fix-segv.diff Log: From svn w toxygen.net Tue Oct 21 09:42:09 2008 From: svn w toxygen.net (SVN commit) Date: Tue, 21 Oct 2008 09:42:09 +0200 (CEST) Subject: [ekg2-commit] r4724 - trunk/plugins/sniff: trunk/plugins/sniff/sniff.c trunk/plugins/sniff/sniff_gg.h trunk/plugins/sniff/sniff_gg.inc Message-ID: <20081021074209.9295017B1F@toxygen.net> Author: darkjames Date: 2008-10-21 09:42:08 +0200 (Tue, 21 Oct 2008) New Revision: 4724 Modified: trunk/plugins/sniff/sniff.c trunk/plugins/sniff/sniff_gg.h trunk/plugins/sniff/sniff_gg.inc Log: - move known stuff to libgadu into .h file. - display details what user looks for. (sniff_gg_pubdir50_req()) Modified: trunk/plugins/sniff/sniff.c =================================================================== --- trunk/plugins/sniff/sniff.c 2008-10-20 14:23:27 UTC (rev 4723) +++ trunk/plugins/sniff/sniff.c 2008-10-21 07:42:08 UTC (rev 4724) @@ -681,6 +681,8 @@ format_add("sniff_gg_list_data", ("%) %b[%1] %gENTRY: %W%2 %gTYPE: %W%3"), 1); format_add("sniff_gg_pubdir50_req", ("%) %b[GG_PUBDIR50_REQUEST] %gTYPE: %W%1 (%2) %gSEQ: %W%3"), 1); + format_add("sniff_gg_pubdir50_req_data", ("%) %gTYPE: %W%1 %gENTRY: %W%2"), 1); + format_add("sniff_gg_pubdir50_reply", ("%) %b[GG_PUBDIR50_REPLY] %gTYPE: %W%1 (%2) %gSEQ: %W%3"), 1); format_add("sniff_gg_disconnecting", ("%) %b[GG_DISCONNECTING]"), 1); Modified: trunk/plugins/sniff/sniff_gg.h =================================================================== --- trunk/plugins/sniff/sniff_gg.h 2008-10-20 14:23:27 UTC (rev 4723) +++ trunk/plugins/sniff/sniff_gg.h 2008-10-21 07:42:08 UTC (rev 4724) @@ -273,3 +273,85 @@ #define GG_DCC7_TYPE_VOICE 0x00000001 #define GG_DCC7_TYPE_FILE 0x00000004 +#define GG_SEND_MSG80 0x002d + +typedef struct { + uint32_t recipient; + uint32_t seq; + uint32_t msgclass; + uint32_t offset_plain; + uint32_t offset_attr; + char html_data[]; + + /* '\0' */ + /* plaintext msg */ + /* '\0' */ + /* uint32_t dunno3; */ /* { 02 06 00 00 } */ + /* uint8_t dunno4; */ /* { 00 } */ + /* uint32_t dunno5; */ /* like msgclass? */ /* { 08 00 00 00 } */ +} GG_PACKED gg_send_msg80; + +#define GG_RECV_MSG80 0x002e + +typedef struct gg_recv_msg80 { + uint32_t sender; + uint32_t seq; + uint32_t time; + uint32_t msgclass; + uint32_t offset_plain; + uint32_t offset_attr; + char html_data[]; + + /* '\0' */ + /* plaintext msg */ + /* '\0' */ + /* uint32_t dunno3; */ /* { 02 06 00 00 } */ + /* uint8_t dunno4; */ /* { 00 } */ + /* uint32_t dunno5; */ /* like msgclass? */ /* { 08 00 00 00 } */ +} GG_PACKED gg_recv_msg80; + +#define GG_STATUS_NOT_AVAIL 0x0001 /* niedostępny */ +#define GG_STATUS_NOT_AVAIL_DESCR 0x0015 /* niedostępny z opisem (4.8) */ +#define GG_STATUS_AVAIL 0x0002 /* dostępny */ +#define GG_STATUS_AVAIL_DESCR 0x0004 /* dostępny z opisem (4.9) */ +#define GG_STATUS_BUSY 0x0003 /* zajęty */ +#define GG_STATUS_BUSY_DESCR 0x0005 /* zajęty z opisem (4.8) */ +#define GG_STATUS_INVISIBLE 0x0014 /* niewidoczny (4.6) */ +#define GG_STATUS_INVISIBLE_DESCR 0x0016 /* niewidoczny z opisem (4.9) */ +#define GG_STATUS_BLOCKED 0x0006 /* zablokowany */ + +#define GG_STATUS_FRIENDS_MASK 0x8000 /* tylko dla znajomych (4.6) */ +#define GG_STATUS_VOICE_MASK 0x20000 /* czy ma wlaczone audio (7.7) */ + +#define GG_USERLIST_PUT 0x00 +#define GG_USERLIST_PUT_MORE 0x01 +#define GG_USERLIST_GET 0x02 + +#define GG_USERLIST_PUT_REPLY 0x00 +#define GG_USERLIST_PUT_MORE_REPLY 0x02 +#define GG_USERLIST_GET_REPLY 0x06 +#define GG_USERLIST_GET_MORE_REPLY 0x04 + +#define GG_PUBDIR50_WRITE 0x01 +#define GG_PUBDIR50_READ 0x02 +#define GG_PUBDIR50_SEARCH_REQUEST 0x03 +#define GG_PUBDIR50_SEARCH_REPLY 0x05 + +#define GG_PUBDIR50_UIN "FmNumber" +#define GG_PUBDIR50_STATUS "FmStatus" +#define GG_PUBDIR50_FIRSTNAME "firstname" +#define GG_PUBDIR50_LASTNAME "lastname" +#define GG_PUBDIR50_NICKNAME "nickname" +#define GG_PUBDIR50_BIRTHYEAR "birthyear" +#define GG_PUBDIR50_CITY "city" +#define GG_PUBDIR50_GENDER "gender" +#define GG_PUBDIR50_ACTIVE "ActiveOnly" +#define GG_PUBDIR50_START "fmstart" +#define GG_PUBDIR50_FAMILYNAME "familyname" +#define GG_PUBDIR50_FAMILYCITY "familycity" + +#define GG_ACK_BLOCKED 0x0001 +#define GG_ACK_DELIVERED 0x0002 +#define GG_ACK_QUEUED 0x0003 +#define GG_ACK_MBOXFULL 0x0004 +#define GG_ACK_NOT_DELIVERED 0x0006 Modified: trunk/plugins/sniff/sniff_gg.inc =================================================================== --- trunk/plugins/sniff/sniff_gg.inc 2008-10-20 14:23:27 UTC (rev 4723) +++ trunk/plugins/sniff/sniff_gg.inc 2008-10-21 07:42:08 UTC (rev 4724) @@ -7,18 +7,6 @@ /* stolen from libgadu+gg plugin */ static int gg_status_to_text(uint32_t status, int *descr) { -#define GG_STATUS_NOT_AVAIL 0x0001 /* niedostępny */ -#define GG_STATUS_NOT_AVAIL_DESCR 0x0015 /* niedostępny z opisem (4.8) */ -#define GG_STATUS_AVAIL 0x0002 /* dostępny */ -#define GG_STATUS_AVAIL_DESCR 0x0004 /* dostępny z opisem (4.9) */ -#define GG_STATUS_BUSY 0x0003 /* zajęty */ -#define GG_STATUS_BUSY_DESCR 0x0005 /* zajęty z opisem (4.8) */ -#define GG_STATUS_INVISIBLE 0x0014 /* niewidoczny (4.6) */ -#define GG_STATUS_INVISIBLE_DESCR 0x0016 /* niewidoczny z opisem (4.9) */ -#define GG_STATUS_BLOCKED 0x0006 /* zablokowany */ - -#define GG_STATUS_FRIENDS_MASK 0x8000 /* tylko dla znajomych (4.6) */ -#define GG_STATUS_VOICE_MASK 0x20000 /* czy ma wlaczone audio (7.7) */ if (status & GG_STATUS_FRIENDS_MASK) status -= GG_STATUS_FRIENDS_MASK; if (status & GG_STATUS_VOICE_MASK) { status -= GG_STATUS_VOICE_MASK; @@ -157,11 +145,6 @@ } SNIFF_HANDLER(sniff_gg_send_msg_ack, gg_send_msg_ack) { -#define GG_ACK_BLOCKED 0x0001 -#define GG_ACK_DELIVERED 0x0002 -#define GG_ACK_QUEUED 0x0003 -#define GG_ACK_MBOXFULL 0x0004 -#define GG_ACK_NOT_DELIVERED 0x0006 const char *format; CHECK_LEN(sizeof(gg_send_msg_ack)) len -= sizeof(gg_send_msg_ack); @@ -352,10 +335,6 @@ } static const char *sniff_gg_userlist_reply_str(uint8_t type) { -#define GG_USERLIST_PUT_REPLY 0x00 -#define GG_USERLIST_PUT_MORE_REPLY 0x02 -#define GG_USERLIST_GET_REPLY 0x06 -#define GG_USERLIST_GET_MORE_REPLY 0x04 if (type == GG_USERLIST_PUT_REPLY) return "GG_USERLIST_PUT_REPLY"; if (type == GG_USERLIST_PUT_MORE_REPLY) return "GG_USERLIST_PUT_MORE_REPLY"; if (type == GG_USERLIST_GET_REPLY) return "GG_USERLIST_GET_REPLY"; @@ -392,12 +371,7 @@ return 0; } - - static const char *sniff_gg_userlist_req_str(uint8_t type) { -#define GG_USERLIST_PUT 0x00 -#define GG_USERLIST_PUT_MORE 0x01 -#define GG_USERLIST_GET 0x02 if (type == GG_USERLIST_PUT) return "GG_USERLIST_PUT"; if (type == GG_USERLIST_PUT_MORE) return "GG_USERLIST_PUT_MORE"; if (type == GG_USERLIST_GET) return "GG_USERLIST_GET"; @@ -433,11 +407,26 @@ return 0; } +static const char *sniff_gg_pubdir50_data_str(const char *name) { + if (!xstrcmp(name, GG_PUBDIR50_UIN)) return "GG_PUBDIR50_UIN"; + if (!xstrcmp(name, GG_PUBDIR50_STATUS)) return "GG_PUBDIR50_STATUS"; + if (!xstrcmp(name, GG_PUBDIR50_FIRSTNAME)) return "GG_PUBDIR50_FIRSTNAME"; + if (!xstrcmp(name, GG_PUBDIR50_LASTNAME)) return "GG_PUBDIR50_LASTNAME"; + if (!xstrcmp(name, GG_PUBDIR50_NICKNAME)) return "GG_PUBDIR50_NICKNAME"; + if (!xstrcmp(name, GG_PUBDIR50_BIRTHYEAR)) return "GG_PUBDIR50_BIRTHYEAR"; + if (!xstrcmp(name, GG_PUBDIR50_CITY)) return "GG_PUBDIR50_CITY"; + if (!xstrcmp(name, GG_PUBDIR50_GENDER)) return "GG_PUBDIR50_GENDER"; + if (!xstrcmp(name, GG_PUBDIR50_ACTIVE)) return "GG_PUBDIR50_ACTIVE"; + if (!xstrcmp(name, GG_PUBDIR50_START)) return "GG_PUBDIR50_START"; + if (!xstrcmp(name, GG_PUBDIR50_FAMILYNAME)) return "GG_PUBDIR50_FAMILYNAME"; + if (!xstrcmp(name, GG_PUBDIR50_FAMILYCITY)) return "GG_PUBDIR50_FAMILYCITY"; + + debug_error("sniff_gg_pubdir50_data_str() unk name: %s\n", name); + + return name; +} + static const char *sniff_gg_pubdir50_str(uint8_t type) { -#define GG_PUBDIR50_WRITE 0x01 -#define GG_PUBDIR50_READ 0x02 -#define GG_PUBDIR50_SEARCH_REQUEST 0x03 -#define GG_PUBDIR50_SEARCH_REPLY 0x05 if (type == GG_PUBDIR50_WRITE) return "GG_PUBDIR50_WRITE"; if (type == GG_PUBDIR50_READ) return "GG_PUBDIR50_READ"; if (type == GG_PUBDIR50_SEARCH_REQUEST) return "GG_PUBDIR50_SEARCH_REQUEST"; @@ -465,19 +454,57 @@ } SNIFF_HANDLER(sniff_gg_pubdir50_req, gg_pubdir50_request) { + char *attr = NULL; + char *val = NULL; + char *data; + CHECK_LEN(sizeof(gg_pubdir50_request)); len -= sizeof(gg_pubdir50_request); - if (len) { - debug_error("sniff_gg_pubdir50_req() stublen: %d\n", len); - tcp_print_payload((u_char *) pkt->data, len); - } - print_window(build_windowip_name(hdr->srcip) /* ip and/or gg# */, s, EKG_WINACT_MSG, 1, "sniff_gg_pubdir50_req", sniff_gg_pubdir50_str(pkt->type), build_hex(pkt->type), itoa(pkt->seq)); + data = pkt->data; + + while (len > 0) { + char *thisdata; + int thislen; + + thisdata = xstrndup(data, len); + thislen = xstrlen(thisdata); + + if (!attr) + attr = thisdata; + else if (!val) + val = thisdata; + + if (val && attr) { + print_window(build_windowip_name(hdr->srcip) /* ip and/or gg# */, s, EKG_WINACT_MSG, 1, + "sniff_gg_pubdir50_req_data", + sniff_gg_pubdir50_data_str(attr), val); + + xfree(attr); + xfree(val); + val = attr = NULL; + } + + data += thislen; + len -= thislen; + + if (len > 0) { /* skip NUL */ + data++; + len--; + } + } + + if (attr) + debug_error("sniff_gg_pubdir50_req() attr alone: %s\n", attr); + + xfree(attr); + xfree(val); + return 0; } @@ -901,7 +928,6 @@ return 0; } - #define GG_LOGIN80 0x29 typedef struct { @@ -1105,45 +1131,10 @@ return 0; } -#define GG_RECV_MSG80 0x2e - -typedef struct { - uint32_t sender; - uint32_t seq; - uint32_t time; - uint32_t msgclass; - uint32_t offset_plaintext; - uint32_t offset_attr; - char msg_data[]; - /* '\0' */ - /* plaintext msg */ - /* '\0' */ - /* uint32_t dunno3; */ /* { 02 06 00 00 } */ - /* uint8_t dunno4; */ /* { 00 } */ - /* uint32_t dunno5; */ /* like msgclass? */ /* { 08 00 00 00 } */ -} GG_PACKED gg_recv_msg80; - SNIFF_HANDLER(sniff_gg_recv_msg80, gg_recv_msg80) { /* XXX, like sniff_gg_send_msg80() */ } -#define GG_SEND_MSG80 0x2d - -typedef struct { - uint32_t recipient; - uint32_t seq; /* time(0) */ - uint32_t msgclass; /* GG_CLASS_CHAT { 08 00 00 00 } */ - uint32_t offset_plaintext; - uint32_t offset_attr; - char html_data[]; - /* '\0' */ - /* plaintext msg */ - /* '\0' */ - /* uint32_t dunno3; */ /* { 02 06 00 00 } */ - /* uint8_t dunno4; */ /* { 00 } */ - /* uint32_t dunno5; */ /* like msgclass? */ /* { 08 00 00 00 } */ -} GG_PACKED gg_send_msg80; - SNIFF_HANDLER(sniff_gg_send_msg80, gg_send_msg80) { int orglen = len; char *msg; @@ -1152,13 +1143,13 @@ tcp_print_payload((unsigned char *) pkt->html_data, len); - if (pkt->offset_plaintext < orglen) - tcp_print_payload(((unsigned char *) pkt) + pkt->offset_plaintext, orglen - pkt->offset_plaintext); + if (pkt->offset_plain < orglen) + tcp_print_payload(((unsigned char *) pkt) + pkt->offset_plain, orglen - pkt->offset_plain); if (pkt->offset_attr < orglen) tcp_print_payload(((unsigned char *) pkt) + pkt->offset_attr, orglen - pkt->offset_attr); - if (pkt->offset_plaintext < orglen) { - msg = ekg_cp_to_locale(xstrndup(((char *) pkt) + pkt->offset_plaintext, orglen - pkt->offset_plaintext)); + if (pkt->offset_plain < orglen) { + msg = ekg_cp_to_locale(xstrndup(((char *) pkt) + pkt->offset_plain, orglen - pkt->offset_plain)); sniff_gg_print_message(s, hdr, pkt->recipient, EKG_MSGCLASS_SENT_CHAT, msg, time(NULL)); xfree(msg); } @@ -1166,7 +1157,6 @@ return 0; } - static const struct { uint32_t type; char *sname; From svn w toxygen.net Tue Oct 21 16:40:18 2008 From: svn w toxygen.net (SVN commit) Date: Tue, 21 Oct 2008 16:40:18 +02