mirror of
https://github.com/siemens-mobile-hacks/naticq_server.git
synced 2026-11-25 18:27:17 +00:00
Checked in the latest version of IG11 source code
The code doesn't currently compile, at least on FreeBSD 13.2. But the protocol used to talk to ICQ servers is not in use anyway. So this code is more like a historical artifact than anything that can be used right now. This code lived under svn.boba.su/Sect.
This commit is contained in:
commit
6f9948063b
18 changed files with 10033 additions and 0 deletions
96
ChangeLog.txt
Normal file
96
ChangeLog.txt
Normal file
|
|
@ -0,0 +1,96 @@
|
|||
Лог предыдущих ревизий (SVN-сервер <CENSORED>)
|
||||
|
||||
|
||||
------------------------------------------------------------------------
|
||||
r50 | Kibab | 2008-10-15 18:01:49 +0400 (ср, 15 окт 2008) | 4 lines
|
||||
|
||||
[+] Makefile.non-secta для сборки публичных версий.
|
||||
В публичной версии отсутствует обращение к <CENSORED>, не ведётся отлов <CENSORED>.
|
||||
|
||||
|
||||
------------------------------------------------------------------------
|
||||
r49 | Kibab | 2008-10-15 13:57:49 +0400 (ср, 15 окт 2008) | 4 lines
|
||||
|
||||
[*] Сборка проходит на GNU/Linux 32-bit gcc 3.4.3.
|
||||
[+] Добавлена strip в Makefile.release.
|
||||
|
||||
|
||||
------------------------------------------------------------------------
|
||||
r48 | Kibab | 2008-10-15 12:54:30 +0400 (ср, 15 окт 2008) | 3 lines
|
||||
|
||||
- Установка SO_NOSIGPIPE на серверном сокете и на клиентских. А также на сокете к серверу AOL.
|
||||
|
||||
|
||||
------------------------------------------------------------------------
|
||||
r47 | Kibab | 2008-10-15 11:31:57 +0400 (ср, 15 окт 2008) | 6 lines
|
||||
|
||||
[+] Установка также и SO_REUSEPORT в дополнение к SO_REUSEADDR;
|
||||
[+] Использование мьютексов вместо SysV-семафоров - не будет ошибок, связанных с отсутствием семафоров в системе;
|
||||
[+] Добавлен обработчик SIGPIPE для отлова сигналов от мёртвых сокетов, в которые сервер пытается писать;
|
||||
[+] Добавлен Makefile.release для компиляции без ассертов и дебаг-принтов. Туда надо ещё добавить strip, что сильно уменьшит размер эльфа.
|
||||
|
||||
|
||||
------------------------------------------------------------------------
|
||||
r46 | Kibab | 2008-10-13 13:05:51 +0400 (пн, 13 окт 2008) | 4 lines
|
||||
|
||||
[+] Забыл написать - SO_REUSEADDR теперь работает;
|
||||
[*] в Windows-версии вернул удаление критической секции.
|
||||
|
||||
|
||||
------------------------------------------------------------------------
|
||||
r45 | Kibab | 2008-10-13 13:00:57 +0400 (пн, 13 окт 2008) | 4 lines
|
||||
|
||||
[+] Выход из цикла обслуживания клиентов по SIGINT (Ctrl-C);
|
||||
[+] Синхронизация потоков при обновлении статистики (через системные семафоры).
|
||||
|
||||
|
||||
------------------------------------------------------------------------
|
||||
r44 | Kibab | 2008-10-12 22:29:13 +0400 (вс, 12 окт 2008) | 8 lines
|
||||
|
||||
- Проект стал собираться под FreeBSD. Работает нормально, но:
|
||||
* Нет синхронизации потоков при доступе к обновлению статистики по клиентам - надо добавить аналог критической секции;
|
||||
* Почему-то даёт сбой попытка SO_REUSEADDR;
|
||||
* Необходим рефакторинг кода в main.cpp, чтобы можно было более удобно слить с main_freebsd.cpp;
|
||||
* Компиляция под Linux не гарантируется - пока не проверял.
|
||||
Как бы то ни было, начало положено.
|
||||
|
||||
|
||||
------------------------------------------------------------------------
|
||||
r41 | _Rst7 | 2008-10-03 14:20:03 +0400 (пт, 03 окт 2008) | 1 line
|
||||
|
||||
!<CENSORED> <CENSORED> в отдельный файл <CENSORED>. На данный момент <CENSORED> <CENSORED> <CENSORED> <CENSORED> <CENSORED>
|
||||
------------------------------------------------------------------------
|
||||
r40 | _Rst7 | 2008-10-03 14:18:19 +0400 (пт, 03 окт 2008) | 1 line
|
||||
|
||||
!небольшая оптимизации send, как-то по 2 TCP-пакета на один SNAC будет многовато...
|
||||
------------------------------------------------------------------------
|
||||
r39 | _Rst7 | 2008-09-30 14:35:30 +0400 (вт, 30 сен 2008) | 1 line
|
||||
|
||||
!Немного неудачный предыдущий коммит
|
||||
------------------------------------------------------------------------
|
||||
r38 | _Rst7 | 2008-09-30 14:33:27 +0400 (вт, 30 сен 2008) | 1 line
|
||||
|
||||
+Переделал прием оффлайн-сообщений. Теперь не тупит ;)
|
||||
------------------------------------------------------------------------
|
||||
r37 | Kibab | 2008-08-13 13:23:11 +0400 (ср, 13 авг 2008) | 3 lines
|
||||
|
||||
-[+] Добавил маленькое приложеньице, в котором буду тестить компиляцию под *nix различных модулей ;-)
|
||||
|
||||
|
||||
------------------------------------------------------------------------
|
||||
r36 | _Rst7 | 2008-08-13 12:13:51 +0400 (ср, 13 авг 2008) | 1 line
|
||||
|
||||
!Немного заменил значения таймаутов для работы на загруженной машине.
|
||||
------------------------------------------------------------------------
|
||||
r34 | _Rst7 | 2008-03-18 13:39:47 +0300 (вт, 18 мар 2008) | 1 line
|
||||
|
||||
!Правильная комманда для добавления в бадилист
|
||||
------------------------------------------------------------------------
|
||||
r13 | Kibab | 2007-10-24 12:57:30 +0400 (ср, 24 окт 2007) | 1 line
|
||||
|
||||
[+] Initial commit of IG11 files.
|
||||
------------------------------------------------------------------------
|
||||
r12 | Kibab | 2007-10-24 12:54:03 +0400 (ср, 24 окт 2007) | 1 line
|
||||
|
||||
|
||||
------------------------------------------------------------------------
|
||||
16
Makefile.release
Normal file
16
Makefile.release
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
APP=ig11
|
||||
SRCS=statgen.cpp md5.cpp snaccache.cpp main_freebsd.cpp flap.cpp icqkid2.cpp
|
||||
OBJS=${SRCS:.cpp=.o}
|
||||
|
||||
CC=g++
|
||||
CXXFLAGS=-O2 -DNDEBUG
|
||||
LDFLAGS= -pthread
|
||||
|
||||
link: writerevision ${OBJS}
|
||||
@${CC} -o ${APP} ${CXXFLAGS} ${OBJS} ${LDFLAGS}
|
||||
@strip ${APP}
|
||||
clean:
|
||||
@rm -rf *.o ${APP}
|
||||
|
||||
writerevision:
|
||||
@echo "#define __SVN_REVISION__ \"`svnversion`\"" > revision.h
|
||||
14
README.txt
Normal file
14
README.txt
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
Сервер NatICQ
|
||||
(c) Rst7, BoBa, Kibab
|
||||
=====================
|
||||
Использование:
|
||||
./ig11 5050 путь_к_файлу_статистики
|
||||
В директории с сервером лежит файл stat_template.txt, в который необходимо положить шаблон страницы с информацией о количестве подключённых клиентов.
|
||||
Его содержимое будет записываться в файл_статистики. Файл статистики -- текстовый файл, в котором "%d" будет заменяться на число клиентов.
|
||||
|
||||
Пример запуска на "боевом" сервере:
|
||||
#!/bin/sh
|
||||
cd igserver
|
||||
/usr/sbin/daemon -u nobody ./ig11 5050 /path/to/www/clients_count.html > ig_log.txt
|
||||
|
||||
Багрепорты по работе сервера принимаются только при указании точной версии ОС и сервера, а также используемой версии NatICQ.
|
||||
39
common.h
Normal file
39
common.h
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
/***************************************************************************
|
||||
* Copyright (C) 2007 by Andrey "Ice" Sploshnov *
|
||||
* ice.nightcrawler@gmail.com *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 2 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with this program; if not, write to the *
|
||||
* Free Software Foundation, Inc., *
|
||||
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef ICQKID_COMMON_H
|
||||
#define ICQKID_COMMON_H
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <stdint.h>
|
||||
typedef unsigned char uint8_t;
|
||||
typedef unsigned short uint16_t;
|
||||
// typedef unsigned long uint32_t;
|
||||
#elif defined STDC_HEADERS
|
||||
# include <stdint.h>
|
||||
#else
|
||||
# include <sys/types.h>
|
||||
#endif
|
||||
|
||||
#endif /* ICQKID_COMMON_H */
|
||||
348
flap.h
Normal file
348
flap.h
Normal file
|
|
@ -0,0 +1,348 @@
|
|||
/***************************************************************************
|
||||
* Copyright (C) 2007 by Alexander S. Salieff *
|
||||
* salieff@mail.ru *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 2 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with this program; if not, write to the *
|
||||
* Free Software Foundation, Inc., *
|
||||
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef _FLAP_H_
|
||||
#define _FLAP_H_
|
||||
|
||||
#include <vector>
|
||||
#include <string>
|
||||
#include <stdlib.h>
|
||||
#include "common.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
// Available frame types
|
||||
#define FT_SIGNON 1
|
||||
#define FT_DATA 2
|
||||
#define FT_ERROR 3
|
||||
#define FT_SIGNOFF 4
|
||||
#define FT_KEEP_ALIVE 5
|
||||
|
||||
#define TLV_UID 0x01
|
||||
#define TLV_PWD 0x02
|
||||
#define TLV_CLI_STR_ID 0x03
|
||||
#define TLV_BOSS_ADDR 0x05
|
||||
#define TLV_AUTH_COOKIE 0x06
|
||||
#define TLV_CLI_NUM_DISTR 0x14
|
||||
#define TLV_CLI_NUM_ID 0x16
|
||||
#define TLV_CLI_VER_MAJOR 0x17
|
||||
#define TLV_CLI_VER_MINOR 0x18
|
||||
#define TLV_CLI_VER_LESSER 0x19
|
||||
#define TLV_CLI_NUM_BUILD 0x1a
|
||||
#define TLV_CLI_LANG 0x0f
|
||||
#define TLV_CLI_COUNTRY 0x0e
|
||||
|
||||
class FlapPacket{
|
||||
public:
|
||||
FlapPacket(void);
|
||||
~FlapPacket();
|
||||
|
||||
bool recv_from(int sock);
|
||||
bool send_to(int sock);
|
||||
|
||||
uint8_t frame_type;
|
||||
uint16_t seq_number;
|
||||
|
||||
vector<uint8_t> payload;
|
||||
|
||||
int t_network_error;
|
||||
};
|
||||
|
||||
class SNACData{
|
||||
public:
|
||||
SNACData(void);
|
||||
~SNACData();
|
||||
|
||||
bool decode_from(vector<uint8_t> & v, size_t start_ind=0);
|
||||
void encode_to(vector<uint8_t> & v, size_t start_ind=0);
|
||||
|
||||
uint16_t service_id;
|
||||
uint16_t subtype_id;
|
||||
uint16_t flags;
|
||||
uint32_t req_id;
|
||||
|
||||
vector<uint8_t> data;
|
||||
};
|
||||
|
||||
class TLVField{
|
||||
public:
|
||||
TLVField(void);
|
||||
TLVField(uint8_t i, uint16_t t) { data.resize(1); data[0]=i; type=t; }
|
||||
TLVField(uint16_t i, uint16_t t) { putInt16(i); type=t; }
|
||||
TLVField(uint32_t i, uint16_t t) { putInt32(i); type=t; }
|
||||
TLVField(string s, uint16_t t) { putString(s); type=t; }
|
||||
TLVField(vector<uint8_t> & v, uint16_t t) { data=v; type=t; }
|
||||
TLVField(const uint8_t * p, size_t p_len, uint16_t t) { if (p_len>0 && p!=NULL) data.assign(p, p+p_len); else data.clear(); type=t; }
|
||||
~TLVField();
|
||||
|
||||
bool getAsInt16(uint16_t & i);
|
||||
void putInt16(uint16_t i);
|
||||
|
||||
bool getAsInt32(uint32_t & i);
|
||||
void putInt32(uint32_t i);
|
||||
|
||||
bool getAsString(string & s);
|
||||
void putString(string s);
|
||||
|
||||
bool decode_from(vector<uint8_t> & v, size_t start_ind);
|
||||
void encode_to(vector<uint8_t> & v, size_t start_ind);
|
||||
|
||||
// For simplify can set type manually, without accessors
|
||||
uint16_t type;
|
||||
vector<uint8_t> data;
|
||||
};
|
||||
|
||||
class TLVPack{
|
||||
public:
|
||||
TLVPack(void);
|
||||
virtual ~TLVPack();
|
||||
|
||||
virtual bool decode_from(vector<uint8_t> & v, size_t start_ind=0);
|
||||
virtual void encode_to(vector<uint8_t> & v, size_t start_ind=0);
|
||||
|
||||
TLVField * findTLV(uint16_t t);
|
||||
|
||||
vector<TLVField> data;
|
||||
};
|
||||
|
||||
class SignOnPacket : public TLVPack {
|
||||
public:
|
||||
SignOnPacket(void);
|
||||
virtual ~SignOnPacket();
|
||||
|
||||
virtual bool decode_from(vector<uint8_t> & v, size_t start_ind=0);
|
||||
virtual void encode_to(vector<uint8_t> & v, size_t start_ind=0);
|
||||
};
|
||||
|
||||
class SignOffPacket : public TLVPack {
|
||||
public:
|
||||
SignOffPacket(void);
|
||||
virtual ~SignOffPacket();
|
||||
|
||||
virtual bool decode_from(vector<uint8_t> & v, size_t start_ind=0);
|
||||
virtual void encode_to(vector<uint8_t> & v, size_t start_ind=0);
|
||||
};
|
||||
|
||||
class BaseMsg{
|
||||
public:
|
||||
BaseMsg(void);
|
||||
virtual ~BaseMsg();
|
||||
|
||||
uint8_t msg_cookie[8];
|
||||
uint16_t msg_channel;
|
||||
string uin;
|
||||
vector<TLVField> data;
|
||||
|
||||
protected:
|
||||
bool decode_header(vector<uint8_t> & v, size_t start_ind=0);
|
||||
void encode_header(vector<uint8_t> & v, size_t start_ind=0);
|
||||
bool decode_data(vector<uint8_t> & v, size_t start_ind);
|
||||
void encode_data(vector<uint8_t> & v, size_t start_ind);
|
||||
};
|
||||
|
||||
class BaseOutgoingMsg : public BaseMsg{
|
||||
public:
|
||||
BaseOutgoingMsg(void);
|
||||
virtual ~BaseOutgoingMsg();
|
||||
|
||||
void encode_to(vector<uint8_t> & v, size_t start_ind=0);
|
||||
};
|
||||
|
||||
class BaseIncomingMsg : public BaseMsg{
|
||||
public:
|
||||
BaseIncomingMsg(void);
|
||||
virtual ~BaseIncomingMsg();
|
||||
|
||||
bool decode_from(vector<uint8_t> & v, size_t start_ind=0);
|
||||
};
|
||||
|
||||
class SimpleMsg{
|
||||
public:
|
||||
SimpleMsg(void);
|
||||
~SimpleMsg();
|
||||
|
||||
bool decode_from(vector<TLVField> & tlv_v);
|
||||
void encode_to(vector<TLVField> & tlv_v);
|
||||
|
||||
uint16_t charset;
|
||||
uint16_t sub_charset;
|
||||
string message_str;
|
||||
};
|
||||
|
||||
class TLV2711{
|
||||
public:
|
||||
TLV2711(void);
|
||||
~TLV2711();
|
||||
|
||||
bool decode_from(vector<uint8_t> & data, size_t pos=0);
|
||||
void encode_to(vector<uint8_t> & data, size_t pos=0);
|
||||
|
||||
bool parseXtrazRequest(void);
|
||||
bool parseXtrazResponse(void);
|
||||
|
||||
uint16_t version;
|
||||
uint16_t cookie;
|
||||
uint8_t msg_type;
|
||||
uint8_t flags;
|
||||
uint16_t status;
|
||||
uint16_t priority;
|
||||
|
||||
string text;
|
||||
|
||||
uint8_t text_color[4]; //RGBN
|
||||
uint8_t bg_color[4]; //RGBN
|
||||
string text_guid;
|
||||
|
||||
uint8_t plug_guid[16];
|
||||
uint16_t plug_func_id;
|
||||
string plug_name;
|
||||
string xtraz_script_text;
|
||||
string xstat_sender_id;
|
||||
vector<uint8_t> x_status;
|
||||
string x_title;
|
||||
string x_descr;
|
||||
};
|
||||
|
||||
class RendezVousMsg{
|
||||
public:
|
||||
RendezVousMsg(void);
|
||||
~RendezVousMsg();
|
||||
|
||||
bool decode_from(vector<uint8_t> & data);
|
||||
void encode_to(vector<uint8_t> & data);
|
||||
|
||||
uint16_t type; // 0 - request, 1 - cancel, 2 - accept
|
||||
uint8_t cookie[8];
|
||||
uint8_t capability[16];
|
||||
uint32_t external_ip; // In host format
|
||||
uint16_t external_port;
|
||||
TLV2711 tlv2711;
|
||||
};
|
||||
|
||||
|
||||
class ExtendedMsg{
|
||||
public:
|
||||
ExtendedMsg(void);
|
||||
~ExtendedMsg();
|
||||
|
||||
bool decode_from(vector<TLVField> & tlv_v);
|
||||
void encode_to(vector<TLVField> & tlv_v);
|
||||
|
||||
uint16_t user_class;
|
||||
uint32_t user_status;
|
||||
uint32_t online_time;
|
||||
uint32_t create_time;
|
||||
|
||||
RendezVousMsg rv_msg;
|
||||
};
|
||||
|
||||
class OldStyleMsg{
|
||||
public:
|
||||
OldStyleMsg(void);
|
||||
~OldStyleMsg();
|
||||
|
||||
bool decode_from(vector<TLVField> & tlv_v);
|
||||
void encode_to(vector<TLVField> & tlv_v);
|
||||
|
||||
uint32_t sender_uin;
|
||||
uint8_t msg_type;
|
||||
uint8_t msg_flags;
|
||||
string message_str;
|
||||
};
|
||||
|
||||
class SSIContactListItem{
|
||||
public:
|
||||
SSIContactListItem(void);
|
||||
~SSIContactListItem();
|
||||
|
||||
bool decode_from(vector<uint8_t> & v, size_t start_ind);
|
||||
void encode_to(vector<uint8_t> & v, size_t start_ind);
|
||||
|
||||
uint16_t name_length;
|
||||
string name;
|
||||
uint16_t group_id;
|
||||
uint16_t item_id;
|
||||
uint16_t type;
|
||||
uint16_t payload_length;
|
||||
|
||||
vector<TLVField> payload;
|
||||
};
|
||||
|
||||
class SSIContactList{
|
||||
public:
|
||||
SSIContactList(void);
|
||||
~SSIContactList();
|
||||
|
||||
bool decode_from(vector<uint8_t> & v, size_t start_ind=0);
|
||||
|
||||
uint8_t ssi_version;
|
||||
uint16_t items_count;
|
||||
uint32_t last_timestamp;
|
||||
|
||||
vector<SSIContactListItem> items;
|
||||
};
|
||||
|
||||
class ICBMParameters{
|
||||
public:
|
||||
ICBMParameters(void);
|
||||
~ICBMParameters();
|
||||
|
||||
bool decode_from(vector<uint8_t> & v, size_t start_ind=0);
|
||||
void encode_to(vector<uint8_t> & v, size_t start_ind=0);
|
||||
|
||||
uint16_t channel;
|
||||
uint32_t msg_flags;
|
||||
uint16_t max_snac_size;
|
||||
uint16_t max_send_warn_lev;
|
||||
uint16_t max_recv_warn_lev;
|
||||
uint16_t min_msg_interval;
|
||||
};
|
||||
|
||||
class DownloadBuddyIconRequest{
|
||||
public:
|
||||
DownloadBuddyIconRequest(void);
|
||||
~DownloadBuddyIconRequest();
|
||||
|
||||
void encode_to(vector<uint8_t> & v, size_t start_ind=0);
|
||||
|
||||
string uin;
|
||||
uint8_t cmd;
|
||||
uint16_t icon_id;
|
||||
uint8_t icon_flags;
|
||||
uint8_t hash_size;
|
||||
uint8_t md5_hash[16];
|
||||
};
|
||||
|
||||
class DownloadBuddyIconReply{
|
||||
public:
|
||||
DownloadBuddyIconReply(void);
|
||||
~DownloadBuddyIconReply();
|
||||
|
||||
bool decode_from(vector<uint8_t> & v, size_t start_ind=0);
|
||||
|
||||
string uin;
|
||||
uint16_t icon_id;
|
||||
uint8_t icon_flags;
|
||||
uint8_t md5_hash[16];
|
||||
uint8_t cmd;
|
||||
vector<uint8_t> icon_data;
|
||||
};
|
||||
|
||||
#endif
|
||||
5086
icqkid2.cpp
Normal file
5086
icqkid2.cpp
Normal file
File diff suppressed because it is too large
Load diff
622
icqkid2.h
Normal file
622
icqkid2.h
Normal file
|
|
@ -0,0 +1,622 @@
|
|||
/***************************************************************************
|
||||
* Copyright (C) 2007 by Alexander S. Salieff *
|
||||
* salieff@mail.ru *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 2 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with this program; if not, write to the *
|
||||
* Free Software Foundation, Inc., *
|
||||
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
|
||||
***************************************************************************/
|
||||
|
||||
// Internal version - ALPHA 5.2
|
||||
|
||||
#ifndef _ICQ_KID_2_H_
|
||||
#define _ICQ_KID_2_H_
|
||||
|
||||
#include "common.h"
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <map>
|
||||
#include <set>
|
||||
using namespace std;
|
||||
|
||||
#include <time.h>
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <stdint.h>
|
||||
typedef char int8_t;
|
||||
typedef short int int16_t;
|
||||
// typedef long int int32_t;
|
||||
|
||||
typedef unsigned char uint8_t;
|
||||
typedef unsigned short int uint16_t;
|
||||
// typedef unsigned long int uint32_t;
|
||||
#else
|
||||
#include <sys/types.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#endif
|
||||
|
||||
#include "icqkid2_constants.h"
|
||||
|
||||
class SSIUINEntry{
|
||||
public:
|
||||
SSIUINEntry(void)
|
||||
{
|
||||
groupid=0;
|
||||
itemid=0;
|
||||
waitauth=false;
|
||||
last_internal_ip=0;
|
||||
last_internal_port=0;
|
||||
last_external_ip=0;
|
||||
have_icon=false;
|
||||
icon_id=0;
|
||||
icon_flags=0;
|
||||
memset(icon_md5_hash, 0, 16);
|
||||
online_status=STATUS_OFFLINE;
|
||||
status_modifiers=0;
|
||||
invisible=false;
|
||||
xStatus.clear();
|
||||
isBLM=false;
|
||||
srv_relay_cap=false;
|
||||
unicode_cap=false;
|
||||
online_since=0;
|
||||
idle_since=0;
|
||||
ig_cap=false;
|
||||
pidor=false;
|
||||
clientid=0;
|
||||
}
|
||||
|
||||
string uin;
|
||||
string nick;
|
||||
uint16_t groupid;
|
||||
string groupname;
|
||||
uint16_t itemid;
|
||||
bool waitauth;
|
||||
|
||||
uint32_t last_internal_ip;
|
||||
uint32_t last_internal_port;
|
||||
uint32_t last_external_ip;
|
||||
|
||||
bool have_icon;
|
||||
uint16_t icon_id;
|
||||
uint8_t icon_flags;
|
||||
uint8_t icon_md5_hash[16];
|
||||
vector<uint8_t> icon_data;
|
||||
|
||||
uint32_t online_status;
|
||||
uint32_t status_modifiers;
|
||||
bool invisible;
|
||||
|
||||
vector<uint8_t> xStatus;
|
||||
string xStatusTitle;
|
||||
string xStatusDescription;
|
||||
|
||||
bool isBLM;
|
||||
|
||||
bool srv_relay_cap;
|
||||
bool unicode_cap;
|
||||
bool ig_cap;
|
||||
bool pidor;
|
||||
uint8_t clientid;
|
||||
|
||||
string AutoAwayMessageText;
|
||||
string AutoBusyMessageText;
|
||||
string AutoNotAvailableMessageText;
|
||||
string AutoDoNotDisturbMessageText;
|
||||
string AutoFreeForChatMessageText;
|
||||
|
||||
uint32_t online_since;
|
||||
uint32_t idle_since;
|
||||
uint32_t proto;
|
||||
};
|
||||
|
||||
class SSIGroupEntry{
|
||||
public:
|
||||
uint16_t id;
|
||||
string name;
|
||||
};
|
||||
|
||||
class ICQKidShortUserInfo{
|
||||
public:
|
||||
string Uin;
|
||||
string Nickname;
|
||||
string Firstname;
|
||||
string Lastname;
|
||||
string Email;
|
||||
int Gender;
|
||||
bool Needauth;
|
||||
uint32_t Status;
|
||||
uint16_t Age;
|
||||
};
|
||||
|
||||
class ICQKidFullUserInfo{
|
||||
public:
|
||||
ICQKidFullUserInfo(void) : Homecountry(0), GMToffset(0), Auth(0), Webaware(0), DCpermissions(0), Pubprimarymail(0), \
|
||||
Age(0), Gender(0), Birthyear(0), Birthmonth(0), Birthday(0), Language1(0), Language2(0), Language3(0), Origcountry(0), \
|
||||
Maritalstatus(0), Allowspam(0), Codepage(0), Homepageenabled(0), Homepagecategory(0), Workcountry(0), Workoccupation(0), \
|
||||
Interest1category(0), Interest2category(0), Interest3category(0), Interest4category(0), \
|
||||
Past1category(0), Past2category(0), Past3category(0), \
|
||||
Affiliation1category(0), Affiliation2category(0), Affiliation3category(0), \
|
||||
Minage(0), Maxage(0), Searchonline(0) {}
|
||||
|
||||
// Basic info
|
||||
string Uin;
|
||||
string Nickname;
|
||||
string Firstname;
|
||||
string Lastname;
|
||||
string Email;
|
||||
string Homecity;
|
||||
string Homestate;
|
||||
string Homephone;
|
||||
string Homefax;
|
||||
string Homeaddress;
|
||||
string Cellphone;
|
||||
string Homezip;
|
||||
uint16_t Homecountry;
|
||||
int8_t GMToffset; // Signed! Real value = GMT + (-1*GMToffset/2)
|
||||
uint8_t Auth;
|
||||
uint8_t Webaware;
|
||||
uint8_t DCpermissions;
|
||||
uint8_t Pubprimarymail;
|
||||
|
||||
// More info
|
||||
uint16_t Age;
|
||||
uint8_t Gender;
|
||||
string Homepage;
|
||||
uint16_t Birthyear;
|
||||
uint8_t Birthmonth;
|
||||
uint8_t Birthday;
|
||||
uint8_t Language1;
|
||||
uint8_t Language2;
|
||||
uint8_t Language3;
|
||||
string Origcity;
|
||||
string Origstate;
|
||||
uint16_t Origcountry;
|
||||
uint8_t Maritalstatus;
|
||||
uint8_t Allowspam;
|
||||
uint16_t Codepage;
|
||||
|
||||
// Email info
|
||||
vector<pair<string, uint8_t> > Emails; // email and public flag
|
||||
|
||||
// Homepage category Info
|
||||
uint8_t Homepageenabled;
|
||||
uint16_t Homepagecategory;
|
||||
string Homepagekeywords;
|
||||
|
||||
// Work info
|
||||
string Workcity;
|
||||
string Workstate;
|
||||
string Workphone;
|
||||
string Workfax;
|
||||
string Workaddress;
|
||||
string Workzip;
|
||||
uint16_t Workcountry;
|
||||
string Workcompany;
|
||||
string Workdepartment;
|
||||
string Workposition;
|
||||
uint16_t Workoccupation;
|
||||
string Workwebpage;
|
||||
|
||||
// Notes info
|
||||
string Notes;
|
||||
|
||||
// Interests info
|
||||
uint16_t Interest1category;
|
||||
string Interest1;
|
||||
uint16_t Interest2category;
|
||||
string Interest2;
|
||||
uint16_t Interest3category;
|
||||
string Interest3;
|
||||
uint16_t Interest4category;
|
||||
string Interest4;
|
||||
|
||||
// Affiliations info
|
||||
uint16_t Past1category;
|
||||
string Past1;
|
||||
uint16_t Past2category;
|
||||
string Past2;
|
||||
uint16_t Past3category;
|
||||
string Past3;
|
||||
uint16_t Affiliation1category;
|
||||
string Affiliation1;
|
||||
uint16_t Affiliation2category;
|
||||
string Affiliation2;
|
||||
uint16_t Affiliation3category;
|
||||
string Affiliation3;
|
||||
|
||||
// Additional for white pages search
|
||||
uint16_t Minage;
|
||||
uint16_t Maxage;
|
||||
string Searchkey;
|
||||
uint8_t Searchonline;
|
||||
};
|
||||
|
||||
class SnacCache;
|
||||
class SNACData;
|
||||
|
||||
class ICQKid2{
|
||||
public:
|
||||
string mypassword;
|
||||
virtual void getMD5hash(vector<uint8_t> md5_salt, uint8_t * md5_hash);
|
||||
typedef enum
|
||||
{
|
||||
NONE,
|
||||
HTTP,
|
||||
SOCKS4,
|
||||
SOCKS5
|
||||
} ProxyType;
|
||||
|
||||
ICQKid2(void);
|
||||
virtual ~ICQKid2();
|
||||
|
||||
void setUIN(string auin) { myuin=auin; }
|
||||
void setPassword(string apwd) { mypassword=apwd; }
|
||||
void setLoginHost(string ahost="login.icq.com", int aport=5190) { loginhost=ahost; loginport=aport; }
|
||||
void setProxy(string ahost="", int aport=0, string auid="", string apwd="", ProxyType apr_type=NONE)
|
||||
{
|
||||
proxy_host=ahost;
|
||||
proxy_port=aport;
|
||||
proxy_uid=auid;
|
||||
proxy_pwd=apwd;
|
||||
proxy_type=apr_type;
|
||||
}
|
||||
|
||||
bool doConnect(uint32_t astat=STATUS_ONLINE);
|
||||
void doDisconnect(void);
|
||||
bool setStatus(uint32_t astat);
|
||||
uint32_t getMyOnlineStatus(void) const { return online_status; }
|
||||
bool setXStatus(size_t x_stat, string title, string descr);
|
||||
|
||||
bool registerNewUIN(string password, string & new_uin);
|
||||
bool changePassword(string new_password);
|
||||
|
||||
bool getUserInfo(string uin, ICQKidShortUserInfo & info, bool force_update=false);
|
||||
bool getFullUserInfo(string uin, ICQKidFullUserInfo & info, bool force_update=false);
|
||||
bool publicMyInfo(ICQKidFullUserInfo & info);
|
||||
|
||||
bool searchByMail(string email, vector<ICQKidShortUserInfo> & result_vec);
|
||||
bool searchByUIN(string uin, vector<ICQKidShortUserInfo> & result_vec);
|
||||
bool searchByWhitePages(ICQKidFullUserInfo & info, vector<ICQKidShortUserInfo> & result_vec);
|
||||
|
||||
class SSITransactContact {
|
||||
public:
|
||||
string uin;
|
||||
string nick;
|
||||
string groupname;
|
||||
uint16_t retflag;
|
||||
};
|
||||
|
||||
bool addContact(string uin, string nick, string groupname, uint16_t * retflag=NULL);
|
||||
bool removeContact(string uin, uint16_t * retflag=NULL);
|
||||
bool renameContact(string uin, string nick, uint16_t * retflag=NULL);
|
||||
|
||||
bool addContacts(vector<SSITransactContact> & cont_vec);
|
||||
bool removeContacts(vector<SSITransactContact> & cont_vec);
|
||||
bool renameContacts(vector<SSITransactContact> & cont_vec);
|
||||
|
||||
bool addBLMContact(string uin);
|
||||
bool removeBLMContact(string uin);
|
||||
|
||||
bool addBLMContacts(vector<string> & uins);
|
||||
bool removeBLMContacts(vector<string> & uins);
|
||||
|
||||
bool addGroup(string groupname, uint16_t * retflag=NULL);
|
||||
bool removeGroup(string groupname, uint16_t * retflag=NULL);
|
||||
bool renameGroup(string groupname, string newname, uint16_t * retflag=NULL);
|
||||
|
||||
bool updateContactList(void);
|
||||
|
||||
bool authRequest(string uin, string text);
|
||||
bool authReply(string uin, string text, uint8_t aflag);
|
||||
|
||||
bool getBuddyIcon(string uin);
|
||||
bool downloadMyIcon(void);
|
||||
bool uploadMyIcon(vector<uint8_t> & icon_data);
|
||||
bool deleteMyIcon(void) { return removeAllMyIcons(); }
|
||||
|
||||
bool addVisible(string uin, string nick="") { return addVisInvisIgnor(VisibleList, 0x0002, uin, nick); }
|
||||
bool removeVisible(string uin, string nick="") { return removeVisInvisIgnor(VisibleList, 0x0002, uin); }
|
||||
|
||||
bool addInvisible(string uin, string nick="") { return addVisInvisIgnor(InvisibleList, 0x0003, uin, nick); }
|
||||
bool removeInvisible(string uin, string nick="") { return removeVisInvisIgnor(InvisibleList, 0x0003, uin); }
|
||||
|
||||
// inline bool addIgnore(string uin, string nick="") { if (!removeContact(uin)) return false; return addVisInvisIgnor(IgnoreList, 0x000E, uin, nick); }
|
||||
bool addIgnore(string uin, string nick="") { return addVisInvisIgnor(IgnoreList, 0x000E, uin, nick); }
|
||||
bool removeIgnore(string uin, string nick="") { return removeVisInvisIgnor(IgnoreList, 0x000E, uin); }
|
||||
|
||||
uint8_t getMyPrivacyStatus(void) const { return myPrivSrvStatus; }
|
||||
bool setMyPrivacyStatus(uint8_t stat);
|
||||
|
||||
class ICQKid2Message {
|
||||
public:
|
||||
typedef enum
|
||||
{
|
||||
USASCII,
|
||||
LOCAL8BIT,
|
||||
UCS2BE,
|
||||
UTF8
|
||||
} EncodeType;
|
||||
|
||||
ICQKid2Message(void)
|
||||
{
|
||||
enc_type=LOCAL8BIT;
|
||||
codepage=0;
|
||||
memset(text_color, 0, 4);
|
||||
memset(bg_color, 0xff, 4);
|
||||
bg_color[3]=0;
|
||||
is_offline=false;
|
||||
}
|
||||
|
||||
ICQKid2Message(string auin, string atext, \
|
||||
EncodeType aenc_type=LOCAL8BIT, uint16_t acodepage=0, \
|
||||
bool ais_offline=false, \
|
||||
uint8_t * atext_color=NULL, uint8_t * abg_color=NULL)
|
||||
{
|
||||
uin=auin;
|
||||
text=atext;
|
||||
enc_type=aenc_type;
|
||||
codepage=acodepage;
|
||||
if (atext_color) memcpy(text_color, atext_color, 4);
|
||||
else memset(text_color, 0, 4);
|
||||
if (abg_color) memcpy(bg_color, abg_color, 4);
|
||||
else
|
||||
{
|
||||
memset(bg_color, 0xff, 4);
|
||||
bg_color[3]=0;
|
||||
}
|
||||
is_offline=ais_offline;
|
||||
}
|
||||
|
||||
uint8_t cookie[8];
|
||||
bool cookie_valid;
|
||||
|
||||
string uin; // from or to
|
||||
string text;
|
||||
uint8_t text_color[4]; //RGBN
|
||||
uint8_t bg_color[4]; //RGBN
|
||||
EncodeType enc_type;
|
||||
uint16_t codepage;
|
||||
bool is_offline;
|
||||
time_t timestamp;
|
||||
};
|
||||
|
||||
bool sendMessage(ICQKid2Message amsg, unsigned short cookie);
|
||||
bool sendMTN(string to, uint16_t atype);
|
||||
bool mainLoop(bool & break_flag);
|
||||
bool sendMsgAutoResponse(string touin, uint8_t * msg_cookie, uint8_t type=MSG_TYPE_PLAINTEXT);
|
||||
|
||||
virtual void onIdle(void) {}
|
||||
virtual void onIncomingMTN(string from, uint16_t atype) {}
|
||||
virtual void onIncomingMsg(ICQKid2Message msg) {}
|
||||
virtual void onAuthRequest(string from, string text) {}
|
||||
virtual void onAuthReply(string from, string text, uint8_t aflag) {}
|
||||
virtual void onUserNotify(string uin, uint32_t stat1, uint32_t stat2, bool invis_flag, vector<uint8_t> xs) {}
|
||||
virtual void onClientIDNotify(string from, uint8_t clientid) {}
|
||||
virtual void onContactListChanged(void) {}
|
||||
virtual void onWasAdded(string from) {}
|
||||
virtual void onIconChanged(string uin) {}
|
||||
virtual void onXstatusChanged(string uin, vector<uint8_t> x_status, string x_title, string x_descr) {}
|
||||
virtual void onRegisterControlPicture(vector<uint8_t> & pic_data, string mime_type, string & pic_str) {}
|
||||
virtual void onIncomingAutoStatusMsg(ICQKid2Message msg, uint8_t type) {}
|
||||
virtual void onSingOff(uint16_t err_code, string err_url) {}
|
||||
virtual void onClientMsgAck(string uin, uint8_t *cookie) {}
|
||||
virtual void onServerMsgAck(string uin, uint8_t *cookie) {}
|
||||
|
||||
int findCLUIN(string uin);
|
||||
int findCLUIN(uint16_t item_id);
|
||||
int findCLGroup(string groupname);
|
||||
int findCLGroup(uint16_t group_id);
|
||||
|
||||
vector<SSIUINEntry> ContactListUins;
|
||||
vector<SSIGroupEntry> ContactListGroups;
|
||||
vector<SSIUINEntry> ContactListIcons;
|
||||
|
||||
vector<SSIUINEntry> VisibleList;
|
||||
vector<SSIUINEntry> InvisibleList;
|
||||
vector<SSIUINEntry> IgnoreList;
|
||||
|
||||
string AutoAwayMessageText;
|
||||
string AutoBusyMessageText;
|
||||
string AutoNotAvailableMessageText;
|
||||
string AutoDoNotDisturbMessageText;
|
||||
string AutoFreeForChatMessageText;
|
||||
|
||||
string subClientId;
|
||||
string subIGId;
|
||||
|
||||
int getConnectPercentage(void) const { return connect_phase_percentage; }
|
||||
void setNetworkTimeout(int tm) { network_timeout=tm; }
|
||||
int getNetworkTimeout(void) const { return network_timeout; }
|
||||
void breakNetworkOperation(void) { network_break_flag=true; }
|
||||
|
||||
bool getOfflineMessages(void);
|
||||
int pollIncomingEvents(int tmout);
|
||||
|
||||
uint16_t connect_error_code;
|
||||
string connect_error_url;
|
||||
|
||||
void sendXtrazRequest(string uin);
|
||||
|
||||
size_t xStatus;
|
||||
string xStatusTitle;
|
||||
string xStatusDescription;
|
||||
|
||||
int connect_phase_percentage;
|
||||
string myuin;
|
||||
|
||||
private:
|
||||
string proxy_host;
|
||||
int proxy_port;
|
||||
string proxy_uid;
|
||||
string proxy_pwd;
|
||||
ProxyType proxy_type;
|
||||
|
||||
string loginhost;
|
||||
int loginport;
|
||||
|
||||
uint32_t offl_msg_sync_id;
|
||||
|
||||
int sock;
|
||||
|
||||
uint16_t flap_seq_number;
|
||||
uint32_t snac_seq_number;
|
||||
|
||||
vector<pair<uint16_t, uint16_t> > server_services_list;
|
||||
vector<uint16_t> server_rate_groups;
|
||||
|
||||
map<string, ICQKidShortUserInfo> userinfo_map;
|
||||
map<string, ICQKidFullUserInfo> userfullinfo_map;
|
||||
|
||||
ICQKid2 * icons_service;
|
||||
|
||||
int directConnect(string ahost, int aport);
|
||||
|
||||
ICQKid2 * getInstanceForService(uint16_t family);
|
||||
|
||||
bool doConnect_phase2(uint32_t astat, string boss_host, int boss_port, vector<uint8_t> & boss_cookie, bool short_phase=false);
|
||||
|
||||
bool waitHello(void);
|
||||
bool sendSignOn0(void);
|
||||
bool sendMD5saltrequest(uint32_t * snac_sync);
|
||||
bool getMD5salt(uint32_t snac_sync, vector<uint8_t> & md5_salt);
|
||||
bool sendMD5authorize(uint32_t * snac_sync, vector<uint8_t> & md5_salt);
|
||||
bool getBOSSparams(string & boss_host, int & boss_port, vector<uint8_t> & cookie);
|
||||
bool sendSignOff(void);
|
||||
bool sendSignOn2(vector<uint8_t> & cookie);
|
||||
|
||||
bool getServiceList(void);
|
||||
bool askServices(void);
|
||||
bool getServices(void);
|
||||
|
||||
bool askRateLimits(uint32_t * sync_id);
|
||||
bool getRateLimits(uint32_t sync_id);
|
||||
bool sendRateLimits(void);
|
||||
|
||||
bool askSelfInfo(uint32_t * sync_id);
|
||||
bool getSelfInfo(uint32_t sync_id);
|
||||
|
||||
bool askLocationLimit(uint32_t * sync_id);
|
||||
bool getLocationLimit(uint32_t sync_id);
|
||||
bool sendLocationInfo(void);
|
||||
|
||||
bool askBLMLimit(uint32_t * sync_id);
|
||||
bool getBLMLimit(uint32_t sync_id);
|
||||
|
||||
bool askICBMParams(uint32_t * sync_id);
|
||||
bool getICBMParams(uint32_t sync_id);
|
||||
bool sendICBMParams(void);
|
||||
|
||||
bool askPRMLimit(uint32_t * sync_id);
|
||||
bool getPRMLimit(uint32_t sync_id);
|
||||
|
||||
bool askSSILimit(uint32_t * sync_id);
|
||||
bool getSSILimit(uint32_t sync_id);
|
||||
bool askSSICopy(uint32_t * sync_id);
|
||||
bool getSSICopy(uint32_t sync_id);
|
||||
bool activateSSI(void);
|
||||
|
||||
bool sendStatus(uint32_t astat=STATUS_ONLINE, bool ext=false);
|
||||
bool sendReady(void);
|
||||
|
||||
bool sendAuthResponse(string uin, string text, uint8_t aflag);
|
||||
bool sendAuthRequest(string uin, string text);
|
||||
|
||||
bool askOfflMsgAction(uint8_t flag, uint32_t * sync_id);
|
||||
bool getOfflMsg(SNACData & snd);
|
||||
|
||||
bool askShortInfo(string uin, uint32_t * sync_id);
|
||||
bool getShortInfo(ICQKidShortUserInfo & info, uint32_t sync_id);
|
||||
|
||||
bool askFullInfo(string uin, uint32_t * sync_id);
|
||||
bool getFullInfo(ICQKidFullUserInfo & info, uint32_t sync_id);
|
||||
|
||||
void parseBasicUserInfo(vector<uint8_t> & data, ICQKidFullUserInfo & info);
|
||||
void parseMoreUserInfo(vector<uint8_t> & data, ICQKidFullUserInfo & info);
|
||||
void parseEmailUserInfo(vector<uint8_t> & data, ICQKidFullUserInfo & info);
|
||||
void parseHpagecatUserInfo(vector<uint8_t> & data, ICQKidFullUserInfo & info);
|
||||
void parseWorkUserInfo(vector<uint8_t> & data, ICQKidFullUserInfo & info);
|
||||
void parseNotesUserInfo(vector<uint8_t> & data, ICQKidFullUserInfo & info);
|
||||
void parseInterestsUserInfo(vector<uint8_t> & data, ICQKidFullUserInfo & info);
|
||||
void parseAffiliationsUserInfo(vector<uint8_t> & data, ICQKidFullUserInfo & info);
|
||||
|
||||
bool getSearchAnswer(vector<ICQKidShortUserInfo> & result_vec, uint32_t snac_sync);
|
||||
|
||||
bool parseIncomingMsg(ICQKid2Message & msg, vector<uint8_t> & data);
|
||||
bool parseIncomingMTN(string & from, uint16_t & type, vector<uint8_t> & data);
|
||||
bool parseAuthRequest(string & from, string & text, vector<uint8_t> & data);
|
||||
bool parseAuthReply(string & from, string & text, uint8_t & aflag, vector<uint8_t> & data);
|
||||
bool parseOnlineNotify(string & uin, uint32_t & stat, vector<uint8_t> & data, vector<uint8_t> &xs, uint8_t & clientid);
|
||||
bool parseOfflineNotify(string & uin, vector<uint8_t> & data);
|
||||
bool parseSSIAddNotify(vector<uint8_t> & data);
|
||||
bool parseSSIUpdateNotify(vector<uint8_t> & data);
|
||||
bool parseSSIDeleteNotify(vector<uint8_t> & data);
|
||||
bool parseWasAdded(string & from, vector<uint8_t> & data);
|
||||
bool parseXtrazResponse(string & from, vector<uint8_t> & x_status, string & x_title, string & x_descr, vector<uint8_t> & data);
|
||||
bool parseMsgAutoResponse(ICQKid2Message & msg, uint8_t & type, vector<uint8_t> & data);
|
||||
bool parseMsgServerResponse(vector<uint8_t> & data);
|
||||
|
||||
bool sengMsgAutoRequest(string touin, uint8_t type);
|
||||
|
||||
uint16_t getUnusedItemID(void);
|
||||
uint16_t getUnusedGroupID(void);
|
||||
bool startSSITransact(void);
|
||||
bool endSSITransact(void);
|
||||
bool getSSIEditAck(uint16_t & retflag, uint32_t sync_id);
|
||||
bool addDeleSSIUIN(SSIUINEntry uen, uint16_t flag, uint32_t * sync_id);
|
||||
bool addDeleSSIGroup(SSIGroupEntry gen, uint16_t flag, uint32_t * sync_id);
|
||||
bool updateSSIGroupContent(uint16_t group_id, uint32_t * sync_id);
|
||||
|
||||
bool removeAllMyIcons(void);
|
||||
|
||||
bool sub_ssi_addContact(string uin, string nick, string groupname, uint16_t * retflag);
|
||||
bool sub_ssi_removeContact(string uin, uint16_t * retflag);
|
||||
bool sub_ssi_renameContact(string uin, string nick, uint16_t * retflag);
|
||||
|
||||
bool sub_registerNewUIN_simply(ICQKid2 * regist_serv, string password, string & new_uin, string * control_str=NULL);
|
||||
bool sub_registerNewUIN_picture(ICQKid2 * regist_serv, string password, string & new_uin);
|
||||
|
||||
bool sub_getBuddyIcon(SSIUINEntry & uen);
|
||||
|
||||
bool haveSrvRelayCapability(vector<uint8_t> & data);
|
||||
bool haveUnicodeCapability(vector<uint8_t> & data);
|
||||
bool haveXtrazCapability(vector<uint8_t> & data, vector<uint8_t> & xs);
|
||||
// void sendXtrazRequest(string uin);
|
||||
void sendXStatusNotifyAutoResponse(string touin, uint8_t * msg_cookie);
|
||||
bool haveIGCapability(vector<uint8_t> & data);
|
||||
uint8_t getClientID(vector<uint8_t> & data);
|
||||
|
||||
bool addVisInvisIgnor(vector<SSIUINEntry> & cont, uint16_t it_type, string uin, string nick="");
|
||||
bool removeVisInvisIgnor(vector<SSIUINEntry> & cont, uint16_t it_type, string uin);
|
||||
|
||||
SnacCache * snac_cache;
|
||||
set<uint16_t> unknown_item_ids;
|
||||
|
||||
int waitSNAC(SNACData * snd);
|
||||
int sendSNAC(uint16_t service_id, uint16_t subtype_id, uint32_t * req_id=NULL, vector<uint8_t> * data_ptr=NULL);
|
||||
int sendKeepAlive(void);
|
||||
|
||||
int network_timeout;
|
||||
bool network_break_flag;
|
||||
|
||||
time_t last_keepalive_timestamp;
|
||||
|
||||
uint32_t online_status;
|
||||
|
||||
uint8_t myPrivSrvStatus;
|
||||
uint16_t myPrivSrvStatus_item_id;
|
||||
};
|
||||
|
||||
#endif
|
||||
581
icqkid2_constants.h
Normal file
581
icqkid2_constants.h
Normal file
|
|
@ -0,0 +1,581 @@
|
|||
/***************************************************************************
|
||||
* Copyright (C) 2007 by Alexander S. Salieff *
|
||||
* salieff@mail.ru *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 2 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with this program; if not, write to the *
|
||||
* Free Software Foundation, Inc., *
|
||||
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef _ICQKID2_CONSTANTS_H_
|
||||
#define _ICQKID2_CONSTANTS_H_
|
||||
|
||||
#define TNETWORK_CLOSE 0
|
||||
#define TNETWORK_ERR -1
|
||||
#define TNETWORK_TIMEOUT -2
|
||||
|
||||
#define STATUS_WEBAWARE (uint32_t)0x00010000
|
||||
#define STATUS_SHOWIP (uint32_t)0x00020000
|
||||
#define STATUS_BIRTHDAY (uint32_t)0x00080000
|
||||
#define STATUS_WEBFRONT (uint32_t)0x00200000
|
||||
#define STATUS_DCDISABLED (uint32_t)0x01000000
|
||||
#define STATUS_DCAUTH (uint32_t)0x10000000
|
||||
#define STATUS_DCCONT (uint32_t)0x20000000
|
||||
|
||||
// This status added by me for comfort,
|
||||
// there is not status for offline in protocol standard
|
||||
#define STATUS_OFFLINE (uint32_t)0xFFFFFFFF
|
||||
//00001000
|
||||
|
||||
#define STATUS_ONLINE (uint32_t)0x00000000
|
||||
#define STATUS_AWAY (uint32_t)0x00000001
|
||||
#define STATUS_DND (uint32_t)0x00000002
|
||||
#define STATUS_NA (uint32_t)0x00000004
|
||||
#define STATUS_OCCUPIED (uint32_t)0x00000010
|
||||
#define STATUS_FREE4CHAT (uint32_t)0x00000020
|
||||
#define STATUS_INVISIBLE (uint32_t)0x00000100
|
||||
|
||||
#define STATUS_EVIL (uint32_t)0x00003000
|
||||
#define STATUS_DEPRESSION (uint32_t)0x00004000
|
||||
#define STATUS_HOME (uint32_t)0x00005000
|
||||
#define STATUS_WORK (uint32_t)0x00006000
|
||||
#define STATUS_LUNCH (uint32_t)0x00002001
|
||||
|
||||
#define AUTH_DECLINED (uint8_t)0x00
|
||||
#define AUTH_ACCEPTED (uint8_t)0x01
|
||||
|
||||
#define SSI_EDIT_OK (uint16_t)0x0000
|
||||
#define SSI_EDIT_ERR_NOTFOUND (uint16_t)0x0002
|
||||
#define SSI_EDIT_ERR_EXIST (uint16_t)0x0003
|
||||
|
||||
// Added by me, there isnt in standard
|
||||
#define SSI_EDIT_ERR_NETWORK (uint16_t)0x0004
|
||||
|
||||
#define SSI_EDIT_ERR_CANTADD (uint16_t)0x000a
|
||||
#define SSI_EDIT_ERR_LIMIT (uint16_t)0x000c
|
||||
#define SSI_EDIT_ERR_AIMLIST (uint16_t)0x000d
|
||||
#define SSI_EDIT_ERR_NEEDAUTH (uint16_t)0x000e
|
||||
|
||||
#define MTN_BEGIN (uint16_t)0x0002
|
||||
#define MTN_TYPED (uint16_t)0x0001
|
||||
#define MTN_FINISH (uint16_t)0x0000
|
||||
|
||||
#define X_STATUS_NONE (size_t)0
|
||||
#define X_STATUS_ANGRY (size_t)1
|
||||
#define X_STATUS_BATH (size_t)2
|
||||
#define X_STATUS_TIRED (size_t)3
|
||||
#define X_STATUS_PARTY (size_t)4
|
||||
#define X_STATUS_BEER (size_t)5
|
||||
#define X_STATUS_THINK (size_t)6
|
||||
#define X_STATUS_EAT (size_t)7
|
||||
#define X_STATUS_TV (size_t)8
|
||||
#define X_STATUS_MEET (size_t)9
|
||||
#define X_STATUS_COFFEE (size_t)10
|
||||
#define X_STATUS_MUSIC (size_t)11
|
||||
#define X_STATUS_BUSINESS (size_t)12
|
||||
#define X_STATUS_SHOOT (size_t)13
|
||||
#define X_STATUS_FUN (size_t)14
|
||||
#define X_STATUS_PHONE (size_t)15
|
||||
#define X_STATUS_GAME (size_t)16
|
||||
#define X_STATUS_STUDY (size_t)17
|
||||
#define X_STATUS_SHOP (size_t)18
|
||||
#define X_STATUS_SICK (size_t)19
|
||||
#define X_STATUS_SLEEP (size_t)20
|
||||
#define X_STATUS_SURFING (size_t)21
|
||||
#define X_STATUS_BROWSE (size_t)22
|
||||
#define X_STATUS_WORK (size_t)23
|
||||
#define X_STATUS_TYPE (size_t)24
|
||||
#define X_STATUS_PICNIC (size_t)25
|
||||
#define X_STATUS_COOK (size_t)26
|
||||
#define X_STATUS_SMOKE (size_t)27
|
||||
#define X_STATUS_IM_HIGH (size_t)28
|
||||
#define X_STATUS_WC (size_t)29
|
||||
#define X_STATUS_BE_NOT_BE (size_t)30
|
||||
#define X_STATUS_PRO7_TV (size_t)31
|
||||
#define X_STATUS_LOVE (size_t)32
|
||||
#define X_STATUS_GOOGLE (size_t)33
|
||||
#define X_STATUS_NOTE (size_t)34
|
||||
|
||||
#define X_STATUS_MAX_BOUND X_STATUS_NOTE
|
||||
|
||||
// INFO CONSTANTS
|
||||
|
||||
#define INFO_COUNTRY_UNSPECIFIED 0
|
||||
#define INFO_COUNTRY_OTHER 9999
|
||||
#define INFO_COUNTRY_AFGHANISTAN 93
|
||||
#define INFO_COUNTRY_ALBANIA 355
|
||||
#define INFO_COUNTRY_ALGERIA 213
|
||||
#define INFO_COUNTRY_AMERICAN_SAMOA 684
|
||||
#define INFO_COUNTRY_ANDORRA 376
|
||||
#define INFO_COUNTRY_ANGOLA 244
|
||||
#define INFO_COUNTRY_ANGUILLA 101
|
||||
#define INFO_COUNTRY_ANTIGUA_AND_BARBUDA 102
|
||||
#define INFO_COUNTRY_ANTILLES 5902
|
||||
#define INFO_COUNTRY_ARGENTINA 54
|
||||
#define INFO_COUNTRY_ARMENIA 374
|
||||
#define INFO_COUNTRY_ARUBA 297
|
||||
#define INFO_COUNTRY_ASCENSION_ISLAND 247
|
||||
#define INFO_COUNTRY_AUSTRALIA 61
|
||||
#define INFO_COUNTRY_AUSTRIA 43
|
||||
#define INFO_COUNTRY_AZERBAIJAN 994
|
||||
#define INFO_COUNTRY_BAHAMAS 103
|
||||
#define INFO_COUNTRY_BAHRAIN 973
|
||||
#define INFO_COUNTRY_BANGLADESH 880
|
||||
#define INFO_COUNTRY_BARBADOS 104
|
||||
#define INFO_COUNTRY_BARBUDA 120
|
||||
#define INFO_COUNTRY_BELARUS 375
|
||||
#define INFO_COUNTRY_BELGIUM 32
|
||||
#define INFO_COUNTRY_BELIZE 501
|
||||
#define INFO_COUNTRY_BENIN 229
|
||||
#define INFO_COUNTRY_BERMUDA 105
|
||||
#define INFO_COUNTRY_BHUTAN 975
|
||||
#define INFO_COUNTRY_BOLIVIA 591
|
||||
#define INFO_COUNTRY_BOSNIA_AND_HERZEGOVINA 387
|
||||
#define INFO_COUNTRY_BOTSWANA 267
|
||||
#define INFO_COUNTRY_BRAZIL 55
|
||||
#define INFO_COUNTRY_BRITISH_VIRGIN_ISLANDS 106
|
||||
#define INFO_COUNTRY_BRUNEI 673
|
||||
#define INFO_COUNTRY_BULGARIA 359
|
||||
#define INFO_COUNTRY_BURKINA_FASO 226
|
||||
#define INFO_COUNTRY_BURUNDI 257
|
||||
#define INFO_COUNTRY_CAMBODIA 855
|
||||
#define INFO_COUNTRY_CAMEROON 237
|
||||
#define INFO_COUNTRY_CANADA 107
|
||||
#define INFO_COUNTRY_CANARY_ISLANDS 178
|
||||
#define INFO_COUNTRY_CAPE_VERDE_ISLANDS 238
|
||||
#define INFO_COUNTRY_CAYMAN_ISLANDS 108
|
||||
#define INFO_COUNTRY_CENTRAL_AFRICAN_REPUBLIC 236
|
||||
#define INFO_COUNTRY_CHAD 235
|
||||
#define INFO_COUNTRY_CHILE 56
|
||||
#define INFO_COUNTRY_CHINA 86
|
||||
#define INFO_COUNTRY_CHRISTMAS_ISLAND 672
|
||||
#define INFO_COUNTRY_COCOS_ISLANDS 6102
|
||||
#define INFO_COUNTRY_COCOS_KEELING_ISLANDS 6101
|
||||
#define INFO_COUNTRY_COLOMBIA 57
|
||||
#define INFO_COUNTRY_COMOROS 2691
|
||||
#define INFO_COUNTRY_CONGO 242
|
||||
#define INFO_COUNTRY_CONGO_ZAIRE 243
|
||||
#define INFO_COUNTRY_COOK_ISLANDS 682
|
||||
#define INFO_COUNTRY_COSTA_RICA 506
|
||||
#define INFO_COUNTRY_CROATIA 385
|
||||
#define INFO_COUNTRY_CUBA 53
|
||||
#define INFO_COUNTRY_CYPRUS 357
|
||||
#define INFO_COUNTRY_CZECH_REPUBLIC 420
|
||||
#define INFO_COUNTRY_DENMARK 45
|
||||
#define INFO_COUNTRY_DIEGO_GARCIA 246
|
||||
#define INFO_COUNTRY_DJIBOUTI 253
|
||||
#define INFO_COUNTRY_DOMINICA 109
|
||||
#define INFO_COUNTRY_DOMINICAN_REPUBLIC 110
|
||||
#define INFO_COUNTRY_ECUADOR 593
|
||||
#define INFO_COUNTRY_EGYPT 20
|
||||
#define INFO_COUNTRY_EL_SALVADOR 503
|
||||
#define INFO_COUNTRY_EQUATORIAL_GUINEA 240
|
||||
#define INFO_COUNTRY_ERITREA 291
|
||||
#define INFO_COUNTRY_ESTONIA 372
|
||||
#define INFO_COUNTRY_ETHIOPIA 251
|
||||
#define INFO_COUNTRY_FAEROE_ISLANDS 298
|
||||
#define INFO_COUNTRY_FALKLAND_ISLANDS 500
|
||||
#define INFO_COUNTRY_FIJI 679
|
||||
#define INFO_COUNTRY_FINLAND 358
|
||||
#define INFO_COUNTRY_FRANCE 33
|
||||
#define INFO_COUNTRY_FRENCH_ANTILLES 5901
|
||||
#define INFO_COUNTRY_FRENCH_GUIANA 594
|
||||
#define INFO_COUNTRY_FRENCH_POLYNESIA 689
|
||||
#define INFO_COUNTRY_GABON 241
|
||||
#define INFO_COUNTRY_GAMBIA 220
|
||||
#define INFO_COUNTRY_GEORGIA 995
|
||||
#define INFO_COUNTRY_GERMANY 49
|
||||
#define INFO_COUNTRY_GHANA 233
|
||||
#define INFO_COUNTRY_GIBRALTAR 350
|
||||
#define INFO_COUNTRY_GREECE 30
|
||||
#define INFO_COUNTRY_GREENLAND 299
|
||||
#define INFO_COUNTRY_GRENADA 111
|
||||
#define INFO_COUNTRY_GUADELOUPE 590
|
||||
#define INFO_COUNTRY_GUAM_US 671
|
||||
#define INFO_COUNTRY_GUATEMALA 502
|
||||
#define INFO_COUNTRY_GUINEA 224
|
||||
#define INFO_COUNTRY_GUINEA_BISSAU 245
|
||||
#define INFO_COUNTRY_GUYANA 592
|
||||
#define INFO_COUNTRY_HAITI 509
|
||||
#define INFO_COUNTRY_HONDURAS 504
|
||||
#define INFO_COUNTRY_HONG_KONG 852
|
||||
#define INFO_COUNTRY_HUNGARY 36
|
||||
#define INFO_COUNTRY_ICELAND 354
|
||||
#define INFO_COUNTRY_INDIA 91
|
||||
#define INFO_COUNTRY_INDONESIA 62
|
||||
#define INFO_COUNTRY_IRAN 98
|
||||
#define INFO_COUNTRY_IRAQ 964
|
||||
#define INFO_COUNTRY_IRELAND 353
|
||||
#define INFO_COUNTRY_ISRAEL 972
|
||||
#define INFO_COUNTRY_ITALY 39
|
||||
#define INFO_COUNTRY_IVORY_COAST 225
|
||||
#define INFO_COUNTRY_JAMAICA 112
|
||||
#define INFO_COUNTRY_JAPAN 81
|
||||
#define INFO_COUNTRY_JORDAN 962
|
||||
#define INFO_COUNTRY_KAZAKHSTAN 705
|
||||
#define INFO_COUNTRY_KENYA 254
|
||||
#define INFO_COUNTRY_KIRIBATI 686
|
||||
#define INFO_COUNTRY_KOREA_NORTH 850
|
||||
#define INFO_COUNTRY_KOREA_SOUTH 82
|
||||
#define INFO_COUNTRY_KUWAIT 965
|
||||
#define INFO_COUNTRY_KYRGYZSTAN 706
|
||||
#define INFO_COUNTRY_LAOS 856
|
||||
#define INFO_COUNTRY_LATVIA 371
|
||||
#define INFO_COUNTRY_LEBANON 961
|
||||
#define INFO_COUNTRY_LESOTHO 266
|
||||
#define INFO_COUNTRY_LIBERIA 231
|
||||
#define INFO_COUNTRY_LIBYA 218
|
||||
#define INFO_COUNTRY_LIECHTENSTEIN 4101
|
||||
#define INFO_COUNTRY_LITHUANIA 370
|
||||
#define INFO_COUNTRY_LUXEMBOURG 352
|
||||
#define INFO_COUNTRY_MACAU 853
|
||||
#define INFO_COUNTRY_MACEDONIA 389
|
||||
#define INFO_COUNTRY_MADAGASCAR 261
|
||||
#define INFO_COUNTRY_MALAWI 265
|
||||
#define INFO_COUNTRY_MALAYSIA 60
|
||||
#define INFO_COUNTRY_MALDIVES 960
|
||||
#define INFO_COUNTRY_MALI 223
|
||||
#define INFO_COUNTRY_MALTA 356
|
||||
#define INFO_COUNTRY_MARSHALL_ISLANDS 692
|
||||
#define INFO_COUNTRY_MARTINIQUE 596
|
||||
#define INFO_COUNTRY_MAURITANIA 222
|
||||
#define INFO_COUNTRY_MAURITIUS 230
|
||||
#define INFO_COUNTRY_MAYOTTE_ISLAND 269
|
||||
#define INFO_COUNTRY_MEXICO 52
|
||||
#define INFO_COUNTRY_MICRONESIA 691
|
||||
#define INFO_COUNTRY_MOLDOVA 373
|
||||
#define INFO_COUNTRY_MONACO 377
|
||||
#define INFO_COUNTRY_MONGOLIA 976
|
||||
#define INFO_COUNTRY_MONTSERRAT 113
|
||||
#define INFO_COUNTRY_MOROCCO 212
|
||||
#define INFO_COUNTRY_MOZAMBIQUE 258
|
||||
#define INFO_COUNTRY_MYANMAR 95
|
||||
#define INFO_COUNTRY_NAMIBIA 264
|
||||
#define INFO_COUNTRY_NAURU 674
|
||||
#define INFO_COUNTRY_NEPAL 977
|
||||
#define INFO_COUNTRY_NETHERLANDS 31
|
||||
#define INFO_COUNTRY_NETHERLANDS_ANTILLES 599
|
||||
#define INFO_COUNTRY_NEVIS 114
|
||||
#define INFO_COUNTRY_NEW_CALEDONIA 687
|
||||
#define INFO_COUNTRY_NEW_ZEALAND 64
|
||||
#define INFO_COUNTRY_NICARAGUA 505
|
||||
#define INFO_COUNTRY_NIGER 227
|
||||
#define INFO_COUNTRY_NIGERIA 234
|
||||
#define INFO_COUNTRY_NIUE 683
|
||||
#define INFO_COUNTRY_NORFOLK_ISLAND 6722
|
||||
#define INFO_COUNTRY_NORWAY 47
|
||||
#define INFO_COUNTRY_OMAN 968
|
||||
#define INFO_COUNTRY_PAKISTAN 92
|
||||
#define INFO_COUNTRY_PALAU 680
|
||||
#define INFO_COUNTRY_PANAMA 507
|
||||
#define INFO_COUNTRY_PAPUA_NEW_GUINEA 675
|
||||
#define INFO_COUNTRY_PARAGUAY 595
|
||||
#define INFO_COUNTRY_PERU 51
|
||||
#define INFO_COUNTRY_PHILIPPINES 63
|
||||
#define INFO_COUNTRY_POLAND 48
|
||||
#define INFO_COUNTRY_PORTUGAL 351
|
||||
#define INFO_COUNTRY_PUERTO_RICO 121
|
||||
#define INFO_COUNTRY_QATAR 974
|
||||
#define INFO_COUNTRY_REUNION_ISLAND 262
|
||||
#define INFO_COUNTRY_ROMANIA 40
|
||||
#define INFO_COUNTRY_ROTA_ISLAND 6701
|
||||
#define INFO_COUNTRY_RUSSIA 7
|
||||
#define INFO_COUNTRY_RWANDA 250
|
||||
#define INFO_COUNTRY_SAINT_HELENA 290
|
||||
#define INFO_COUNTRY_SAINT_KITTS 115
|
||||
#define INFO_COUNTRY_SAINT_KITTS_AND_NEVIS 1141
|
||||
#define INFO_COUNTRY_SAINT_LUCIA 122
|
||||
#define INFO_COUNTRY_SAINT_PIERRE_AND_MIQUELON 508
|
||||
#define INFO_COUNTRY_SAINT_VINCENT_AND_THE_GRENADINES 116
|
||||
#define INFO_COUNTRY_SAIPAN_ISLAND 670
|
||||
#define INFO_COUNTRY_SAN_MARINO 378
|
||||
#define INFO_COUNTRY_SAO_TOME_AND_PRINCIPE 239
|
||||
#define INFO_COUNTRY_SAUDI_ARABIA 966
|
||||
#define INFO_COUNTRY_SCOTLAND 442
|
||||
#define INFO_COUNTRY_SENEGAL 221
|
||||
#define INFO_COUNTRY_SEYCHELLES 248
|
||||
#define INFO_COUNTRY_SIERRA_LEONE 232
|
||||
#define INFO_COUNTRY_SINGAPORE 65
|
||||
#define INFO_COUNTRY_SLOVAKIA 421
|
||||
#define INFO_COUNTRY_SLOVENIA 386
|
||||
#define INFO_COUNTRY_SOLOMON_ISLANDS 677
|
||||
#define INFO_COUNTRY_SOMALIA 252
|
||||
#define INFO_COUNTRY_SOUTH_AFRICA 27
|
||||
#define INFO_COUNTRY_SPAIN 34
|
||||
#define INFO_COUNTRY_SRI_LANKA 94
|
||||
#define INFO_COUNTRY_SUDAN 249
|
||||
#define INFO_COUNTRY_SURINAME 597
|
||||
#define INFO_COUNTRY_SWAZILAND 268
|
||||
#define INFO_COUNTRY_SWEDEN 46
|
||||
#define INFO_COUNTRY_SWITZERLAND 41
|
||||
#define INFO_COUNTRY_SYRIAN_ARAB_REPUBLIC 963
|
||||
#define INFO_COUNTRY_TAIWAN 886
|
||||
#define INFO_COUNTRY_TAJIKISTAN 708
|
||||
#define INFO_COUNTRY_TANZANIA 255
|
||||
#define INFO_COUNTRY_THAILAND 66
|
||||
#define INFO_COUNTRY_TINIAN_ISLAND 6702
|
||||
#define INFO_COUNTRY_TOGO 228
|
||||
#define INFO_COUNTRY_TOKELAU 690
|
||||
#define INFO_COUNTRY_TONGA 676
|
||||
#define INFO_COUNTRY_TRINIDAD_AND_TOBAGO 117
|
||||
#define INFO_COUNTRY_TUNISIA 216
|
||||
#define INFO_COUNTRY_TURKEY 90
|
||||
#define INFO_COUNTRY_TURKMENISTAN 709
|
||||
#define INFO_COUNTRY_TURKS_AND_CAICOS_ISLANDS 118
|
||||
#define INFO_COUNTRY_TUVALU 688
|
||||
#define INFO_COUNTRY_UGANDA 256
|
||||
#define INFO_COUNTRY_UKRAINE 380
|
||||
#define INFO_COUNTRY_UNITED_ARAB_EMIRATES 971
|
||||
#define INFO_COUNTRY_UNITED_KINGDOM 44
|
||||
#define INFO_COUNTRY_URUGUAY 598
|
||||
#define INFO_COUNTRY_USA 1
|
||||
#define INFO_COUNTRY_UZBEKISTAN 711
|
||||
#define INFO_COUNTRY_VANUATU 678
|
||||
#define INFO_COUNTRY_VATICAN_CITY 379
|
||||
#define INFO_COUNTRY_VENEZUELA 58
|
||||
#define INFO_COUNTRY_VIETNAM 84
|
||||
#define INFO_COUNTRY_VIRGIN_ISLANDS 123
|
||||
#define INFO_COUNTRY_WALES 441
|
||||
#define INFO_COUNTRY_WALLIS_AND_FUTUNA_ISLANDS 681
|
||||
#define INFO_COUNTRY_WESTERN_SAMOA 685
|
||||
#define INFO_COUNTRY_YEMEN 967
|
||||
#define INFO_COUNTRY_YUGOSLAVIA 381
|
||||
#define INFO_COUNTRY_YUGOSLAVIA_MONTENEGRO 382
|
||||
#define INFO_COUNTRY_YUGOSLAVIA_SERBIA 3811
|
||||
#define INFO_COUNTRY_ZAMBIA 260
|
||||
#define INFO_COUNTRY_ZIMBABWE 263
|
||||
|
||||
#define INFO_GENDER_UNKNOWN 0
|
||||
#define INFO_GENDER_FEMALE 1
|
||||
#define INFO_GENDER_MALE 2
|
||||
|
||||
#define INFO_LANG_NONE 0
|
||||
#define INFO_LANG_AFRIKAANS 55
|
||||
#define INFO_LANG_ALBANIAN 58
|
||||
#define INFO_LANG_ARABIC 1
|
||||
#define INFO_LANG_ARMENIAN 59
|
||||
#define INFO_LANG_AZERBAIJANI 68
|
||||
#define INFO_LANG_BELORUSSIAN 72
|
||||
#define INFO_LANG_BHOJPURI 2
|
||||
#define INFO_LANG_BOSNIAN 56
|
||||
#define INFO_LANG_BULGARIAN 3
|
||||
#define INFO_LANG_BURMESE 4
|
||||
#define INFO_LANG_CANTONESE 5
|
||||
#define INFO_LANG_CATALAN 6
|
||||
#define INFO_LANG_CHAMORRO 61
|
||||
#define INFO_LANG_CHINESE 7
|
||||
#define INFO_LANG_CROATIAN 8
|
||||
#define INFO_LANG_CZECH 9
|
||||
#define INFO_LANG_DANISH 10
|
||||
#define INFO_LANG_DUTCH 11
|
||||
#define INFO_LANG_ENGLISH 12
|
||||
#define INFO_LANG_ESPERANTO 13
|
||||
#define INFO_LANG_ESTONIAN 14
|
||||
#define INFO_LANG_FARCI 15
|
||||
#define INFO_LANG_FINNISH 16
|
||||
#define INFO_LANG_FRENCH 17
|
||||
#define INFO_LANG_GAELIC 18
|
||||
#define INFO_LANG_GERMAN 19
|
||||
#define INFO_LANG_GREEK 20
|
||||
#define INFO_LANG_GUJARATI 70
|
||||
#define INFO_LANG_HEBREW 21
|
||||
#define INFO_LANG_HINDI 22
|
||||
#define INFO_LANG_HUNGARIAN 23
|
||||
#define INFO_LANG_ICELANDIC 24
|
||||
#define INFO_LANG_INDONESIAN 25
|
||||
#define INFO_LANG_ITALIAN 26
|
||||
#define INFO_LANG_JAPANESE 27
|
||||
#define INFO_LANG_KHMER 28
|
||||
#define INFO_LANG_KOREAN 29
|
||||
#define INFO_LANG_KURDISH 69
|
||||
#define INFO_LANG_LAO 30
|
||||
#define INFO_LANG_LATVIAN 31
|
||||
#define INFO_LANG_LITHUANIAN 32
|
||||
#define INFO_LANG_MACEDONIAN 65
|
||||
#define INFO_LANG_MALAY 33
|
||||
#define INFO_LANG_MANDARIN 63
|
||||
#define INFO_LANG_MONGOLIAN 62
|
||||
#define INFO_LANG_NORWEGIAN 34
|
||||
#define INFO_LANG_PERSIAN 57
|
||||
#define INFO_LANG_POLISH 35
|
||||
#define INFO_LANG_PORTUGUESE 36
|
||||
#define INFO_LANG_PUNJABI 60
|
||||
#define INFO_LANG_ROMANIAN 37
|
||||
#define INFO_LANG_RUSSIAN 38
|
||||
#define INFO_LANG_SERBO_CROATIAN 39
|
||||
#define INFO_LANG_SINDHI 66
|
||||
#define INFO_LANG_SLOVAK 40
|
||||
#define INFO_LANG_SLOVENIAN 41
|
||||
#define INFO_LANG_SOMALI 42
|
||||
#define INFO_LANG_SPANISH 43
|
||||
#define INFO_LANG_SWAHILI 44
|
||||
#define INFO_LANG_SWEDISH 45
|
||||
#define INFO_LANG_TAGALOG 46
|
||||
#define INFO_LANG_TAIWANESS 64
|
||||
#define INFO_LANG_TAMIL 71
|
||||
#define INFO_LANG_TATAR 47
|
||||
#define INFO_LANG_THAI 48
|
||||
#define INFO_LANG_TURKISH 49
|
||||
#define INFO_LANG_UKRAINIAN 50
|
||||
#define INFO_LANG_URDU 51
|
||||
#define INFO_LANG_VIETNAMESE 52
|
||||
#define INFO_LANG_WELSH 67
|
||||
#define INFO_LANG_YIDDISH 53
|
||||
#define INFO_LANG_YORUBA 54
|
||||
|
||||
#define INFO_MARITAL_UNSPECIFIED 0
|
||||
#define INFO_MARITAL_SINGLE 10
|
||||
#define INFO_MARITAL_CLOSE_RELATIONSHIPS 11
|
||||
#define INFO_MARITAL_ENGAGED 12
|
||||
#define INFO_MARITAL_MARRIED 20
|
||||
#define INFO_MARITAL_DIVORCED 30
|
||||
#define INFO_MARITAL_SEPARATED 31
|
||||
#define INFO_MARITAL_WIDOWED 40
|
||||
|
||||
#define INFO_OCCUPATION_UNSPECIFIED 0
|
||||
#define INFO_OCCUPATION_ACADEMIC 1
|
||||
#define INFO_OCCUPATION_ADMINISTRATIVE 2
|
||||
#define INFO_OCCUPATION_ART_ENTERTAINMENT 3
|
||||
#define INFO_OCCUPATION_COLLEGE_STUDENT 4
|
||||
#define INFO_OCCUPATION_COMPUTERS 5
|
||||
#define INFO_OCCUPATION_COMMUNITY_SOCIAL 6
|
||||
#define INFO_OCCUPATION_EDUCATION 7
|
||||
#define INFO_OCCUPATION_ENGINEERING 8
|
||||
#define INFO_OCCUPATION_FINANCIAL_SERVICES 9
|
||||
#define INFO_OCCUPATION_GOVERNMENT 10
|
||||
#define INFO_OCCUPATION_HIGH_SCHOOL_STUDENT 11
|
||||
#define INFO_OCCUPATION_HOME 12
|
||||
#define INFO_OCCUPATION_ICQ_PROVIDING_HELP 13
|
||||
#define INFO_OCCUPATION_LAW 14
|
||||
#define INFO_OCCUPATION_MANAGERIAL 15
|
||||
#define INFO_OCCUPATION_MANUFACTURING 16
|
||||
#define INFO_OCCUPATION_MEDICAL_HEALTH 17
|
||||
#define INFO_OCCUPATION_MILITARY 18
|
||||
#define INFO_OCCUPATION_NON_GOVERNMENT_ORGANIZATION 19
|
||||
#define INFO_OCCUPATION_PROFESSIONAL 20
|
||||
#define INFO_OCCUPATION_RETAIL 21
|
||||
#define INFO_OCCUPATION_RETIRED 22
|
||||
#define INFO_OCCUPATION_SCIENCE_RESEARCH 23
|
||||
#define INFO_OCCUPATION_SPORTS 24
|
||||
#define INFO_OCCUPATION_TECHNICAL 25
|
||||
#define INFO_OCCUPATION_UNIVERSITY_STUDENT 26
|
||||
#define INFO_OCCUPATION_WEB_BUILDING 27
|
||||
#define INFO_OCCUPATION_OTHER_SERVICES 99
|
||||
|
||||
#define INFO_INTEREST_UNSPECIFIED 0
|
||||
#define INFO_INTEREST_ART 100
|
||||
#define INFO_INTEREST_CARS 101
|
||||
#define INFO_INTEREST_CELEBRITY_FANS 102
|
||||
#define INFO_INTEREST_COLLECTIONS 103
|
||||
#define INFO_INTEREST_COMPUTERS 104
|
||||
#define INFO_INTEREST_CULTURE_LITERATURE 105
|
||||
#define INFO_INTEREST_FITNESS 106
|
||||
#define INFO_INTEREST_GAMES 107
|
||||
#define INFO_INTEREST_HOBBIES 108
|
||||
#define INFO_INTEREST_ICQ_PROVIDING_HELP 109
|
||||
#define INFO_INTEREST_INTERNET 110
|
||||
#define INFO_INTEREST_LIFESTYLE 111
|
||||
#define INFO_INTEREST_MOVIES_TV 112
|
||||
#define INFO_INTEREST_MUSIC 113
|
||||
#define INFO_INTEREST_OUTDOOR_ACTIVITIES 114
|
||||
#define INFO_INTEREST_PARENTING 115
|
||||
#define INFO_INTEREST_PETS_ANIMALS 116
|
||||
#define INFO_INTEREST_RELIGION 117
|
||||
#define INFO_INTEREST_SCIENCE_TECHNOLOGY 118
|
||||
#define INFO_INTEREST_SKILLS 119
|
||||
#define INFO_INTEREST_SPORTS 120
|
||||
#define INFO_INTEREST_WEB_DESIGN 121
|
||||
#define INFO_INTEREST_NATURE_AND_ENVIRONMENT 122
|
||||
#define INFO_INTEREST_NEWS_MEDIA 123
|
||||
#define INFO_INTEREST_GOVERNMENT 124
|
||||
#define INFO_INTEREST_BUSINESS_ECONOMY 125
|
||||
#define INFO_INTEREST_MYSTICS 126
|
||||
#define INFO_INTEREST_TRAVEL 127
|
||||
#define INFO_INTEREST_ASTRONOMY 128
|
||||
#define INFO_INTEREST_SPACE 129
|
||||
#define INFO_INTEREST_CLOTHING 130
|
||||
#define INFO_INTEREST_PARTIES 131
|
||||
#define INFO_INTEREST_WOMEN 132
|
||||
#define INFO_INTEREST_SOCIAL_SCIENCE 133
|
||||
#define INFO_INTEREST_60S 134
|
||||
#define INFO_INTEREST_70S 135
|
||||
#define INFO_INTEREST_80S 136
|
||||
#define INFO_INTEREST_50S 137
|
||||
#define INFO_INTEREST_FINANCE_AND_CORPORATE 138
|
||||
#define INFO_INTEREST_ENTERTAINMENT 139
|
||||
#define INFO_INTEREST_CONSUMER_ELECTRONICS 140
|
||||
#define INFO_INTEREST_RETAIL_STORES 141
|
||||
#define INFO_INTEREST_HEALTH_AND_BEAUTY 142
|
||||
#define INFO_INTEREST_MEDIA 143
|
||||
#define INFO_INTEREST_HOUSEHOLD_PRODUCTS 144
|
||||
#define INFO_INTEREST_MAIL_ORDER_CATALOG 145
|
||||
#define INFO_INTEREST_BUSINESS_SERVICES 146
|
||||
#define INFO_INTEREST_AUDIO_AND_VISUAL 147
|
||||
#define INFO_INTEREST_SPORTING_AND_ATHLETIC 148
|
||||
#define INFO_INTEREST_PUBLISHING 149
|
||||
#define INFO_INTEREST_HOME_AUTOMATION 150
|
||||
|
||||
#define INFO_PAST_UNSPECIFIED 0
|
||||
#define INFO_PAST_ELEMENTARY_SCHOOL 300
|
||||
#define INFO_PAST_HIGH_SCHOOL 301
|
||||
#define INFO_PAST_COLLEGE 302
|
||||
#define INFO_PAST_UNIVERSITY 303
|
||||
#define INFO_PAST_MILITARY 304
|
||||
#define INFO_PAST_PAST_WORK_PLACE 305
|
||||
#define INFO_PAST_PAST_ORGANIZATION 306
|
||||
#define INFO_PAST_OTHER 399
|
||||
|
||||
#define INFO_AFFIL_UNSPECIFIED 0
|
||||
#define INFO_AFFIL_ALUMNI_ORG 200
|
||||
#define INFO_AFFIL_CHARITY_ORG 201
|
||||
#define INFO_AFFIL_CLUB_SOCIAL_ORG 202
|
||||
#define INFO_AFFIL_COMMUNITY_ORG 203
|
||||
#define INFO_AFFIL_CULTURAL_ORG 204
|
||||
#define INFO_AFFIL_FAN_CLUBS 205
|
||||
#define INFO_AFFIL_FRATERNITY_SORORITY 206
|
||||
#define INFO_AFFIL_HOBBYISTS_ORG 207
|
||||
#define INFO_AFFIL_INTERNATIONAL_ORG 208
|
||||
#define INFO_AFFIL_NATURE_AND_ENVIRONMENT_ORG 209
|
||||
#define INFO_AFFIL_PROFESSIONAL_ORG 210
|
||||
#define INFO_AFFIL_SCIENTIFIC_TECHNICAL_ORG 211
|
||||
#define INFO_AFFIL_SELF_IMPROVEMENT_GROUP 212
|
||||
#define INFO_AFFIL_SPIRITUAL_RELIGIOUS_ORG 213
|
||||
#define INFO_AFFIL_SPORTS_ORG 214
|
||||
#define INFO_AFFIL_SUPPORT_ORG 215
|
||||
#define INFO_AFFIL_TRADE_AND_BUSINESS_ORG 216
|
||||
#define INFO_AFFIL_UNION 217
|
||||
#define INFO_AFFIL_VOLUNTEER_ORG 218
|
||||
#define INFO_AFFIL_OTHER 299
|
||||
|
||||
#define PRIV_ALL_CAN_SEE (uint8_t)1
|
||||
#define PRIV_NOBODY_CAN_SEE (uint8_t)2
|
||||
#define PRIV_VISLIST_CAN_SEE (uint8_t)3
|
||||
#define PRIV_INVISLIST_CANNOT_SEE (uint8_t)4
|
||||
#define PRIV_CONTACTLIST_CAN_SEE (uint8_t)5
|
||||
|
||||
#define MSG_TYPE_PLAINTEXT (uint8_t)0x01
|
||||
#define MSG_TYPE_PLUGIN (uint8_t)0x1a
|
||||
#define MSG_TYPE_AUTOAWAY (uint8_t)0xE8
|
||||
#define MSG_TYPE_AUTOBUSY (uint8_t)0xE9
|
||||
#define MSG_TYPE_AUTONA (uint8_t)0xEA
|
||||
#define MSG_TYPE_AUTODND (uint8_t)0xEB
|
||||
#define MSG_TYPE_AUTOFFC (uint8_t)0xEC
|
||||
|
||||
#define CONN_ERR_BAD_LOGIN 0x0004
|
||||
#define CONN_ERR_BAD_PASSWORD 0x0005
|
||||
#define CONN_ERR_RATE_LIMIT 0x0018
|
||||
|
||||
#define SIGNOFF_OTHER_LOCATION 0x0001
|
||||
|
||||
#endif
|
||||
1446
main_freebsd.cpp
Normal file
1446
main_freebsd.cpp
Normal file
File diff suppressed because it is too large
Load diff
258
md5.cpp
Normal file
258
md5.cpp
Normal file
|
|
@ -0,0 +1,258 @@
|
|||
/***************************************************************************
|
||||
* Copyright (C) 2007 by Alexander S. Salieff *
|
||||
* salieff@mail.ru *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 2 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with this program; if not, write to the *
|
||||
* Free Software Foundation, Inc., *
|
||||
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
|
||||
***************************************************************************/
|
||||
|
||||
#include <string.h>
|
||||
#include "md5.h"
|
||||
|
||||
/* typedef a 32 bit type */
|
||||
typedef unsigned long int UINT4;
|
||||
|
||||
/* Data structure for MD5 (Message Digest) computation */
|
||||
typedef struct {
|
||||
UINT4 i[2]; /* number of _bits_ handled mod 2^64 */
|
||||
UINT4 buf[4]; /* scratch buffer */
|
||||
unsigned char in[64]; /* input buffer */
|
||||
unsigned char digest[16]; /* actual digest after MD5Final call */
|
||||
} MD5_CTX;
|
||||
|
||||
static unsigned char PADDING[64] = {
|
||||
0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
|
||||
};
|
||||
|
||||
/* F, G and H are basic MD5 functions: selection, majority, parity */
|
||||
#define F(x, y, z) (((x) & (y)) | ((~x) & (z)))
|
||||
#define G(x, y, z) (((x) & (z)) | ((y) & (~z)))
|
||||
#define H(x, y, z) ((x) ^ (y) ^ (z))
|
||||
#define I(x, y, z) ((y) ^ ((x) | (~z)))
|
||||
|
||||
/* ROTATE_LEFT rotates x left n bits */
|
||||
#define ROTATE_LEFT(x, n) (((x) << (n)) | ((x) >> (32-(n))))
|
||||
|
||||
/* FF, GG, HH, and II transformations for rounds 1, 2, 3, and 4 */
|
||||
/* Rotation is separate from addition to prevent recomputation */
|
||||
|
||||
#define FF(a, b, c, d, x, s, ac) {(a) += F ((b), (c), (d)) + (x) + (UINT4)(ac); (a) = ROTATE_LEFT ((a), (s)); (a) += (b); }
|
||||
#define GG(a, b, c, d, x, s, ac) {(a) += G ((b), (c), (d)) + (x) + (UINT4)(ac); (a) = ROTATE_LEFT ((a), (s)); (a) += (b); }
|
||||
#define HH(a, b, c, d, x, s, ac) {(a) += H ((b), (c), (d)) + (x) + (UINT4)(ac); (a) = ROTATE_LEFT ((a), (s)); (a) += (b); }
|
||||
#define II(a, b, c, d, x, s, ac) {(a) += I ((b), (c), (d)) + (x) + (UINT4)(ac); (a) = ROTATE_LEFT ((a), (s)); (a) += (b); }
|
||||
|
||||
|
||||
/* Basic MD5 step. Transform buf based on in.
|
||||
*/
|
||||
static void Transform (UINT4 *buf, UINT4 *in)
|
||||
{
|
||||
UINT4 a = buf[0], b = buf[1], c = buf[2], d = buf[3];
|
||||
|
||||
/* Round 1 */
|
||||
#define S11 7
|
||||
#define S12 12
|
||||
#define S13 17
|
||||
#define S14 22
|
||||
FF ( a, b, c, d, in[ 0], S11, (UINT4) 3614090360u); /* 1 */
|
||||
FF ( d, a, b, c, in[ 1], S12, (UINT4) 3905402710u); /* 2 */
|
||||
FF ( c, d, a, b, in[ 2], S13, (UINT4) 606105819u); /* 3 */
|
||||
FF ( b, c, d, a, in[ 3], S14, (UINT4) 3250441966u); /* 4 */
|
||||
FF ( a, b, c, d, in[ 4], S11, (UINT4) 4118548399u); /* 5 */
|
||||
FF ( d, a, b, c, in[ 5], S12, (UINT4) 1200080426u); /* 6 */
|
||||
FF ( c, d, a, b, in[ 6], S13, (UINT4) 2821735955u); /* 7 */
|
||||
FF ( b, c, d, a, in[ 7], S14, (UINT4) 4249261313u); /* 8 */
|
||||
FF ( a, b, c, d, in[ 8], S11, (UINT4) 1770035416u); /* 9 */
|
||||
FF ( d, a, b, c, in[ 9], S12, (UINT4) 2336552879u); /* 10 */
|
||||
FF ( c, d, a, b, in[10], S13, (UINT4) 4294925233u); /* 11 */
|
||||
FF ( b, c, d, a, in[11], S14, (UINT4) 2304563134u); /* 12 */
|
||||
FF ( a, b, c, d, in[12], S11, (UINT4) 1804603682u); /* 13 */
|
||||
FF ( d, a, b, c, in[13], S12, (UINT4) 4254626195u); /* 14 */
|
||||
FF ( c, d, a, b, in[14], S13, (UINT4) 2792965006u); /* 15 */
|
||||
FF ( b, c, d, a, in[15], S14, (UINT4) 1236535329u); /* 16 */
|
||||
|
||||
/* Round 2 */
|
||||
#define S21 5
|
||||
#define S22 9
|
||||
#define S23 14
|
||||
#define S24 20
|
||||
GG ( a, b, c, d, in[ 1], S21, (UINT4) 4129170786u); /* 17 */
|
||||
GG ( d, a, b, c, in[ 6], S22, (UINT4) 3225465664u); /* 18 */
|
||||
GG ( c, d, a, b, in[11], S23, (UINT4) 643717713u); /* 19 */
|
||||
GG ( b, c, d, a, in[ 0], S24, (UINT4) 3921069994u); /* 20 */
|
||||
GG ( a, b, c, d, in[ 5], S21, (UINT4) 3593408605u); /* 21 */
|
||||
GG ( d, a, b, c, in[10], S22, (UINT4) 38016083u); /* 22 */
|
||||
GG ( c, d, a, b, in[15], S23, (UINT4) 3634488961u); /* 23 */
|
||||
GG ( b, c, d, a, in[ 4], S24, (UINT4) 3889429448u); /* 24 */
|
||||
GG ( a, b, c, d, in[ 9], S21, (UINT4) 568446438u); /* 25 */
|
||||
GG ( d, a, b, c, in[14], S22, (UINT4) 3275163606u); /* 26 */
|
||||
GG ( c, d, a, b, in[ 3], S23, (UINT4) 4107603335u); /* 27 */
|
||||
GG ( b, c, d, a, in[ 8], S24, (UINT4) 1163531501u); /* 28 */
|
||||
GG ( a, b, c, d, in[13], S21, (UINT4) 2850285829u); /* 29 */
|
||||
GG ( d, a, b, c, in[ 2], S22, (UINT4) 4243563512u); /* 30 */
|
||||
GG ( c, d, a, b, in[ 7], S23, (UINT4) 1735328473u); /* 31 */
|
||||
GG ( b, c, d, a, in[12], S24, (UINT4) 2368359562u); /* 32 */
|
||||
|
||||
/* Round 3 */
|
||||
#define S31 4
|
||||
#define S32 11
|
||||
#define S33 16
|
||||
#define S34 23
|
||||
HH ( a, b, c, d, in[ 5], S31, (UINT4) 4294588738u); /* 33 */
|
||||
HH ( d, a, b, c, in[ 8], S32, (UINT4) 2272392833u); /* 34 */
|
||||
HH ( c, d, a, b, in[11], S33, (UINT4) 1839030562u); /* 35 */
|
||||
HH ( b, c, d, a, in[14], S34, (UINT4) 4259657740u); /* 36 */
|
||||
HH ( a, b, c, d, in[ 1], S31, (UINT4) 2763975236u); /* 37 */
|
||||
HH ( d, a, b, c, in[ 4], S32, (UINT4) 1272893353u); /* 38 */
|
||||
HH ( c, d, a, b, in[ 7], S33, (UINT4) 4139469664u); /* 39 */
|
||||
HH ( b, c, d, a, in[10], S34, (UINT4) 3200236656u); /* 40 */
|
||||
HH ( a, b, c, d, in[13], S31, (UINT4) 681279174u); /* 41 */
|
||||
HH ( d, a, b, c, in[ 0], S32, (UINT4) 3936430074u); /* 42 */
|
||||
HH ( c, d, a, b, in[ 3], S33, (UINT4) 3572445317u); /* 43 */
|
||||
HH ( b, c, d, a, in[ 6], S34, (UINT4) 76029189u); /* 44 */
|
||||
HH ( a, b, c, d, in[ 9], S31, (UINT4) 3654602809u); /* 45 */
|
||||
HH ( d, a, b, c, in[12], S32, (UINT4) 3873151461u); /* 46 */
|
||||
HH ( c, d, a, b, in[15], S33, (UINT4) 530742520u); /* 47 */
|
||||
HH ( b, c, d, a, in[ 2], S34, (UINT4) 3299628645u); /* 48 */
|
||||
|
||||
/* Round 4 */
|
||||
#define S41 6
|
||||
#define S42 10
|
||||
#define S43 15
|
||||
#define S44 21
|
||||
II ( a, b, c, d, in[ 0], S41, (UINT4) 4096336452u); /* 49 */
|
||||
II ( d, a, b, c, in[ 7], S42, (UINT4) 1126891415u); /* 50 */
|
||||
II ( c, d, a, b, in[14], S43, (UINT4) 2878612391u); /* 51 */
|
||||
II ( b, c, d, a, in[ 5], S44, (UINT4) 4237533241u); /* 52 */
|
||||
II ( a, b, c, d, in[12], S41, (UINT4) 1700485571u); /* 53 */
|
||||
II ( d, a, b, c, in[ 3], S42, (UINT4) 2399980690u); /* 54 */
|
||||
II ( c, d, a, b, in[10], S43, (UINT4) 4293915773u); /* 55 */
|
||||
II ( b, c, d, a, in[ 1], S44, (UINT4) 2240044497u); /* 56 */
|
||||
II ( a, b, c, d, in[ 8], S41, (UINT4) 1873313359u); /* 57 */
|
||||
II ( d, a, b, c, in[15], S42, (UINT4) 4264355552u); /* 58 */
|
||||
II ( c, d, a, b, in[ 6], S43, (UINT4) 2734768916u); /* 59 */
|
||||
II ( b, c, d, a, in[13], S44, (UINT4) 1309151649u); /* 60 */
|
||||
II ( a, b, c, d, in[ 4], S41, (UINT4) 4149444226u); /* 61 */
|
||||
II ( d, a, b, c, in[11], S42, (UINT4) 3174756917u); /* 62 */
|
||||
II ( c, d, a, b, in[ 2], S43, (UINT4) 718787259u); /* 63 */
|
||||
II ( b, c, d, a, in[ 9], S44, (UINT4) 3951481745u); /* 64 */
|
||||
|
||||
buf[0] += a;
|
||||
buf[1] += b;
|
||||
buf[2] += c;
|
||||
buf[3] += d;
|
||||
}
|
||||
|
||||
static void MD5Init (MD5_CTX *mdContext)
|
||||
{
|
||||
mdContext->i[0] = mdContext->i[1] = (UINT4)0;
|
||||
|
||||
/* Load magic initialization constants.
|
||||
*/
|
||||
mdContext->buf[0] = (UINT4)0x67452301;
|
||||
mdContext->buf[1] = (UINT4)0xefcdab89;
|
||||
mdContext->buf[2] = (UINT4)0x98badcfe;
|
||||
mdContext->buf[3] = (UINT4)0x10325476;
|
||||
}
|
||||
|
||||
static void MD5Update (MD5_CTX *mdContext, unsigned char *inBuf, unsigned int inLen)
|
||||
{
|
||||
UINT4 in[16];
|
||||
int mdi;
|
||||
unsigned int i, ii;
|
||||
|
||||
/* compute number of bytes mod 64 */
|
||||
mdi = (int)((mdContext->i[0] >> 3) & 0x3F);
|
||||
|
||||
/* update number of bits */
|
||||
if ((mdContext->i[0] + ((UINT4)inLen << 3)) < mdContext->i[0])
|
||||
mdContext->i[1]++;
|
||||
mdContext->i[0] += ((UINT4)inLen << 3);
|
||||
mdContext->i[1] += ((UINT4)inLen >> 29);
|
||||
|
||||
while (inLen--) {
|
||||
/* add new character to buffer, increment mdi */
|
||||
mdContext->in[mdi++] = *inBuf++;
|
||||
|
||||
/* transform if necessary */
|
||||
if (mdi == 0x40) {
|
||||
for (i = 0, ii = 0; i < 16; i++, ii += 4)
|
||||
in[i] = (((UINT4)mdContext->in[ii+3]) << 24) |
|
||||
(((UINT4)mdContext->in[ii+2]) << 16) |
|
||||
(((UINT4)mdContext->in[ii+1]) << 8) |
|
||||
((UINT4)mdContext->in[ii]);
|
||||
Transform (mdContext->buf, in);
|
||||
mdi = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void MD5Final (MD5_CTX *mdContext)
|
||||
{
|
||||
UINT4 in[16];
|
||||
int mdi;
|
||||
unsigned int i, ii;
|
||||
unsigned int padLen;
|
||||
|
||||
/* save number of bits */
|
||||
in[14] = mdContext->i[0];
|
||||
in[15] = mdContext->i[1];
|
||||
|
||||
/* compute number of bytes mod 64 */
|
||||
mdi = (int)((mdContext->i[0] >> 3) & 0x3F);
|
||||
|
||||
/* pad out to 56 mod 64 */
|
||||
padLen = (mdi < 56) ? (56 - mdi) : (120 - mdi);
|
||||
MD5Update (mdContext, PADDING, padLen);
|
||||
|
||||
/* append length in bits and transform */
|
||||
for (i = 0, ii = 0; i < 14; i++, ii += 4)
|
||||
in[i] = (((UINT4)mdContext->in[ii+3]) << 24) |
|
||||
(((UINT4)mdContext->in[ii+2]) << 16) |
|
||||
(((UINT4)mdContext->in[ii+1]) << 8) |
|
||||
((UINT4)mdContext->in[ii]);
|
||||
Transform (mdContext->buf, in);
|
||||
|
||||
/* store buffer in digest */
|
||||
for (i = 0, ii = 0; i < 4; i++, ii += 4) {
|
||||
mdContext->digest[ii] = (unsigned char)(mdContext->buf[i] & 0xFF);
|
||||
mdContext->digest[ii+1] =
|
||||
(unsigned char)((mdContext->buf[i] >> 8) & 0xFF);
|
||||
mdContext->digest[ii+2] =
|
||||
(unsigned char)((mdContext->buf[i] >> 16) & 0xFF);
|
||||
mdContext->digest[ii+3] =
|
||||
(unsigned char)((mdContext->buf[i] >> 24) & 0xFF);
|
||||
}
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
** End of md5.c **
|
||||
**********************************************************************/
|
||||
|
||||
|
||||
void calculate_md5(const char * src, unsigned int src_size, char * md5buf)
|
||||
{
|
||||
MD5_CTX mdContext;
|
||||
MD5Init(&mdContext);
|
||||
MD5Update(&mdContext, (unsigned char *)src, src_size);
|
||||
MD5Final (&mdContext);
|
||||
memcpy(md5buf, mdContext.digest, 16);
|
||||
}
|
||||
26
md5.h
Normal file
26
md5.h
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
/***************************************************************************
|
||||
* Copyright (C) 2007 by Alexander S. Salieff *
|
||||
* salieff@mail.ru *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 2 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with this program; if not, write to the *
|
||||
* Free Software Foundation, Inc., *
|
||||
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef _ICQKID2_MD5_H_
|
||||
#define _ICQKID2_MD5_H_
|
||||
|
||||
void calculate_md5(const char * src, unsigned int src_size, char * md5buf);
|
||||
|
||||
#endif /* _MD5_H_ */
|
||||
1
revision.h
Normal file
1
revision.h
Normal file
|
|
@ -0,0 +1 @@
|
|||
#define __SVN_REVISION__ ""
|
||||
52
snaccache.cpp
Normal file
52
snaccache.cpp
Normal file
|
|
@ -0,0 +1,52 @@
|
|||
/***************************************************************************
|
||||
* Copyright (C) 2007 by Alexander S. Salieff *
|
||||
* salieff@mail.ru *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 2 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with this program; if not, write to the *
|
||||
* Free Software Foundation, Inc., *
|
||||
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
|
||||
***************************************************************************/
|
||||
|
||||
#include "snaccache.h"
|
||||
|
||||
void SnacCache::addEntry(SNACData & snd)
|
||||
{
|
||||
cache.push_back(pair<SNACData, time_t>(snd, time(NULL)));
|
||||
}
|
||||
|
||||
bool SnacCache::findEntry(SNACData & snd)
|
||||
{
|
||||
for (size_t i=0; i<cache.size(); ++i)
|
||||
{
|
||||
if ((cache[i].first.service_id==snd.service_id || snd.service_id==0) && \
|
||||
(cache[i].first.subtype_id==snd.subtype_id || snd.subtype_id==0) && \
|
||||
(cache[i].first.req_id==snd.req_id || snd.req_id==0))
|
||||
{
|
||||
snd=cache[i].first;
|
||||
cache.erase(cache.begin()+i);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void SnacCache::clearOlderThan(time_t tmdelta)
|
||||
{
|
||||
for (size_t i=0; i<cache.size(); /* empty */)
|
||||
{
|
||||
if ((time(NULL)-cache[i].second)>=tmdelta) cache.erase(cache.begin()+i);
|
||||
else ++i;
|
||||
}
|
||||
}
|
||||
40
snaccache.h
Normal file
40
snaccache.h
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
/***************************************************************************
|
||||
* Copyright (C) 2007 by Alexander S. Salieff *
|
||||
* salieff@mail.ru *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 2 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with this program; if not, write to the *
|
||||
* Free Software Foundation, Inc., *
|
||||
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef _SNAC_CACHE_H_
|
||||
#define _SNAC_CACHE_H_
|
||||
|
||||
#include "flap.h"
|
||||
#include <time.h>
|
||||
#include <vector>
|
||||
|
||||
using namespace std;
|
||||
|
||||
class SnacCache {
|
||||
public:
|
||||
void addEntry(SNACData & snd);
|
||||
bool findEntry(SNACData & snd);
|
||||
void clearOlderThan(time_t tmdelta);
|
||||
|
||||
private:
|
||||
vector<pair<SNACData, time_t> > cache;
|
||||
};
|
||||
|
||||
#endif
|
||||
1
stat_template.txt
Normal file
1
stat_template.txt
Normal file
|
|
@ -0,0 +1 @@
|
|||
Now clients: %d items.
|
||||
40
statgen.cpp
Normal file
40
statgen.cpp
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <memory.h>
|
||||
#include <errno.h>
|
||||
#include <string.h>
|
||||
#include "statgen.h"
|
||||
|
||||
extern unsigned short ClientsCount;
|
||||
extern char *StatOutput_Path;
|
||||
|
||||
void UpdateStatPage()
|
||||
{
|
||||
if(!StatOutput_Path)return;
|
||||
|
||||
FILE *html = fopen("stat_template.txt","r");
|
||||
if(!html)
|
||||
{
|
||||
printf("\nCannot open template, exiting...\n");
|
||||
return;
|
||||
}
|
||||
fseek(html,0,SEEK_END);
|
||||
int fs = ftell(html);
|
||||
fseek(html,0,SEEK_SET);
|
||||
char *htm_unparsed = (char*) malloc(fs+1);
|
||||
memset(htm_unparsed, 0, fs+1);
|
||||
fread(htm_unparsed, fs, 1, html);
|
||||
fclose(html);
|
||||
int bc;
|
||||
char *htm_parsed = (char*) malloc(bc = fs+1+16);
|
||||
memset(htm_parsed, 0, bc);
|
||||
sprintf(htm_parsed, htm_unparsed, ClientsCount);
|
||||
//printf(htm_parsed);
|
||||
int parsed_len = strlen(htm_parsed);
|
||||
|
||||
FILE *html_out = fopen(StatOutput_Path, "w");
|
||||
fwrite(htm_parsed, parsed_len, 1, html_out);
|
||||
fclose(html_out);
|
||||
free(htm_parsed);
|
||||
free(htm_unparsed);
|
||||
}
|
||||
6
statgen.h
Normal file
6
statgen.h
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
#ifndef _STATGEN_H_
|
||||
#define _STATGEN_H_
|
||||
|
||||
void UpdateStatPage();
|
||||
|
||||
#endif
|
||||
Loading…
Add table
Reference in a new issue