summaryrefslogtreecommitdiff
path: root/miranda-wine/protocols/Yahoo
diff options
context:
space:
mode:
authorwatcherhd <watcherhd@e753b5eb-9565-29b2-b5c5-2cc6f99dfbcb>2011-04-21 14:14:52 +0000
committerwatcherhd <watcherhd@e753b5eb-9565-29b2-b5c5-2cc6f99dfbcb>2011-04-21 14:14:52 +0000
commitcb4a46e7fbe62d788e66ed6121c717a2d22a4d7c (patch)
tree30df260fdc5a1b5a7049c2f8cac8b7ef17513d6d /miranda-wine/protocols/Yahoo
parent19b6f534d2e784a1e120bf52c4aa07004798f473 (diff)
svn.miranda.im is moving to a new home!
git-svn-id: http://miranda-plugins.googlecode.com/svn/trunk@7 e753b5eb-9565-29b2-b5c5-2cc6f99dfbcb
Diffstat (limited to 'miranda-wine/protocols/Yahoo')
-rw-r--r--miranda-wine/protocols/Yahoo/Yahoo.rc124
-rw-r--r--miranda-wine/protocols/Yahoo/avatar.c1142
-rw-r--r--miranda-wine/protocols/Yahoo/avatar.h66
-rw-r--r--miranda-wine/protocols/Yahoo/chat.c77
-rw-r--r--miranda-wine/protocols/Yahoo/chat.h42
-rw-r--r--miranda-wine/protocols/Yahoo/file_transfer.c613
-rw-r--r--miranda-wine/protocols/Yahoo/file_transfer.h48
-rw-r--r--miranda-wine/protocols/Yahoo/http_gateway.c88
-rw-r--r--miranda-wine/protocols/Yahoo/http_gateway.h24
-rw-r--r--miranda-wine/protocols/Yahoo/icos/address_book.icobin0 -> 2550 bytes
-rw-r--r--miranda-wine/protocols/Yahoo/icos/calendar.icobin0 -> 2550 bytes
-rw-r--r--miranda-wine/protocols/Yahoo/icos/inbox.icobin0 -> 1406 bytes
-rw-r--r--miranda-wine/protocols/Yahoo/icos/invite.icobin0 -> 2550 bytes
-rw-r--r--miranda-wine/protocols/Yahoo/icos/profile.icobin0 -> 2550 bytes
-rw-r--r--miranda-wine/protocols/Yahoo/icos/refresh.icobin0 -> 1406 bytes
-rw-r--r--miranda-wine/protocols/Yahoo/icos/set_status.icobin0 -> 2550 bytes
-rw-r--r--miranda-wine/protocols/Yahoo/icos/yahoo.icobin0 -> 2550 bytes
-rw-r--r--miranda-wine/protocols/Yahoo/im.c333
-rw-r--r--miranda-wine/protocols/Yahoo/im.h23
-rw-r--r--miranda-wine/protocols/Yahoo/libyahoo2/config.h35
-rw-r--r--miranda-wine/protocols/Yahoo/libyahoo2/crypt.c207
-rw-r--r--miranda-wine/protocols/Yahoo/libyahoo2/libyahoo2.c6319
-rw-r--r--miranda-wine/protocols/Yahoo/libyahoo2/md5.c408
-rw-r--r--miranda-wine/protocols/Yahoo/libyahoo2/md5.h93
-rw-r--r--miranda-wine/protocols/Yahoo/libyahoo2/sha.c161
-rw-r--r--miranda-wine/protocols/Yahoo/libyahoo2/sha.h49
-rw-r--r--miranda-wine/protocols/Yahoo/libyahoo2/yahoo2.h216
-rw-r--r--miranda-wine/protocols/Yahoo/libyahoo2/yahoo2_callbacks.h790
-rw-r--r--miranda-wine/protocols/Yahoo/libyahoo2/yahoo2_types.h261
-rw-r--r--miranda-wine/protocols/Yahoo/libyahoo2/yahoo_debug.h55
-rw-r--r--miranda-wine/protocols/Yahoo/libyahoo2/yahoo_fn.c4622
-rw-r--r--miranda-wine/protocols/Yahoo/libyahoo2/yahoo_fn.h33
-rw-r--r--miranda-wine/protocols/Yahoo/libyahoo2/yahoo_httplib.c451
-rw-r--r--miranda-wine/protocols/Yahoo/libyahoo2/yahoo_httplib.h48
-rw-r--r--miranda-wine/protocols/Yahoo/libyahoo2/yahoo_list.c236
-rw-r--r--miranda-wine/protocols/Yahoo/libyahoo2/yahoo_list.h74
-rw-r--r--miranda-wine/protocols/Yahoo/libyahoo2/yahoo_util.c161
-rw-r--r--miranda-wine/protocols/Yahoo/libyahoo2/yahoo_util.h104
-rw-r--r--miranda-wine/protocols/Yahoo/main.c302
-rw-r--r--miranda-wine/protocols/Yahoo/options.c256
-rw-r--r--miranda-wine/protocols/Yahoo/options.h20
-rw-r--r--miranda-wine/protocols/Yahoo/pthread.c75
-rw-r--r--miranda-wine/protocols/Yahoo/pthread.h26
-rw-r--r--miranda-wine/protocols/Yahoo/resource.h70
-rw-r--r--miranda-wine/protocols/Yahoo/search.c121
-rw-r--r--miranda-wine/protocols/Yahoo/search.h19
-rw-r--r--miranda-wine/protocols/Yahoo/server.c221
-rw-r--r--miranda-wine/protocols/Yahoo/services.c1134
-rw-r--r--miranda-wine/protocols/Yahoo/util.c386
-rw-r--r--miranda-wine/protocols/Yahoo/version.h3
-rw-r--r--miranda-wine/protocols/Yahoo/version.rc36
-rw-r--r--miranda-wine/protocols/Yahoo/webcam.c64
-rw-r--r--miranda-wine/protocols/Yahoo/webcam.h31
-rw-r--r--miranda-wine/protocols/Yahoo/yahoo.c1463
-rw-r--r--miranda-wine/protocols/Yahoo/yahoo.h208
55 files changed, 21338 insertions, 0 deletions
diff --git a/miranda-wine/protocols/Yahoo/Yahoo.rc b/miranda-wine/protocols/Yahoo/Yahoo.rc
new file mode 100644
index 0000000..4e4551d
--- /dev/null
+++ b/miranda-wine/protocols/Yahoo/Yahoo.rc
@@ -0,0 +1,124 @@
+/*
+ * $Id: Yahoo.rc 3465 2006-08-06 01:26:35Z gena01 $
+ *
+ * myYahoo Miranda Plugin
+ *
+ * Authors: Gennady Feldman (aka Gena01)
+ * Laurent Marechal (aka Peorth)
+ *
+ * This code is under GPL and is based on AIM, MSN and Miranda source code.
+ * I want to thank Robert Rainwater and George Hazan for their code and support
+ * and for answering some of my questions during development of this plugin.
+ */
+#include <winresrc.h>
+
+#include "resource.h"
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Dialog
+//
+
+IDD_OPT_YAHOO DIALOGEX 0, 0, 296, 220
+STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | WS_VISIBLE
+EXSTYLE WS_EX_CONTROLPARENT
+FONT 8, "MS Shell Dlg", 0, 0, 0x1
+BEGIN
+ // Yahoo Login Information [Top Box]
+ GROUPBOX "Yahoo",IDC_STYAHOOGROUP,8,10,280,72,WS_GROUP
+ RTEXT "ID:",IDC_STATIC,16,20,52,8
+ EDITTEXT IDC_HANDLE,72,18,100,12,ES_AUTOHSCROLL
+ RTEXT "Password:",IDC_STATIC,16,36,52,8
+ EDITTEXT IDC_PASSWORD,72,34,100,12,ES_PASSWORD | ES_AUTOHSCROLL
+ RTEXT "Nick:",IDC_STATIC,16,52,52,8
+ EDITTEXT IDC_NICK,72,50,100,12,ES_AUTOHSCROLL
+ CONTROL "Create a new Yahoo account using the Yahoo website",
+ IDC_NEWYAHOOACCOUNTLINK,"Hyperlink",WS_TABSTOP,21,66,208,8
+
+ // Expert Section [Server/Port/etc]
+ GROUPBOX "Expert",IDC_STATIC,8,84,150,136, WS_GROUP
+
+ LTEXT "Login server:",IDC_STATIC,16,98,52,10
+ EDITTEXT IDC_LOGINSERVER,68,90,80,12,ES_AUTOHSCROLL
+ LTEXT "Port:",IDC_STATIC,16,112,25,10
+ EDITTEXT IDC_YAHOOPORT,68,110,29,12,ES_AUTOHSCROLL | ES_NUMBER
+ PUSHBUTTON "Reset",IDC_RESETSERVER,100,110,34,12
+
+ CONTROL "Yahoo Japan",IDC_YAHOO_JAPAN,"Button",
+ BS_AUTOCHECKBOX | WS_TABSTOP,16,128,140,10
+
+
+ CONTROL "Disable main menu (needs restart)",IDC_DISMAINMENU,"Button",
+ BS_AUTOCHECKBOX | WS_TABSTOP,16,148,140,10
+
+ CONTROL "Use Yahoo Address Book (YAB)",IDC_USE_YAB,"Button",
+ BS_AUTOCHECKBOX | WS_TABSTOP,16,158,140,10
+
+ CONTROL "Show Avatars",IDC_SHOW_AVATARS,"Button",
+ BS_AUTOCHECKBOX | WS_TABSTOP,16,168,120,10
+
+ CONTROL "AutoLogin to Yahoo ",IDC_MAIL_AUTOLOGIN,"Button",
+ BS_AUTOCHECKBOX | WS_TABSTOP,16,178,120,10
+
+ CONTROL "Display Yahoo notifications", IDC_DISABLEYAHOOMAIL,"Button",
+ BS_AUTOCHECKBOX | WS_TABSTOP,16,188,120,10
+
+ CONTROL "Show Errors",IDC_SHOW_ERRORS,"Button",
+ BS_AUTOCHECKBOX | WS_TABSTOP,16,198,120,10
+
+ GROUPBOX "Yahoo Ignore List",IDC_STIGNGROUP,158,84,130,136,WS_GROUP
+
+ EDITTEXT IDC_YIGN_EDIT,164,98,84,13,ES_AUTOHSCROLL
+ PUSHBUTTON "&Add",IDC_IGN_ADD,250,98,34,12
+
+ LISTBOX IDC_YIGN_LIST,164,114,84,103, LBS_NOTIFY | LBS_HASSTRINGS | LBS_SORT | WS_BORDER | WS_VSCROLL
+
+ PUSHBUTTON "&Remove", IDC_IGN_REMOVE, 250,204,34,12
+
+END
+
+IDD_SETCUSTSTAT DIALOGEX 0, 0, 187, 51
+STYLE DS_SETFONT | DS_FIXEDSYS | DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU
+CAPTION "Set Custom Status"
+FONT 8, "MS Shell Dlg", 0, 0, 0x1
+BEGIN
+ EDITTEXT IDC_CUSTSTAT,5,5,177,12,ES_AUTOHSCROLL
+ CONTROL "Show as busy",
+ IDC_CUSTSTATBUSY,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,
+ 5,21,120,10
+ DEFPUSHBUTTON "OK",IDOK,36,34,50,14
+ PUSHBUTTON "Cancel",IDCANCEL,102,34,50,14
+END
+
+IDD_INFO_AVATAR DIALOGEX 0, 0, 222, 131
+STYLE DS_3DLOOK | DS_FIXEDSYS | WS_CHILD
+EXSTYLE WS_EX_CONTROLPARENT
+FONT 8, "MS Shell Dlg", 0, 0, 0x1
+BEGIN
+ CONTROL "",IDC_AVATAR,"Static",SS_BITMAP | SS_CENTERIMAGE |
+ SS_SUNKEN,9,11,96,96
+ PUSHBUTTON "Set",IDC_SETAVATAR,9,112,45,13,WS_VISIBLE
+ PUSHBUTTON "Delete",IDC_DELETEAVATAR,61,112,45,13,WS_VISIBLE
+
+ CONTROL "Share Avatar",IDC_SHARE_AVATAR,"Button",
+ BS_AUTOCHECKBOX | WS_TABSTOP,16,130,120,10
+END
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Icon
+//
+
+// Icon with lowest ID value placed first to ensure application icon
+// remains consistent on all systems.
+IDI_MAIN ICON "icos\\yahoo.ico"
+IDI_YAHOO ICON "icos\\yahoo.ico"
+IDI_INBOX ICON "icos\\inbox.ico"
+IDI_PROFILE ICON "icos\\profile.ico"
+IDI_REFRESH ICON "icos\\refresh.ico"
+IDI_YAB ICON "icos\\address_book.ico"
+IDI_SET_STATUS ICON "icos\\set_status.ico"
+IDI_CALENDAR ICON "icos\\calendar.ico"
+
+#include "version.rc"
+
diff --git a/miranda-wine/protocols/Yahoo/avatar.c b/miranda-wine/protocols/Yahoo/avatar.c
new file mode 100644
index 0000000..2fc4588
--- /dev/null
+++ b/miranda-wine/protocols/Yahoo/avatar.c
@@ -0,0 +1,1142 @@
+/*
+ * $Id: avatar.c 3676 2006-09-01 18:02:28Z gena01 $
+ *
+ * myYahoo Miranda Plugin
+ *
+ * Authors: Gennady Feldman (aka Gena01)
+ * Laurent Marechal (aka Peorth)
+ *
+ * This code is under GPL and is based on AIM, MSN and Miranda source code.
+ * I want to thank Robert Rainwater and George Hazan for their code and support
+ * and for answering some of my questions during development of this plugin.
+ */
+#include <time.h>
+#include <malloc.h>
+#include <sys/stat.h>
+#include <io.h>
+
+#include "yahoo.h"
+#include "resource.h"
+
+#include <m_langpack.h>
+#include <m_options.h>
+#include <m_userinfo.h>
+#include <m_png.h>
+
+#include "avatar.h"
+#include "file_transfer.h"
+
+static BOOL CALLBACK AvatarDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam);
+
+extern yahoo_local_account *ylad;
+
+int OnDetailsInit(WPARAM wParam, LPARAM lParam)
+{
+ char* szProto;
+ OPTIONSDIALOGPAGE odp;
+ char szAvtCaption[MAX_PATH+8];
+
+ szProto = (char*)CallService(MS_PROTO_GETCONTACTBASEPROTO, lParam, 0);
+ if ((lstrcmp(szProto, yahooProtocolName)) && lParam)
+ return 0;
+
+ if ((lParam == 0) && YAHOO_GetByte( "ShowAvatars", 0 ))
+ {
+ // Avatar page only for valid contacts
+ odp.cbSize = sizeof(odp);
+ odp.hIcon = NULL;
+ odp.hInstance = hinstance;
+ odp.pfnDlgProc = AvatarDlgProc;
+ odp.position = -1899999997;
+ odp.pszTemplate = MAKEINTRESOURCE(IDD_INFO_AVATAR);
+ snprintf(szAvtCaption, sizeof(szAvtCaption), "%s %s", Translate(yahooProtocolName), Translate("Avatar"));
+ odp.pszTitle = szAvtCaption;
+
+ CallService(MS_USERINFO_ADDPAGE, wParam, (LPARAM)&odp);
+ }
+
+ return 0;
+}
+
+static char* ChooseAvatarFileName()
+{
+ char* szDest = (char*)malloc(MAX_PATH+0x10);
+ char str[MAX_PATH];
+ char szFilter[512];
+ OPENFILENAME ofn = {0};
+ str[0] = 0;
+ szDest[0]='\0';
+ CallService(MS_UTILS_GETBITMAPFILTERSTRINGS,sizeof(szFilter),(LPARAM)szFilter);
+ ofn.lStructSize = sizeof(OPENFILENAME);
+ ofn.lpstrFilter = szFilter;
+ //ofn.lpstrFilter = "PNG Bitmaps (*.png)\0*.png\0";
+ ofn.lpstrFile = szDest;
+ ofn.Flags = OFN_FILEMUSTEXIST | OFN_HIDEREADONLY;
+ ofn.nMaxFile = MAX_PATH;
+ ofn.nMaxFileTitle = MAX_PATH;
+ ofn.lpstrDefExt = "png";
+ if (!GetOpenFileName(&ofn)){
+ free(szDest);
+ return NULL;
+ }
+
+ return szDest;
+}
+
+/*
+ *31 bit hash function - this is based on g_string_hash function from glib
+ */
+int YAHOO_avt_hash(const char *key, long ksize)
+{
+ const char *p = key;
+ int h = *p;
+ long l = 0;
+
+ if (h)
+ for (p += 1; l < ksize; p++, l++)
+ h = (h << 5) - h + *p;
+
+ return h;
+}
+
+int calcMD5Hash(char* szFile)
+{
+ if (szFile) {
+ HANDLE hFile = NULL, hMap = NULL;
+ BYTE* ppMap = NULL;
+ long cbFileSize = 0;
+ int ck = 0;
+
+ if ((hFile = CreateFile(szFile, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, NULL )) != INVALID_HANDLE_VALUE)
+ if ((hMap = CreateFileMapping(hFile, NULL, PAGE_READONLY, 0, 0, NULL)) != NULL)
+ if ((ppMap = (BYTE*)MapViewOfFile(hMap, FILE_MAP_READ, 0, 0, 0)) != NULL)
+ cbFileSize = GetFileSize( hFile, NULL );
+
+ if (cbFileSize != 0){
+ ck = YAHOO_avt_hash((char *)ppMap, cbFileSize);
+ }
+
+ if (ppMap != NULL) UnmapViewOfFile(ppMap);
+ if (hMap != NULL) CloseHandle(hMap);
+ if (hFile != NULL) CloseHandle(hFile);
+
+ if (ck) return ck;
+ }
+
+ return 0;
+}
+
+void upload_avt(int id, int fd, int error, void *data);
+
+/**************** Send Avatar ********************/
+
+HBITMAP YAHOO_SetAvatar(const char *szFile)
+{
+ char szMyFile[MAX_PATH+1];
+ HBITMAP avt;
+
+ avt = (HBITMAP)CallService(MS_UTILS_LOADBITMAP, 0, (WPARAM)szFile);
+
+ if (avt == NULL)
+ return NULL;
+
+ if (( avt = YAHOO_StretchBitmap( avt )) == NULL )
+ return NULL;
+
+ GetAvatarFileName(NULL, szMyFile, MAX_PATH, 2);
+
+ if (avt && YAHOO_SaveBitmapAsAvatar( avt, szMyFile) == 0) {
+ unsigned int hash;
+
+ hash = calcMD5Hash(szMyFile);
+ if (hash) {
+ LOG(("[YAHOO_SetAvatar] File: '%s' CK: %d", szMyFile, hash));
+
+ /* now check and make sure we don't reupload same thing over again */
+ if (hash != YAHOO_GetDword("AvatarHash", 0)) {
+ YAHOO_SetString(NULL, "AvatarFile", szMyFile);
+ DBWriteContactSettingDword(NULL, yahooProtocolName, "TMPAvatarHash", hash);
+
+ YAHOO_SendAvatar(szMyFile);
+ } else {
+ LOG(("[YAHOO_SetAvatar] Same checksum and avatar on YahooFT. Not Reuploading."));
+ }
+ }
+ }
+
+ return avt;
+}
+
+static BOOL CALLBACK AvatarDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
+{
+ switch (msg)
+ {
+ case WM_INITDIALOG:
+ //MessageBox(NULL, "HALLO AVATARS!!", "AA", MB_OK);
+ TranslateDialogDefault(hwndDlg);
+ {
+ DBVARIANT dbv;
+ char szAvatar[MAX_PATH];
+
+ ShowWindow(GetDlgItem(hwndDlg, -1), SW_SHOW);
+ if (!yahooLoggedIn){
+ EnableWindow(GetDlgItem(hwndDlg, IDC_SETAVATAR), FALSE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_DELETEAVATAR), FALSE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_SHARE_AVATAR), FALSE);
+ }
+
+ SetButtonCheck( hwndDlg, IDC_SHARE_AVATAR, YAHOO_GetByte( "ShareAvatar", 0 ) == 2 );
+
+ if (!DBGetContactSetting(NULL, yahooProtocolName, "AvatarFile", &dbv)) {
+ HBITMAP avt;
+
+ lstrcpy(szAvatar, dbv.pszVal);
+ DBFreeVariant(&dbv);
+
+ avt = (HBITMAP)CallService(MS_UTILS_LOADBITMAP, 0, (WPARAM)szAvatar);
+ if (avt) {
+ avt = (HBITMAP)SendDlgItemMessage(hwndDlg, IDC_AVATAR, STM_SETIMAGE, IMAGE_BITMAP, (LPARAM)avt);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_SHARE_AVATAR), TRUE);
+ if (avt) DeleteObject(avt); // we release old avatar if any
+ }
+ } else {
+ EnableWindow(GetDlgItem(hwndDlg, IDC_DELETEAVATAR), FALSE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_SHARE_AVATAR), FALSE);
+ }
+ }
+ return TRUE;
+
+ case WM_COMMAND:
+ switch(LOWORD(wParam))
+ {
+ case IDC_SETAVATAR:
+ {
+ char* szFile;
+ HBITMAP avt;
+
+ if ((szFile = ChooseAvatarFileName()) != NULL) {
+ avt = YAHOO_SetAvatar(szFile);
+
+ free(szFile);
+
+ if (avt){
+ avt = (HBITMAP)SendDlgItemMessage(hwndDlg, IDC_AVATAR, STM_SETIMAGE, IMAGE_BITMAP, (LPARAM)avt);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_DELETEAVATAR), TRUE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_SHARE_AVATAR), TRUE);
+ }
+ if (avt) DeleteObject(avt); // we release old avatar if any
+ }
+
+ }
+ break;
+ case IDC_DELETEAVATAR:
+ {
+ HBITMAP avt;
+
+ YAHOO_DebugLog("[Deleting Avatar Info]");
+
+ avt = (HBITMAP)SendDlgItemMessage(hwndDlg, IDC_AVATAR, STM_SETIMAGE, IMAGE_BITMAP, (LPARAM)NULL);
+ if (avt) DeleteObject(avt); // we release old avatar if any
+
+ /* remove ALL our Avatar Info Keys */
+ DBDeleteContactSetting(NULL, yahooProtocolName, "AvatarFile");
+ DBDeleteContactSetting(NULL, yahooProtocolName, "AvatarHash");
+ DBDeleteContactSetting(NULL, yahooProtocolName, "AvatarURL");
+ DBDeleteContactSetting(NULL, yahooProtocolName, "AvatarTS");
+
+ /* Send a Yahoo packet saying we don't got an avatar anymore */
+ YAHOO_set_avatar(0);
+
+ /* clear the avatar window */
+ InvalidateRect( hwndDlg, NULL, TRUE );
+
+ YAHOO_SetByte("ShareAvatar",0);
+ SetButtonCheck(hwndDlg, IDC_SHARE_AVATAR, 0);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_DELETEAVATAR), FALSE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_SHARE_AVATAR), FALSE);
+ }
+ break;
+ case IDC_SHARE_AVATAR:
+ YAHOO_SetByte("ShareAvatar",IsDlgButtonChecked(hwndDlg, IDC_SHARE_AVATAR) ? 2 : 0);
+ /* Send a Yahoo packet saying we don't got an avatar anymore */
+ YAHOO_set_avatar(YAHOO_GetByte( "ShareAvatar", 0 )? 2 : 0);
+ }
+ break;
+ }
+
+ return FALSE;
+}
+
+/*
+ * YAHOO_StretchBitmap (copied from MSN, Thanks George)
+ */
+HBITMAP YAHOO_StretchBitmap( HBITMAP hBitmap )
+{
+ BITMAPINFO bmStretch;
+ BITMAP bmp;
+ UINT* ptPixels;
+ HDC hDC, hBmpDC;
+ HBITMAP hOldBitmap1, hOldBitmap2, hStretchedBitmap;
+ int side, dx, dy;
+
+ ZeroMemory(&bmStretch, sizeof(bmStretch));
+ bmStretch.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
+ bmStretch.bmiHeader.biWidth = 96;
+ bmStretch.bmiHeader.biHeight = 96;
+ bmStretch.bmiHeader.biPlanes = 1;
+ bmStretch.bmiHeader.biBitCount = 32;
+
+ hStretchedBitmap = CreateDIBSection( NULL, &bmStretch, DIB_RGB_COLORS, ( void* )&ptPixels, NULL, 0);
+ if ( hStretchedBitmap == NULL ) {
+ YAHOO_DebugLog( "Bitmap creation failed with error %ld", GetLastError() );
+ return NULL;
+ }
+
+ hDC = CreateCompatibleDC( NULL );
+ hOldBitmap1 = ( HBITMAP )SelectObject( hDC, hBitmap );
+ GetObject( hBitmap, sizeof( BITMAP ), &bmp );
+
+ hBmpDC = CreateCompatibleDC( hDC );
+ hOldBitmap2 = ( HBITMAP )SelectObject( hBmpDC, hStretchedBitmap );
+
+ if ( bmp.bmWidth > bmp.bmHeight ) {
+ side = bmp.bmHeight;
+ dx = ( bmp.bmWidth - bmp.bmHeight )/2;
+ dy = 0;
+ }
+ else {
+ side = bmp.bmWidth;
+ dx = 0;
+ dy = ( bmp.bmHeight - bmp.bmWidth )/2;
+ }
+
+ SetStretchBltMode( hBmpDC, HALFTONE );
+ StretchBlt( hBmpDC, 0, 0, 96, 96, hDC, dx, dy, side, side, SRCCOPY );
+
+ SelectObject( hDC, hOldBitmap1 );
+ DeleteObject( hBitmap );
+ DeleteDC( hDC );
+
+ SelectObject( hBmpDC, hOldBitmap2 );
+ DeleteDC( hBmpDC );
+ return hStretchedBitmap;
+}
+
+/*
+ * YAHOO_SaveBitmapAsAvatar - updates the avatar database settings and file from a bitmap
+ */
+int YAHOO_SaveBitmapAsAvatar( HBITMAP hBitmap, const char* szFileName )
+{
+ BITMAPINFO* bmi;
+ HDC hdc;
+ HBITMAP hOldBitmap;
+ BITMAPINFOHEADER* pDib;
+ BYTE* pDibBits;
+ long dwPngSize = 0;
+ DIB2PNG convertor;
+
+ if ( !ServiceExists(MS_DIB2PNG)) {
+ MessageBox( NULL, Translate( "Your png2dib.dll is either obsolete or damaged. " ),
+ Translate( "Error" ), MB_OK | MB_ICONSTOP );
+ return 1;
+ }
+
+ hdc = CreateCompatibleDC( NULL );
+ hOldBitmap = ( HBITMAP )SelectObject( hdc, hBitmap );
+
+ bmi = ( BITMAPINFO* )_alloca( sizeof( BITMAPINFO ) + sizeof( RGBQUAD )*256 );
+ memset( bmi, 0, sizeof (BITMAPINFO ));
+ bmi->bmiHeader.biSize = 0x28;
+ if ( GetDIBits( hdc, hBitmap, 0, 96, NULL, bmi, DIB_RGB_COLORS ) == 0 ) {
+ return 2;
+ }
+
+ pDib = ( BITMAPINFOHEADER* )GlobalAlloc( LPTR, sizeof( BITMAPINFO ) + sizeof( RGBQUAD )*256 + bmi->bmiHeader.biSizeImage );
+ if ( pDib == NULL )
+ return 3;
+
+ memcpy( pDib, bmi, sizeof( BITMAPINFO ) + sizeof( RGBQUAD )*256 );
+ pDibBits = (( BYTE* )pDib ) + sizeof( BITMAPINFO ) + sizeof( RGBQUAD )*256;
+
+ GetDIBits( hdc, hBitmap, 0, pDib->biHeight, pDibBits, ( BITMAPINFO* )pDib, DIB_RGB_COLORS );
+ SelectObject( hdc, hOldBitmap );
+ DeleteDC( hdc );
+
+ convertor.pbmi = ( BITMAPINFO* )pDib;
+ convertor.pDiData = pDibBits;
+ convertor.pResult = NULL;
+ convertor.pResultLen = &dwPngSize;
+ if ( !CallService( MS_DIB2PNG, 0, (LPARAM)&convertor )) {
+ GlobalFree( pDib );
+ return 2;
+ }
+
+ convertor.pResult = (char *)malloc(dwPngSize);
+ CallService( MS_DIB2PNG, 0, (LPARAM)&convertor );
+
+ GlobalFree( pDib );
+ {
+ FILE* out;
+
+ out = fopen( szFileName, "wb" );
+ if ( out != NULL ) {
+ fwrite( convertor.pResult, dwPngSize, 1, out );
+ fclose( out );
+ }
+ }
+ free(convertor.pResult);
+
+ return ERROR_SUCCESS;
+}
+
+void upload_avt(int id, int fd, int error, void *data)
+{
+ y_filetransfer *sf = (y_filetransfer*) data;
+ long size = 0;
+ char buf[1024];
+ int rw; /* */
+ DWORD dw; /* needed for ReadFile */
+ HANDLE myhFile;
+
+ if (fd < 1 || error) {
+ LOG(("[get_fd] Connect Failed!"));
+ return;
+ }
+
+ myhFile = CreateFile(sf->filename,
+ GENERIC_READ,
+ FILE_SHARE_READ|FILE_SHARE_WRITE,
+ NULL,
+ OPEN_EXISTING,
+ FILE_ATTRIBUTE_NORMAL | FILE_FLAG_SEQUENTIAL_SCAN,
+ 0);
+
+ if (myhFile == INVALID_HANDLE_VALUE) {
+ LOG(("[get_fd] Can't open file for reading?!"));
+ return;
+ }
+
+ LOG(("Sending file: %s size: %ld", sf->filename, sf->fsize));
+
+ do {
+ rw = ReadFile(myhFile, buf, sizeof(buf), &dw, NULL);
+
+ if (rw != 0) {
+ rw = Netlib_Send((HANDLE)fd, buf, dw, MSG_NODUMP);
+
+ if (rw < 1) {
+ LOG(("Upload Failed. Send error?"));
+ break;
+ }
+
+ size += rw;
+ }
+ } while (rw >= 0 && size < sf->fsize);
+
+ CloseHandle(myhFile);
+
+ do {
+ rw = Netlib_Recv((HANDLE)fd, buf, sizeof(buf), 0);
+ LOG(("Got: %d bytes", rw));
+ } while (rw > 0);
+
+ LOG(("File send complete!"));
+}
+
+void __cdecl yahoo_send_avt_thread(void *psf)
+{
+ y_filetransfer *sf = psf;
+
+ if (sf == NULL) {
+ YAHOO_DebugLog("[yahoo_send_avt_thread] SF IS NULL!!!");
+ return;
+ }
+
+ YAHOO_SetByte("AvatarUL", 1);
+ yahoo_send_avatar(ylad->id, sf->filename, sf->fsize, &upload_avt, sf);
+
+ free(sf->filename);
+ free(sf);
+ if (YAHOO_GetByte("AvatarUL", 1) == 1) YAHOO_SetByte("AvatarUL", 0);
+}
+
+void YAHOO_SendAvatar(const char *szFile)
+{
+ y_filetransfer *sf;
+ struct _stat statbuf;
+
+ if ( _stat( szFile, &statbuf ) != 0 ) {
+ LOG(("[YAHOO_SendAvatar] Error reading File information?!"));
+ return;
+ }
+
+ sf = (y_filetransfer*) malloc(sizeof(y_filetransfer));
+ sf->filename = strdup(szFile);
+ sf->cancel = 0;
+ sf->fsize = statbuf.st_size;
+
+ YAHOO_DebugLog("[Uploading avatar] filename: %s size: %ld", sf->filename, sf->fsize);
+
+ pthread_create(yahoo_send_avt_thread, sf);
+}
+
+struct avatar_info{
+ char *who;
+ char *pic_url;
+ int cksum;
+};
+
+static void __cdecl yahoo_recv_avatarthread(void *pavt)
+{
+ PROTO_AVATAR_INFORMATION AI;
+ struct avatar_info *avt = pavt;
+ int error = 0;
+ HANDLE hContact = 0;
+ char buf[4096];
+
+ if (avt == NULL) {
+ YAHOO_DebugLog("AVT IS NULL!!!");
+ return;
+ }
+
+ if (!yahooLoggedIn) {
+ YAHOO_DebugLog("We are not logged in!!!");
+ return;
+ }
+
+// ProtoBroadcastAck(yahooProtocolName, hContact, ACKTYPE_GETINFO, ACKRESULT_SUCCESS, (HANDLE) 1, 0);
+
+ LOG(("yahoo_recv_avatarthread who:%s url:%s checksum: %d", avt->who, avt->pic_url, avt->cksum));
+
+ hContact = getbuddyH(avt->who);
+
+ if (!hContact){
+ LOG(("ERROR: Can't find buddy: %s", avt->who));
+ error = 1;
+ } else if (!error) {
+ DBWriteContactSettingDword(hContact, yahooProtocolName, "PictCK", avt->cksum);
+ DBWriteContactSettingDword(hContact, yahooProtocolName, "PictLoading", 1);
+ }
+
+ if(!error) {
+
+ NETLIBHTTPREQUEST nlhr={0},*nlhrReply;
+
+ nlhr.cbSize = sizeof(nlhr);
+ nlhr.requestType= REQUEST_GET;
+ nlhr.flags = NLHRF_NODUMP|NLHRF_GENERATEHOST|NLHRF_SMARTAUTHHEADER;
+ nlhr.szUrl = avt->pic_url;
+
+ nlhrReply=(NETLIBHTTPREQUEST*)CallService(MS_NETLIB_HTTPTRANSACTION,(WPARAM)hNetlibUser,(LPARAM)&nlhr);
+
+ if(nlhrReply) {
+
+ if (nlhrReply->resultCode != 200) {
+ LOG(("Update server returned '%d' instead of 200. It also sent the following: %s", nlhrReply->resultCode, nlhrReply->szResultDescr));
+ // make sure it's a real problem and not a problem w/ our connection
+ yahoo_send_picture_info(ylad->id, avt->who, 3, avt->pic_url, avt->cksum);
+ error = 1;
+ } else if (nlhrReply->dataLength < 1 || nlhrReply->pData == NULL) {
+ LOG(("No data??? Got %d bytes.", nlhrReply->dataLength));
+ error = 1;
+ } else {
+ HANDLE myhFile;
+
+ GetAvatarFileName(hContact, buf, 1024, DBGetContactSettingByte(hContact, yahooProtocolName,"AvatarType", 0));
+ DeleteFile(buf);
+
+ LOG(("Saving file: %s size: %u", buf, nlhrReply->dataLength));
+ myhFile = CreateFile(buf,
+ GENERIC_WRITE,
+ FILE_SHARE_WRITE,
+ NULL, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, 0);
+
+ if(myhFile !=INVALID_HANDLE_VALUE) {
+ DWORD c;
+
+ WriteFile(myhFile, nlhrReply->pData, nlhrReply->dataLength, &c, NULL );
+ CloseHandle(myhFile);
+
+ DBWriteContactSettingString(hContact, "ContactPhoto", "File", buf);
+ DBWriteContactSettingDword(hContact, yahooProtocolName, "PictLastCheck", 0);
+ } else {
+ LOG(("Can not open file for writing: %s", buf));
+ error = 1;
+ }
+ }
+ CallService(MS_NETLIB_FREEHTTPREQUESTSTRUCT,0,(LPARAM)nlhrReply);
+ }
+ }
+
+ if (DBGetContactSettingDword(hContact, yahooProtocolName, "PictCK", 0) != avt->cksum) {
+ LOG(("WARNING: Checksum updated during download?!"));
+ error = 1; /* don't use this one? */
+ }
+
+ DBWriteContactSettingDword(hContact, yahooProtocolName, "PictLoading", 0);
+ LOG(("File download complete!?"));
+
+ if (error)
+ buf[0]='\0';
+
+ free(avt->who);
+ free(avt->pic_url);
+ free(avt);
+
+ AI.cbSize = sizeof AI;
+ AI.format = PA_FORMAT_PNG;
+ AI.hContact = hContact;
+ lstrcpy(AI.filename,buf);
+
+ if (error)
+ DBWriteContactSettingDword(hContact, yahooProtocolName, "PictCK", 0);
+
+ ProtoBroadcastAck(yahooProtocolName, hContact, ACKTYPE_AVATAR, !error ? ACKRESULT_SUCCESS:ACKRESULT_FAILED,(HANDLE) &AI, 0);
+
+}
+
+void YAHOO_get_avatar(const char *who, const char *pic_url, long cksum)
+{
+ struct avatar_info *avt;
+
+ avt = malloc(sizeof(struct avatar_info));
+ avt->who = _strdup(who);
+ avt->pic_url = _strdup(pic_url);
+ avt->cksum = cksum;
+
+ pthread_create(yahoo_recv_avatarthread, (void *) avt);
+}
+
+void ext_yahoo_got_picture(int id, const char *me, const char *who, const char *pic_url, int cksum, int type)
+{
+ HANDLE hContact = 0;
+
+ LOG(("[ext_yahoo_got_picture] for %s with url %s (checksum: %d) type: %d", who, pic_url, cksum, type));
+
+
+ /*
+ Type:
+
+ 1 - Send Avatar Info
+ 2 - Got Avatar Info
+ 3 - YIM6 didn't like my avatar? Expired? We need to invalidate and re-load
+ */
+ switch (type) {
+ case 1:
+ {
+ int cksum=0;
+ DBVARIANT dbv;
+
+ /* need to send avatar info */
+ if (!YAHOO_GetByte( "ShowAvatars", 0 )) {
+ LOG(("[ext_yahoo_got_picture] We are not using/showing avatars!"));
+ yahoo_send_picture_update(id, who, 0); // no avatar (disabled)
+ return;
+ }
+
+ LOG(("[ext_yahoo_got_picture] Getting ready to send info!"));
+ /* need to read CheckSum */
+ cksum = YAHOO_GetDword("AvatarHash", 0);
+ if (cksum) {
+ if (!DBGetContactSetting(NULL, yahooProtocolName, "AvatarURL", &dbv)) {
+ LOG(("[ext_yahoo_got_picture] Sending url: %s checksum: %d to '%s'!", dbv.pszVal, cksum, who));
+ //void yahoo_send_picture_info(int id, const char *me, const char *who, const char *pic_url, int cksum)
+ yahoo_send_picture_info(id, who, 2, dbv.pszVal, cksum);
+ DBFreeVariant(&dbv);
+ } else if (YAHOO_GetByte("AvatarUL", 0) != 1){
+ // NO avatar URL??
+ if (!DBGetContactSetting(NULL, yahooProtocolName, "AvatarFile", &dbv)) {
+ DBWriteContactSettingString(NULL, yahooProtocolName, "AvatarInv", who);
+ YAHOO_SendAvatar(dbv.pszVal);
+ DBFreeVariant(&dbv);
+ } else {
+ LOG(("[ext_yahoo_got_picture] No Local Avatar File??? "));
+ }
+ } else
+ LOG(("[ext_yahoo_got_picture] Another avatar upload in progress?"));
+ }
+ }
+ break;
+ case 2: /*
+ * We got Avatar Info for our buddy.
+ */
+ if (!YAHOO_GetByte( "ShowAvatars", 0 )) {
+ LOG(("[ext_yahoo_got_picture] We are not using/showing avatars!"));
+ return;
+ }
+
+ /* got avatar info, so set miranda up */
+ hContact = getbuddyH(who);
+
+ if (!hContact) {
+ LOG(("[ext_yahoo_got_picture] Buddy not on my buddy list?."));
+ return;
+ }
+
+ if (!cksum || cksum == -1) {
+ LOG(("[ext_yahoo_got_picture] Resetting avatar."));
+ DBWriteContactSettingDword(hContact, yahooProtocolName, "PictCK", 0);
+
+ yahoo_reset_avatar(hContact);
+ } else {
+ char z[1024];
+
+ if (pic_url == NULL) {
+ LOG(("[ext_yahoo_got_picture] WARNING: Empty URL for avatar?"));
+ return;
+ }
+
+ GetAvatarFileName(hContact, z, 1024, DBGetContactSettingByte(hContact, yahooProtocolName,"AvatarType", 0));
+
+ if (DBGetContactSettingDword(hContact, yahooProtocolName,"PictCK", 0) != cksum || _access( z, 0 ) != 0 ) {
+
+ YAHOO_DebugLog("[ext_yahoo_got_picture] Checksums don't match or avatar file is missing. Current: %d, New: %d",(int)DBGetContactSettingDword(hContact, yahooProtocolName,"PictCK", 0), cksum);
+
+ YAHOO_get_avatar(who, pic_url, cksum);
+ }
+ }
+
+ break;
+ case 3:
+ /*
+ * Our Avatar is not good anymore? Need to re-upload??
+ */
+ /* who, pic_url, cksum */
+ {
+ int mcksum=0;
+ DBVARIANT dbv;
+
+ /* need to send avatar info */
+ if (!YAHOO_GetByte( "ShowAvatars", 0 )) {
+ LOG(("[ext_yahoo_got_picture] We are not using/showing avatars!"));
+ yahoo_send_picture_update(id, who, 0); // no avatar (disabled)
+ return;
+ }
+
+ LOG(("[ext_yahoo_got_picture] Getting ready to send info!"));
+ /* need to read CheckSum */
+ mcksum = YAHOO_GetDword("AvatarHash", 0);
+ if (mcksum == 0) {
+ /* this should NEVER Happen??? */
+ LOG(("[ext_yahoo_got_picture] No personal checksum? and Invalidate?!"));
+ yahoo_send_picture_update(id, who, 0); // no avatar (disabled)
+ return;
+ }
+
+ LOG(("[ext_yahoo_got_picture] My Checksum: %d", mcksum));
+
+ if (!DBGetContactSetting(NULL, yahooProtocolName, "AvatarURL", &dbv)){
+ if (mcksum == cksum && lstrcmpi(pic_url, dbv.pszVal) == 0) {
+ DBVARIANT dbv2;
+
+ LOG(("[ext_yahoo_got_picture] Buddy: %s told us this is bad??Expired??. Re-uploading", who));
+ DBDeleteContactSetting(NULL, yahooProtocolName, "AvatarURL");
+
+
+ if (!DBGetContactSetting(NULL, yahooProtocolName, "AvatarFile", &dbv2)) {
+ DBWriteContactSettingString(NULL, yahooProtocolName, "AvatarInv", who);
+ YAHOO_SendAvatar(dbv2.pszVal);
+ DBFreeVariant(&dbv2);
+ } else {
+ LOG(("[ext_yahoo_got_picture] No Local Avatar File??? "));
+ }
+ } else {
+ LOG(("[ext_yahoo_got_picture] URLs or checksums don't match? Tell them the right thing!!!"));
+ yahoo_send_picture_info(id, who, 2, dbv.pszVal, mcksum);
+ }
+ // don't leak stuff
+ DBFreeVariant(&dbv);
+ } else {
+ LOG(("[ext_yahoo_got_picture] no AvatarURL?"));
+ }
+ }
+ break;
+ default:
+ LOG(("[ext_yahoo_got_picture] Unknown request/packet type exiting!"));
+ }
+
+ LOG(("ext_yahoo_got_picture exiting"));
+}
+
+void ext_yahoo_got_picture_checksum(int id, const char *me, const char *who, int cksum)
+{
+ HANDLE hContact = 0;
+
+ LOG(("ext_yahoo_got_picture_checksum for %s checksum: %d", who, cksum));
+
+ hContact = getbuddyH(who);
+ if (hContact == NULL) {
+ LOG(("Buddy Not Found. Skipping avatar update"));
+ return;
+ }
+
+ /* Last thing check the checksum and request new one if we need to */
+ if (!cksum || cksum == -1) {
+ DBWriteContactSettingDword(hContact, yahooProtocolName, "PictCK", 0);
+
+ yahoo_reset_avatar(hContact);
+ } else {
+ if (DBGetContactSettingDword(hContact, yahooProtocolName,"PictCK", 0) != cksum) {
+ char szFile[MAX_PATH];
+
+ // Now save the new checksum. No rush requesting new avatar yet.
+ DBWriteContactSettingDword(hContact, yahooProtocolName, "PictCK", cksum);
+
+ // Need to delete the Avatar File!!
+ GetAvatarFileName(hContact, szFile, sizeof szFile, 0);
+ DeleteFile(szFile);
+
+ // Reset the avatar and cleanup.
+ yahoo_reset_avatar(hContact);
+ }
+ }
+
+}
+
+void ext_yahoo_got_picture_update(int id, const char *me, const char *who, int buddy_icon)
+{
+ HANDLE hContact = 0;
+
+ LOG(("ext_yahoo_got_picture_update for %s buddy_icon: %d", who, buddy_icon));
+
+ hContact = getbuddyH(who);
+ if (hContact == NULL) {
+ LOG(("Buddy Not Found. Skipping avatar update"));
+ return;
+ }
+
+ DBWriteContactSettingByte(hContact, yahooProtocolName, "AvatarType", buddy_icon);
+
+ /* Last thing check the checksum and request new one if we need to */
+ yahoo_reset_avatar(hContact);
+}
+
+void ext_yahoo_got_avatar_update(int id, const char *me, const char *who, int buddy_icon)
+{
+ HANDLE hContact = 0;
+
+ LOG(("ext_yahoo_got_avatar_update for %s buddy_icon: %d", who, buddy_icon));
+
+ hContact = getbuddyH(who);
+ if (hContact == NULL) {
+ LOG(("Buddy Not Found. Skipping avatar update"));
+ return;
+ }
+
+ DBWriteContactSettingByte(hContact, yahooProtocolName, "AvatarType", buddy_icon);
+
+ /* Last thing check the checksum and request new one if we need to */
+ yahoo_reset_avatar(hContact);
+}
+
+void yahoo_reset_avatar(HANDLE hContact)
+{
+ LOG(("[YAHOO_RESET_AVATAR]"));
+
+ // STUPID SCRIVER Doesn't listen to ACKTYPE_AVATAR. so remove the file reference!
+ //DBDeleteContactSetting(hContact, "ContactPhoto", "File");
+
+ ProtoBroadcastAck(yahooProtocolName, hContact, ACKTYPE_AVATAR, ACKRESULT_STATUS, NULL, 0);
+}
+
+void YAHOO_request_avatar(const char* who)
+{
+ time_t last_chk, cur_time;
+ HANDLE hContact = 0;
+ char szFile[MAX_PATH];
+
+ if (!YAHOO_GetByte( "ShowAvatars", 0 )) {
+ LOG(("Avatars disabled, but available for: %s", who));
+ return;
+ }
+
+ hContact = getbuddyH(who);
+
+ if (!hContact)
+ return;
+
+
+ GetAvatarFileName(hContact, szFile, sizeof szFile, DBGetContactSettingByte(hContact, yahooProtocolName,"AvatarType", 0));
+ DeleteFile(szFile);
+
+ time(&cur_time);
+ last_chk = DBGetContactSettingDword(hContact, yahooProtocolName, "PictLastCheck", 0);
+
+ /*
+ * time() - in seconds ( 60*60 = 1 hour)
+ */
+ if (DBGetContactSettingDword(hContact, yahooProtocolName,"PictCK", 0) == 0 ||
+ last_chk == 0 || (cur_time - last_chk) > 60) {
+
+ DBWriteContactSettingDword(hContact, yahooProtocolName, "PictLastCheck", cur_time);
+
+ LOG(("Requesting Avatar for: %s", who));
+ yahoo_request_buddy_avatar(ylad->id, who);
+ } else {
+ LOG(("Avatar Not Available for: %s Last Check: %ld Current: %ld (Flood Check in Effect)", who, last_chk, cur_time));
+ }
+}
+
+void YAHOO_bcast_picture_update(int buddy_icon)
+{
+ HANDLE hContact;
+ char *szProto;
+
+ /* need to get online buddies and then send then picture_update packets (ARGH YAHOO!)*/
+ for ( hContact = ( HANDLE )YAHOO_CallService( MS_DB_CONTACT_FINDFIRST, 0, 0 );
+ hContact != NULL;
+ hContact = ( HANDLE )YAHOO_CallService( MS_DB_CONTACT_FINDNEXT, ( WPARAM )hContact, 0 ))
+ {
+ szProto = ( char* )YAHOO_CallService( MS_PROTO_GETCONTACTBASEPROTO, ( WPARAM )hContact, 0 );
+ if ( szProto != NULL && !lstrcmp( szProto, yahooProtocolName ))
+ {
+ if (YAHOO_GetWord(hContact, "Status", ID_STATUS_OFFLINE)!=ID_STATUS_OFFLINE) {
+ DBVARIANT dbv;
+
+ if ( DBGetContactSetting( hContact, yahooProtocolName, YAHOO_LOGINID, &dbv ))
+ continue;
+
+ yahoo_send_picture_update(ylad->id, dbv.pszVal, buddy_icon);
+ DBFreeVariant( &dbv );
+ }
+ }
+ }
+}
+
+void YAHOO_set_avatar(int buddy_icon)
+{
+ yahoo_send_avatar_update(ylad->id,buddy_icon);
+
+ YAHOO_bcast_picture_update(buddy_icon);
+}
+
+void YAHOO_bcast_picture_checksum(int cksum)
+{
+ HANDLE hContact;
+ char *szProto;
+
+ yahoo_send_picture_checksum(ylad->id, NULL, cksum);
+
+ /* need to get online buddies and then send then picture_update packets (ARGH YAHOO!)*/
+ for ( hContact = ( HANDLE )YAHOO_CallService( MS_DB_CONTACT_FINDFIRST, 0, 0 );
+ hContact != NULL;
+ hContact = ( HANDLE )YAHOO_CallService( MS_DB_CONTACT_FINDNEXT, ( WPARAM )hContact, 0 ))
+ {
+ szProto = ( char* )YAHOO_CallService( MS_PROTO_GETCONTACTBASEPROTO, ( WPARAM )hContact, 0 );
+ if ( szProto != NULL && !lstrcmp( szProto, yahooProtocolName ))
+ {
+ if (YAHOO_GetWord(hContact, "Status", ID_STATUS_OFFLINE)!=ID_STATUS_OFFLINE) {
+ DBVARIANT dbv;
+
+ if ( DBGetContactSetting( hContact, yahooProtocolName, YAHOO_LOGINID, &dbv ))
+ continue;
+
+ yahoo_send_picture_checksum(ylad->id, dbv.pszVal, cksum);
+ DBFreeVariant( &dbv );
+ }
+ }
+ }
+}
+
+void GetAvatarFileName(HANDLE hContact, char* pszDest, int cbLen, int type)
+{
+ int tPathLen;
+ DBVARIANT dbv;
+
+ CallService(MS_DB_GETPROFILEPATH, cbLen, (LPARAM)pszDest);
+
+ tPathLen = lstrlen(pszDest);
+ _snprintf(pszDest + tPathLen, MAX_PATH-tPathLen, "\\%s\\", yahooProtocolName);
+ CreateDirectory(pszDest, NULL);
+
+ if (hContact != NULL && !DBGetContactSetting(hContact, yahooProtocolName, YAHOO_LOGINID, &dbv)) {
+ lstrcat(pszDest, dbv.pszVal);
+ DBFreeVariant(&dbv);
+ }else {
+ lstrcat(pszDest, "avatar");
+ }
+
+ if (type == 1) {
+ lstrcat(pszDest, ".swf" );
+ } else
+ lstrcat(pszDest, ".png" );
+
+}
+
+int YahooGetAvatarInfo(WPARAM wParam,LPARAM lParam)
+{
+ PROTO_AVATAR_INFORMATION* AI = ( PROTO_AVATAR_INFORMATION* )lParam;
+
+ DBVARIANT dbv;
+ int avtType;
+
+ if (!DBGetContactSetting(AI->hContact, yahooProtocolName, YAHOO_LOGINID, &dbv)) {
+ YAHOO_DebugLog("[YAHOO_GETAVATARINFO] For: %s", dbv.pszVal);
+ DBFreeVariant(&dbv);
+ }else {
+ YAHOO_DebugLog("[YAHOO_GETAVATARINFO]");
+ }
+
+ if (!YAHOO_GetByte( "ShowAvatars", 0 ) || !yahooLoggedIn) {
+ YAHOO_DebugLog("[YAHOO_GETAVATARINFO] %s", yahooLoggedIn ? "We are not using/showing avatars!" : "We are not logged in. Can't load avatars now!");
+
+ /*if (DBGetContactSettingDword(AI->hContact, yahooProtocolName,"PictCK", 0) != 0) {
+ YAHOO_DebugLog("[YAHOO_GETAVATARINFO] Removing avatar information!");
+
+ DBWriteContactSettingDword(AI->hContact, yahooProtocolName, "PictCK", 0);
+ DBWriteContactSettingDword(AI->hContact, yahooProtocolName, "PictLastCheck", 0);
+ DBWriteContactSettingDword(AI->hContact, yahooProtocolName, "PictLoading", 0);
+ //GetAvatarFileName(AI->hContact, AI->filename, sizeof AI->filename);
+ //DeleteFile(AI->filename);
+ }*/
+
+ return GAIR_NOAVATAR;
+ }
+
+ avtType = DBGetContactSettingByte(AI->hContact, yahooProtocolName,"AvatarType", 0);
+ YAHOO_DebugLog("[YAHOO_GETAVATARINFO] Avatar Type: %d", avtType);
+
+ if ( avtType != 2) {
+ if (avtType != 0)
+ YAHOO_DebugLog("[YAHOO_GETAVATARINFO] Not handling this type yet!");
+
+ return GAIR_NOAVATAR;
+ }
+
+ if (DBGetContactSettingDword(AI->hContact, yahooProtocolName,"PictCK", 0) != 0) {
+
+ GetAvatarFileName(AI->hContact, AI->filename, sizeof AI->filename,DBGetContactSettingByte(AI->hContact, yahooProtocolName,"AvatarType", 0));
+ //if ( access( AI->filename, 0 ) == 0 ) {
+ AI->format = PA_FORMAT_PNG;
+ YAHOO_DebugLog("[YAHOO_GETAVATARINFO] filename: %s", AI->filename);
+
+ if (_access( AI->filename, 0 ) == 0 ) {
+ return GAIR_SUCCESS;
+ } else {
+ /* need to request it again? */
+ if (YAHOO_GetWord(AI->hContact, "PictLoading", 0) != 0 &&
+ (time(NULL) - YAHOO_GetWord(AI->hContact, "PictLastCK", 0) < 500)) {
+ YAHOO_DebugLog("[YAHOO_GETAVATARINFO] Waiting for avatar to load!");
+ return GAIR_WAITFOR;
+ } else if ( yahooLoggedIn ) {
+ DBVARIANT dbv;
+
+ if (!DBGetContactSetting(AI->hContact, yahooProtocolName, YAHOO_LOGINID, &dbv)) {
+ YAHOO_DebugLog("[YAHOO_GETAVATARINFO] Requesting avatar!");
+
+ YAHOO_request_avatar(dbv.pszVal/*who */);
+ DBFreeVariant(&dbv);
+ return GAIR_WAITFOR;
+ } else {
+ YAHOO_DebugLog("[YAHOO_GETAVATARINFO] Can't retrieve user id?!");
+ }
+ }
+ }
+ }
+
+ YAHOO_DebugLog("[YAHOO_GETAVATARINFO] NO AVATAR???");
+ return GAIR_NOAVATAR;
+}
+
+/*
+ * --=[ AVS / LoadAvatars API/Services ]=--
+ */
+
+/*
+Optional. Will pass PNG or BMP if this is not found
+wParam = 0
+lParam = PA_FORMAT_* // avatar format
+return = 1 (supported) or 0 (not supported)
+*/
+int YahooAvatarFormatSupported(WPARAM wParam, LPARAM lParam)
+{
+ YAHOO_DebugLog("[YahooAvatarFormatSupported]");
+
+ if (lParam == PA_FORMAT_PNG)
+ return 1;
+ else
+ return 0;
+}
+
+/*
+Service: /GetMyAvatarMaxSize
+wParam=(int *)max width of avatar
+lParam=(int *)max height of avatar
+return=0
+*/
+int YahooGetAvatarSize(WPARAM wParam, LPARAM lParam)
+{
+ YAHOO_DebugLog("[YahooGetAvatarSize]");
+
+ if (wParam != 0) *((int*) wParam) = 96;
+ if (lParam != 0) *((int*) lParam) = 96;
+
+ return 0;
+}
+
+/*
+Service: /GetMyAvatar
+wParam=(char *)Buffer to file name
+lParam=(int)Buffer size
+return=0 on success, else on error
+*/
+int YahooGetMyAvatar(WPARAM wParam, LPARAM lParam)
+{
+ char *buffer = (char *)wParam;
+ int size = (int)lParam;
+
+ YAHOO_DebugLog("[YahooGetMyAvatar]");
+
+ if (buffer == NULL || size <= 0)
+ return -1;
+
+
+ if (!YAHOO_GetByte( "ShowAvatars", 0 ))
+ return -2;
+
+ {
+ DBVARIANT dbv;
+ int ret = -3;
+
+ if (YAHOO_GetDword("AvatarHash", 0)){
+
+ if (!DBGetContactSetting(NULL, yahooProtocolName, "AvatarFile", &dbv)){
+ if (access(dbv.pszVal, 0) == 0){
+ strncpy(buffer, dbv.pszVal, size-1);
+ buffer[size-1] = '\0';
+
+ ret = 0;
+ }
+ DBFreeVariant(&dbv);
+ }
+ }
+
+ return ret;
+ }
+}
+
+/*
+#define PS_SETMYAVATAR "/SetMyAvatar"
+wParam=0
+lParam=(const char *)Avatar file name
+return=0 for sucess
+*/
+
+int YahooSetMyAvatar(WPARAM wParam, LPARAM lParam)
+{
+ char *szFile = (char *)lParam;
+ HANDLE avt;
+
+ YAHOO_DebugLog("[YahooSetMyAvatar]");
+
+ avt = YAHOO_SetAvatar(szFile);
+ if (avt) {
+ DeleteObject(avt); // we release old avatar if any
+ return 0;
+ } else
+ return 1; /* error for now */
+}
+
+/*
+ * --=[ ]=--
+ */
diff --git a/miranda-wine/protocols/Yahoo/avatar.h b/miranda-wine/protocols/Yahoo/avatar.h
new file mode 100644
index 0000000..04a3ab4
--- /dev/null
+++ b/miranda-wine/protocols/Yahoo/avatar.h
@@ -0,0 +1,66 @@
+/*
+ * $Id: avatar.h 3646 2006-08-29 20:38:45Z gena01 $
+ *
+ * myYahoo Miranda Plugin
+ *
+ * Authors: Gennady Feldman (aka Gena01)
+ * Laurent Marechal (aka Peorth)
+ *
+ * This code is under GPL and is based on AIM, MSN and Miranda source code.
+ * I want to thank Robert Rainwater and George Hazan for their code and support
+ * and for answering some of my questions during development of this plugin.
+ */
+#ifndef _YAHOO_AVATAR_H_
+#define _YAHOO_AVATAR_H_
+
+void YAHOO_request_avatar(const char* who);
+void GetAvatarFileName(HANDLE hContact, char* pszDest, int cbLen, int type);
+
+void YAHOO_SendAvatar(const char *szFile);
+
+void YAHOO_set_avatar(int buddy_icon);
+
+void YAHOO_bcast_picture_update(int buddy_icon);
+
+void YAHOO_bcast_picture_checksum(int cksum);
+
+int YAHOO_SaveBitmapAsAvatar( HBITMAP hBitmap, const char* szFileName );
+
+HBITMAP YAHOO_StretchBitmap( HBITMAP hBitmap );
+
+void yahoo_reset_avatar(HANDLE hContact);
+
+HBITMAP YAHOO_SetAvatar(const char *szFile);
+
+void YAHOO_get_avatar(const char *who, const char *pic_url, long cksum);
+
+/**
+ * AVS Services - loadavatars.dll uses these to get the info from us
+ */
+#define PS_ISAVATARFORMATSUPPORTED "/IsAvatarFormatSupported"
+#define PS_GETMYAVATARMAXSIZE "/GetMyAvatarMaxSize"
+#define PS_SETMYAVATAR "/SetMyAvatar"
+#define PS_GETMYAVATAR "/GetMyAvatar"
+
+int YahooGetAvatarInfo(WPARAM wParam,LPARAM lParam);
+
+int YahooAvatarFormatSupported(WPARAM wParam, LPARAM lParam);
+
+int YahooGetAvatarSize(WPARAM wParam, LPARAM lParam);
+
+int YahooGetMyAvatar(WPARAM wParam, LPARAM lParam);
+
+int YahooSetMyAvatar(WPARAM wParam, LPARAM lParam);
+
+/**
+ * Callbacks for libyahoo2
+ */
+void ext_yahoo_got_picture(int id, const char *me, const char *who, const char *pic_url, int cksum, int type);
+
+void ext_yahoo_got_picture_checksum(int id, const char *me, const char *who, int cksum);
+
+void ext_yahoo_got_picture_update(int id, const char *me, const char *who, int buddy_icon);
+
+void ext_yahoo_got_avatar_update(int id, const char *me, const char *who, int buddy_icon);
+
+#endif
diff --git a/miranda-wine/protocols/Yahoo/chat.c b/miranda-wine/protocols/Yahoo/chat.c
new file mode 100644
index 0000000..3263218
--- /dev/null
+++ b/miranda-wine/protocols/Yahoo/chat.c
@@ -0,0 +1,77 @@
+/*
+ * $Id: chat.c 3659 2006-08-30 19:43:41Z gena01 $
+ *
+ * myYahoo Miranda Plugin
+ *
+ * Authors: Gennady Feldman (aka Gena01)
+ * Laurent Marechal (aka Peorth)
+ *
+ * This code is under GPL and is based on AIM, MSN and Miranda source code.
+ * I want to thank Robert Rainwater and George Hazan for their code and support
+ * and for answering some of my questions during development of this plugin.
+ */
+#include "yahoo.h"
+#include <m_protosvc.h>
+#include <m_langpack.h>
+#include <m_message.h>
+
+extern yahoo_local_account * ylad;
+
+void ext_yahoo_got_im(int id, const char *me, const char *who, const char *msg, long tm, int stat, int utf8, int buddy_icon);
+
+/* Conference handlers */
+void ext_yahoo_got_conf_invite(int id, const char *me, const char *who, const char *room, const char *msg, YList *members)
+{
+ char z[1024];
+
+ _snprintf(z, sizeof(z), Translate("[miranda] Got conference invite to room: %s with msg: %s"), room ?room:"", msg ?msg:"");
+ LOG(("[ext_yahoo_got_conf_invite] %s", z));
+ ext_yahoo_got_im(id, "me", who, z, 0, 0, 1, -1);
+
+ yahoo_conference_decline(ylad->id, NULL, members, room, Translate("I am sorry, but i can't join your conference since this feature is not currently implemented in my client."));
+}
+
+void ext_yahoo_conf_userdecline(int id, const char *me, const char *who, const char *room, const char *msg)
+{
+}
+
+void ext_yahoo_conf_userjoin(int id, const char *me, const char *who, const char *room)
+{
+}
+
+void ext_yahoo_conf_userleave(int id, const char *me, const char *who, const char *room)
+{
+}
+
+void ext_yahoo_conf_message(int id, const char *me, const char *who, const char *room, const char *msg, int utf8)
+{
+}
+
+/* chat handlers */
+void ext_yahoo_chat_cat_xml(int id, const char *xml)
+{
+}
+
+void ext_yahoo_chat_join(int id, const char *me, const char *room, const char * topic, YList *members, int fd)
+{
+}
+
+void ext_yahoo_chat_userjoin(int id, const char *me, const char *room, struct yahoo_chat_member *who)
+{
+}
+
+void ext_yahoo_chat_userleave(int id, const char *me, const char *room, const char *who)
+{
+}
+void ext_yahoo_chat_message(int id, const char *me, const char *who, const char *room, const char *msg, int msgtype, int utf8)
+{
+}
+
+void ext_yahoo_chat_yahoologout(int id, const char *me)
+{
+ LOG(("got chat logout"));
+}
+void ext_yahoo_chat_yahooerror(int id, const char *me)
+{
+ LOG(("got chat error"));
+}
diff --git a/miranda-wine/protocols/Yahoo/chat.h b/miranda-wine/protocols/Yahoo/chat.h
new file mode 100644
index 0000000..33927ec
--- /dev/null
+++ b/miranda-wine/protocols/Yahoo/chat.h
@@ -0,0 +1,42 @@
+/*
+ * $Id: chat.h 3627 2006-08-28 16:11:15Z gena01 $
+ *
+ * myYahoo Miranda Plugin
+ *
+ * Authors: Gennady Feldman (aka Gena01)
+ * Laurent Marechal (aka Peorth)
+ *
+ * This code is under GPL and is based on AIM, MSN and Miranda source code.
+ * I want to thank Robert Rainwater and George Hazan for their code and support
+ * and for answering some of my questions during development of this plugin.
+ */
+#ifndef _YAHOO_CHAT_H_
+#define _YAHOO_CHAT_H_
+
+/* Conference handlers */
+void ext_yahoo_got_conf_invite(int id, const char *me, const char *who, const char *room, const char *msg, YList *members);
+
+void ext_yahoo_conf_userdecline(int id, const char *me, const char *who, const char *room, const char *msg);
+
+void ext_yahoo_conf_userjoin(int id, const char *me, const char *who, const char *room);
+
+void ext_yahoo_conf_userleave(int id, const char *me, const char *who, const char *room);
+
+void ext_yahoo_conf_message(int id, const char *me, const char *who, const char *room, const char *msg, int utf8);
+
+/* chat handlers */
+void ext_yahoo_chat_cat_xml(int id, const char *xml);
+
+void ext_yahoo_chat_join(int id, const char *me, const char *room, const char * topic, YList *members, int fd);
+
+void ext_yahoo_chat_userjoin(int id, const char *me, const char *room, struct yahoo_chat_member *who);
+
+void ext_yahoo_chat_userleave(int id, const char *me, const char *room, const char *who);
+
+void ext_yahoo_chat_message(int id, const char *me, const char *who, const char *room, const char *msg, int msgtype, int utf8);
+
+void ext_yahoo_chat_yahoologout(int id, const char *me);
+
+void ext_yahoo_chat_yahooerror(int id, const char *me);
+
+#endif
diff --git a/miranda-wine/protocols/Yahoo/file_transfer.c b/miranda-wine/protocols/Yahoo/file_transfer.c
new file mode 100644
index 0000000..f546a43
--- /dev/null
+++ b/miranda-wine/protocols/Yahoo/file_transfer.c
@@ -0,0 +1,613 @@
+/*
+ * $Id: file_transfer.c 3659 2006-08-30 19:43:41Z gena01 $
+ *
+ * myYahoo Miranda Plugin
+ *
+ * Authors: Gennady Feldman (aka Gena01)
+ * Laurent Marechal (aka Peorth)
+ *
+ * This code is under GPL and is based on AIM, MSN and Miranda source code.
+ * I want to thank Robert Rainwater and George Hazan for their code and support
+ * and for answering some of my questions during development of this plugin.
+ */
+#include <time.h>
+#include <sys/stat.h>
+
+#include "yahoo.h"
+#include <m_protosvc.h>
+#include "file_transfer.h"
+
+extern yahoo_local_account * ylad;
+
+void get_fd(int id, int fd, int error, void *data)
+{
+ y_filetransfer *sf = (y_filetransfer*) data;
+ char buf[1024];
+ long size = 0;
+ DWORD dw = 0;
+ int rw = 0;
+ struct _stat statbuf;
+
+ if (fd < 0) {
+ LOG(("[get_fd] Connect Failed!"));
+ error = 1;
+ }
+
+ if (_stat( sf->filename, &statbuf ) != 0 )
+ error = 1;
+
+ if(!error) {
+ HANDLE myhFile = CreateFile(sf->filename,
+ GENERIC_READ,
+ FILE_SHARE_READ|FILE_SHARE_WRITE,
+ NULL,
+ OPEN_EXISTING,
+ FILE_ATTRIBUTE_NORMAL | FILE_FLAG_SEQUENTIAL_SCAN,
+ 0);
+
+
+ if(myhFile !=INVALID_HANDLE_VALUE) {
+ PROTOFILETRANSFERSTATUS pfts;
+
+ DWORD lNotify = GetTickCount();
+ LOG(("proto: %s, hContact: %p", yahooProtocolName, sf->hContact));
+
+ LOG(("Sending file: %s", sf->filename));
+ //ProtoBroadcastAck(yahooProtocolName, sf->hContact, ACKTYPE_FILE, ACKRESULT_CONNECTING, sf, 0);
+ ProtoBroadcastAck(yahooProtocolName, sf->hContact, ACKTYPE_FILE, ACKRESULT_NEXTFILE, sf, 0);
+ ProtoBroadcastAck(yahooProtocolName, sf->hContact, ACKTYPE_FILE, ACKRESULT_CONNECTED, sf, 0);
+ //ProtoBroadcastAck(yahooProtocolName, sf->hContact, ACKTYPE_FILE, ACKRESULT_SENTREQUEST, sf, 0);
+ //ProtoBroadcastAck(yahooProtocolName, sf->hContact, ACKTYPE_FILE, ACKRESULT_INITIALISING, sf, 0);
+
+ ZeroMemory(&pfts, sizeof(PROTOFILETRANSFERSTATUS));
+ pfts.cbSize = sizeof(PROTOFILETRANSFERSTATUS);
+ pfts.hContact = sf->hContact;
+ pfts.sending = 1;
+ pfts.files = &sf->filename;
+ pfts.totalFiles = 1;
+ pfts.currentFileNumber = 0;
+ pfts.totalBytes = statbuf.st_size;
+ pfts.workingDir = NULL;
+ pfts.currentFile = sf->filename;
+ pfts.currentFileSize = statbuf.st_size;
+ pfts.currentFileTime = 0;
+
+ do {
+ ReadFile(myhFile, buf, sizeof(buf), &dw, NULL);
+
+ if (dw) {
+ rw = Netlib_Send((HANDLE)fd, buf, dw, MSG_NODUMP);
+
+ if (rw < 1) {
+ LOG(("Upload Failed. Send error? Got: %d", rw));
+ error = 1;
+ break;
+ } else
+ size += rw;
+
+ if(GetTickCount() >= lNotify + 500 || rw < 1024 || size == statbuf.st_size) {
+ LOG(("DOING UI Notify. Got %lu/%lu", size, statbuf.st_size));
+ pfts.totalProgress = size;
+ pfts.currentFileProgress = size;
+
+ ProtoBroadcastAck(yahooProtocolName, sf->hContact, ACKTYPE_FILE, ACKRESULT_DATA, sf, (LPARAM) & pfts);
+ lNotify = GetTickCount();
+ }
+
+ }
+
+ if (sf->cancel) {
+ LOG(("Upload Cancelled! "));
+ error = 1;
+ break;
+ }
+ } while ( rw > 0 && dw > 0 && !error);
+
+ CloseHandle(myhFile);
+
+ pfts.totalProgress = size;
+ pfts.currentFileProgress = size;
+
+ ProtoBroadcastAck(yahooProtocolName, sf->hContact, ACKTYPE_FILE, ACKRESULT_DATA, sf, (LPARAM) & pfts);
+
+ }
+ }
+
+ if (fd > 0) {
+ int tr = 0;
+
+ do {
+ rw = Netlib_Recv((HANDLE)fd, buf, sizeof(buf), 0);
+ LOG(("Got: %d bytes", rw));
+
+ if (tr == 0) {
+ //"HTTP/1.1 999" 12
+ // 012345678901
+ if (rw > 12) {
+ if (buf[9] != '2' || buf[10] != '0' || buf[11] != '0') {
+ LOG(("File Transfer Failed: %c%c%c", buf[9], buf[10], buf[11]));
+ error=1;
+ }
+ }
+ }
+ tr +=rw;
+ } while (rw > 0);
+
+ Netlib_CloseHandle((HANDLE)fd);
+ }
+
+ LOG(("File send complete!"));
+
+ ProtoBroadcastAck(yahooProtocolName, sf->hContact, ACKTYPE_FILE, !error ? ACKRESULT_SUCCESS:ACKRESULT_FAILED, sf, 0);
+}
+
+void YAHOO_SendFile(y_filetransfer *sf)
+{
+ long tFileSize = 0;
+ { struct _stat statbuf;
+ if ( _stat( sf->filename, &statbuf ) == 0 )
+ tFileSize += statbuf.st_size;
+ }
+
+ yahoo_send_file(ylad->id, sf->who, sf->msg, sf->filename, tFileSize, &get_fd, sf);
+}
+
+void YAHOO_FT_cancel(const char *buddy, const char *filename, const char *ft_token, int command)
+{
+ yahoo_ftdc_cancel(ylad->id, buddy, filename, ft_token, command);
+}
+
+void get_url(int id, int fd, int error, const char *filename, unsigned long size, void *data)
+{
+ y_filetransfer *sf = (y_filetransfer*) data;
+ char buf[1024];
+ long rsize = 0;
+ DWORD dw, c;
+
+ if (fd < 0) {
+ LOG(("[get_url] Connect Failed!"));
+
+ if (sf->ftoken != NULL) {
+ LOG(("[get_url] DC Detected: asking sender to upload to Yahoo FileServers!"));
+ YAHOO_FT_cancel(sf->who, sf->filename, sf->ftoken, 3);
+ }
+
+ error = 1;
+ }
+
+ if(!error) {
+ HANDLE myhFile;
+ PROTOFILETRANSFERSTATUS pfts;
+
+ ZeroMemory(&pfts, sizeof(PROTOFILETRANSFERSTATUS));
+ pfts.cbSize = sizeof(PROTOFILETRANSFERSTATUS);
+ pfts.hContact = sf->hContact;
+ pfts.sending = 0;
+ pfts.files = (char**)&filename;
+ pfts.totalFiles = 1;//ntohs(1);
+ pfts.currentFileNumber = 0;
+ pfts.totalBytes = size;
+
+ pfts.workingDir = sf->savepath;//ft->savepath;
+ pfts.currentFileSize = size; //ntohl(ft->hdr.size);
+
+ LOG(("dir: %s, file: %s", sf->savepath, sf->filename ));
+ wsprintf(buf, "%s\\%s", sf->savepath, sf->filename);
+
+ pfts.currentFile = _strdup(buf);
+ LOG(("Saving: %s", pfts.currentFile));
+
+ if ( sf->hWaitEvent != INVALID_HANDLE_VALUE )
+ CloseHandle( sf->hWaitEvent );
+
+ sf->hWaitEvent = CreateEvent( NULL, FALSE, FALSE, NULL );
+
+ if ( YAHOO_SendBroadcast( sf->hContact, ACKTYPE_FILE, ACKRESULT_FILERESUME, (void *)sf, ( LPARAM )&pfts )) {
+ WaitForSingleObject( sf->hWaitEvent, INFINITE );
+
+ switch(sf->action){
+ case FILERESUME_RENAME:
+ case FILERESUME_OVERWRITE:
+ case FILERESUME_RESUME:
+ // no action needed at this point, just break out of the switch statement
+ break;
+
+ case FILERESUME_CANCEL :
+ sf->cancel = 1;
+ break;
+
+ case FILERESUME_SKIP :
+ default:
+ //delete this; // per usual dcc objects destroy themselves when they fail or when connection is closed
+ //return FALSE;
+ sf->cancel = 2;
+ break;
+ }
+ }
+
+ free(pfts.currentFile);
+
+ if (! sf->cancel) {
+
+ if (sf->action != FILERESUME_RENAME ) {
+ LOG(("dir: %s, file: %s", sf->savepath, sf->filename ));
+
+ wsprintf(buf, "%s\\%s", sf->savepath, sf->filename);
+ } else {
+ LOG(("file: %s", sf->filename ));
+ //wsprintf(buf, "%s\%s", sf->filename);
+ lstrcpy(buf, sf->filename);
+ }
+
+ //pfts.files = &buf;
+ pfts.currentFile = _strdup(buf);
+
+ LOG(("Getting file: %s", buf));
+ myhFile = CreateFile(buf,
+ GENERIC_WRITE,
+ FILE_SHARE_WRITE,
+ NULL, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, 0);
+
+ if(myhFile !=INVALID_HANDLE_VALUE) {
+ DWORD lNotify = GetTickCount();
+
+ SetEndOfFile(myhFile);
+
+ LOG(("proto: %s, hContact: %p", yahooProtocolName, sf->hContact));
+
+ ProtoBroadcastAck(yahooProtocolName, sf->hContact, ACKTYPE_FILE, ACKRESULT_CONNECTED, sf, 0);
+
+ do {
+ dw = Netlib_Recv((HANDLE)fd, buf, 1024, MSG_NODUMP);
+
+ if (dw > 0) {
+ WriteFile(myhFile, buf, dw, &c, NULL);
+ rsize += dw;
+
+ /*LOG(("Got %d/%d", rsize, size));*/
+ if(GetTickCount() >= lNotify + 500 || dw <= 0 || rsize == size) {
+
+ LOG(("DOING UI Notify. Got %lu/%lu", rsize, size));
+
+ pfts.totalProgress = rsize;
+ pfts.currentFileTime = time(NULL);//ntohl(ft->hdr.modtime);
+ pfts.currentFileProgress = rsize;
+
+ ProtoBroadcastAck(yahooProtocolName, sf->hContact, ACKTYPE_FILE, ACKRESULT_DATA, sf, (LPARAM) & pfts);
+ lNotify = GetTickCount();
+ }
+ } else {
+ LOG(("Recv Failed! Socket Error?"));
+ error = 1;
+ break;
+ }
+
+ if (sf->cancel) {
+ LOG(("Recv Cancelled! "));
+ error = 1;
+ break;
+ }
+ } while ( dw > 0 && rsize < size);
+
+ LOG(("[Finished DL] Got %lu/%lu", rsize, size));
+ CloseHandle(myhFile);
+
+ } else {
+ LOG(("Can not open file for writing: %s", buf));
+ error = 1;
+ }
+
+ free(pfts.currentFile);
+ }
+
+ }
+
+ if (fd > 0) {
+ LOG(("Closing connection: %d", fd));
+ Netlib_CloseHandle((HANDLE)fd);
+ }
+
+ LOG(("File download complete!"));
+
+ ProtoBroadcastAck(yahooProtocolName, sf->hContact, ACKTYPE_FILE, !error ? ACKRESULT_SUCCESS:ACKRESULT_FAILED, sf, 0);
+}
+
+void YAHOO_RecvFile(y_filetransfer *ft)
+{
+ yahoo_get_url_handle(ylad->id, ft->url, &get_url, ft);
+}
+
+void ext_yahoo_got_file(int id, const char *me, const char *who, const char *url, long expires, const char *msg, const char *fname, unsigned long fesize, const char *ft_token, int y7)
+{
+ CCSDATA ccs;
+ PROTORECVEVENT pre;
+ HANDLE hContact;
+ char *szBlob;
+ y_filetransfer *ft;
+
+ LOG(("[ext_yahoo_got_file] id: %i, ident:%s, who: %s, url: %s, expires: %lu, msg: %s, fname: %s, fsize: %lu ftoken: %s y7: %d", id, me, who, url, expires, msg, fname, fesize, ft_token == NULL ? "NULL" : ft_token, y7));
+
+ hContact = getbuddyH(who);
+ if (hContact == NULL)
+ hContact = add_buddy(who, who, PALF_TEMPORARY);
+
+ ft= (y_filetransfer*) malloc(sizeof(y_filetransfer));
+ ft->id = id;
+ ft->who = strdup(who);
+ ft->hWaitEvent = INVALID_HANDLE_VALUE;
+ if (msg != NULL)
+ ft->msg = strdup(msg);
+ else
+ ft->msg = strdup("[no description given]");
+
+ ft->hContact = hContact;
+ if (fname != NULL)
+ ft->filename = strdup(fname);
+ else {
+ char *start, *end;
+
+ /* based on how gaim does this */
+ start = strrchr(url, '/');
+ if (start)
+ start++;
+
+ end = strrchr(url, '?');
+
+ if (start && *start && end) {
+ /* argh WINDOWS SUCKS!!! */
+ //ft->filename = strndup(start, end-start);
+ ft->filename = (char *)malloc(end - start + 1);
+ strncpy(ft->filename, start, end-start);
+ ft->filename[end-start] = '\0';
+ } else
+ ft->filename = strdup("filename.ext");
+ }
+
+ ft->url = strdup(url);
+ ft->fsize = fesize;
+ ft->cancel = 0;
+ ft->y7 = y7;
+ ft->ftoken = (ft_token == NULL) ? NULL : strdup(ft_token);
+
+ // blob is DWORD(*ft), ASCIIZ(filenames), ASCIIZ(description)
+ szBlob = (char *) malloc(sizeof(DWORD) + lstrlen(ft->filename) + lstrlen(ft->msg) + 2);
+ *((PDWORD) szBlob) = (DWORD) ft;
+ strcpy(szBlob + sizeof(DWORD), ft->filename);
+ strcpy(szBlob + sizeof(DWORD) + lstrlen(ft->filename) + 1, ft->msg);
+
+ pre.flags = 0;
+ pre.timestamp = time(NULL);
+ pre.szMessage = szBlob;
+ pre.lParam = 0;
+ ccs.szProtoService = PSR_FILE;
+ ccs.hContact = ft->hContact;
+ ccs.wParam = 0;
+ ccs.lParam = (LPARAM) & pre;
+ CallService(MS_PROTO_CHAINRECV, 0, (LPARAM) & ccs);
+ free(szBlob);
+}
+
+//=======================================================
+//File Transfer
+//=======================================================
+static void __cdecl yahoo_recv_filethread(void *psf)
+{
+ y_filetransfer *sf = psf;
+
+// ProtoBroadcastAck(yahooProtocolName, hContact, ACKTYPE_GETINFO, ACKRESULT_SUCCESS, (HANDLE) 1, 0);
+ if (sf == NULL) {
+ YAHOO_DebugLog("SF IS NULL!!!");
+ return;
+ }
+ YAHOO_DebugLog("who %s, msg: %s, filename: %s ", sf->who, sf->msg, sf->filename);
+
+ YAHOO_RecvFile(sf);
+ if ( sf->hWaitEvent != INVALID_HANDLE_VALUE )
+ CloseHandle( sf->hWaitEvent );
+
+ free(sf->who);
+ free(sf->msg);
+ free(sf->filename);
+ free(sf->url);
+ free(sf->savepath);
+ free(sf);
+
+}
+
+/**************** Receive File ********************/
+int YahooFileAllow(WPARAM wParam,LPARAM lParam)
+{
+ CCSDATA *ccs = (CCSDATA *) lParam;
+ y_filetransfer *ft = (y_filetransfer *) ccs->wParam;
+ int len;
+
+ YAHOO_DebugLog("[YahooFileAllow]");
+
+ if (ft->y7) {
+ YAHOO_DebugLog("[YahooFileAllow] We don't handle y7 stuff yet.");
+ //void yahoo_ft7dc_accept(int id, const char *buddy, const char *ft_token);
+ yahoo_ft7dc_accept(ft->id, ft->who, ft->ftoken);
+
+ return ccs->wParam;
+ }
+ //LOG(LOG_INFO, "[%s] Requesting file from %s", ft->cookie, ft->user);
+ ft->savepath = _strdup((char *) ccs->lParam);
+
+ len = lstrlen(ft->savepath) - 1;
+ if (ft->savepath[len] == '\\')
+ ft->savepath[len] = '\0';
+
+ pthread_create(yahoo_recv_filethread, (void *) ft);
+
+ return ccs->wParam;
+}
+
+int YahooFileDeny(WPARAM wParam,LPARAM lParam)
+{
+ /* deny file receive request.. just ignore it! */
+ CCSDATA *ccs = (CCSDATA *) lParam;
+ y_filetransfer *ft = (y_filetransfer *) ccs->wParam;
+
+ YAHOO_DebugLog("[YahooFileDeny]");
+
+ if ( !yahooLoggedIn || ft == NULL ) {
+ YAHOO_DebugLog("[YahooFileResume] Not logged-in or some other error!");
+ return 1;
+ }
+
+ if (ft->y7) {
+ YAHOO_DebugLog("[YahooFileDeny] We don't handle y7 stuff yet.");
+ //void yahoo_ft7dc_accept(int id, const char *buddy, const char *ft_token);
+ yahoo_ft7dc_cancel(ft->id, ft->who, ft->ftoken);
+ return 0;
+ }
+
+ if (ft->ftoken != NULL) {
+ YAHOO_DebugLog("[] DC Detected: Denying File Transfer!");
+ YAHOO_FT_cancel(ft->who, ft->filename, ft->ftoken, 2);
+ }
+ return 0;
+}
+
+int YahooFileResume( WPARAM wParam, LPARAM lParam )
+{
+ PROTOFILERESUME *pfr;
+ y_filetransfer *ft = (y_filetransfer *) wParam;
+
+ YAHOO_DebugLog("[YahooFileResume]");
+
+ if ( !yahooLoggedIn || ft == NULL ) {
+ YAHOO_DebugLog("[YahooFileResume] Not loggedin or some other error!");
+ return 1;
+ }
+
+ pfr = (PROTOFILERESUME*)lParam;
+
+ ft->action = pfr->action;
+
+ YAHOO_DebugLog("[YahooFileResume] Action: %d", pfr->action);
+
+ if ( pfr->action == FILERESUME_RENAME ) {
+ YAHOO_DebugLog("[YahooFileResume] Renamed file!");
+ if ( ft->filename != NULL ) {
+ free( ft->filename );
+ ft->filename = NULL;
+ }
+
+ ft->filename = strdup( pfr->szFilename );
+ }
+
+
+ SetEvent( ft->hWaitEvent );
+ return 0;
+}
+
+/**************** Send File ********************/
+static void __cdecl yahoo_send_filethread(void *psf)
+{
+ y_filetransfer *sf = psf;
+
+// ProtoBroadcastAck(yahooProtocolName, hContact, ACKTYPE_GETINFO, ACKRESULT_SUCCESS, (HANDLE) 1, 0);
+ if (sf == NULL) {
+ YAHOO_DebugLog("SF IS NULL!!!");
+ return;
+ }
+ YAHOO_DebugLog("who %s, msg: %s, filename: %s ", sf->who, sf->msg, sf->filename);
+
+ YAHOO_SendFile(sf);
+ free(sf->who);
+ free(sf->msg);
+ free(sf->filename);
+ free(sf);
+
+}
+
+int YahooFileCancel(WPARAM wParam,LPARAM lParam)
+{
+ CCSDATA* ccs = ( CCSDATA* )lParam;
+ y_filetransfer* ft = (y_filetransfer*)ccs->wParam;
+
+ YAHOO_DebugLog("[YahooFileCancel]");
+
+ if ( ft->hWaitEvent != INVALID_HANDLE_VALUE )
+ SetEvent( ft->hWaitEvent );
+
+ ft->action = FILERESUME_CANCEL;
+ ft->cancel = 1;
+ return 0;
+}
+
+/*
+ *
+ */
+int YahooSendFile(WPARAM wParam,LPARAM lParam)
+{
+ DBVARIANT dbv;
+ y_filetransfer *sf;
+ CCSDATA *ccs;
+ char** files;
+
+ YAHOO_DebugLog("YahooSendFile");
+
+ if ( !yahooLoggedIn )
+ return 0;
+
+ YAHOO_DebugLog("Gathering Data");
+
+ ccs = ( CCSDATA* )lParam;
+ //if ( YAHOO_GetWord( ccs->hContact, "Status", ID_STATUS_OFFLINE ) == ID_STATUS_OFFLINE )
+ // return 0;
+
+ YAHOO_DebugLog("Getting Files");
+
+ files = ( char** )ccs->lParam;
+ if ( files[1] != NULL ){
+ MessageBox(NULL, "YAHOO protocol allows only one file to be sent at a time", "Yahoo", MB_OK | MB_ICONINFORMATION);
+ return 0;
+ }
+
+ YAHOO_DebugLog("Getting Yahoo ID");
+
+ if (!DBGetContactSetting(ccs->hContact, yahooProtocolName, YAHOO_LOGINID, &dbv)) {
+
+ sf = (y_filetransfer*) malloc(sizeof(y_filetransfer));
+ sf->who = strdup(dbv.pszVal);
+ sf->msg = strdup(( char* )ccs->wParam );
+ sf->filename = strdup(files[0]);
+ sf->hContact = ccs->hContact;
+ sf->cancel = 0;
+
+ YAHOO_DebugLog("who: %s, msg: %s, filename: %s", sf->who, sf->msg, sf->filename);
+ pthread_create(yahoo_send_filethread, sf);
+
+ DBFreeVariant(&dbv);
+ YAHOO_DebugLog("Exiting SendRequest...");
+ return (int)(HANDLE)sf;
+ }
+
+ YAHOO_DebugLog("Exiting SendFile");
+ return 0;
+}
+
+int YahooRecvFile(WPARAM wParam,LPARAM lParam)
+{
+ DBEVENTINFO dbei;
+ CCSDATA *ccs = (CCSDATA *) lParam;
+ PROTORECVEVENT *pre = (PROTORECVEVENT *) ccs->lParam;
+ char *szDesc, *szFile;
+
+ DBDeleteContactSetting(ccs->hContact, "CList", "Hidden");
+ szFile = pre->szMessage + sizeof(DWORD);
+ szDesc = szFile + lstrlen(szFile) + 1;
+ ZeroMemory(&dbei, sizeof(dbei));
+ dbei.cbSize = sizeof(dbei);
+ dbei.szModule = yahooProtocolName;
+ dbei.timestamp = pre->timestamp;
+ dbei.flags = pre->flags & (PREF_CREATEREAD ? DBEF_READ : 0);
+ dbei.eventType = EVENTTYPE_FILE;
+ dbei.cbBlob = sizeof(DWORD) + lstrlen(szFile) + lstrlen(szDesc) + 2;
+ dbei.pBlob = (PBYTE) pre->szMessage;
+ CallService(MS_DB_EVENT_ADD, (WPARAM) ccs->hContact, (LPARAM) & dbei);
+ return 0;
+}
+
diff --git a/miranda-wine/protocols/Yahoo/file_transfer.h b/miranda-wine/protocols/Yahoo/file_transfer.h
new file mode 100644
index 0000000..72854a7
--- /dev/null
+++ b/miranda-wine/protocols/Yahoo/file_transfer.h
@@ -0,0 +1,48 @@
+/*
+ * $Id: file_transfer.h 3632 2006-08-28 20:33:30Z gena01 $
+ *
+ * myYahoo Miranda Plugin
+ *
+ * Authors: Gennady Feldman (aka Gena01)
+ * Laurent Marechal (aka Peorth)
+ *
+ * This code is under GPL and is based on AIM, MSN and Miranda source code.
+ * I want to thank Robert Rainwater and George Hazan for their code and support
+ * and for answering some of my questions during development of this plugin.
+ */
+#ifndef _YAHOO_FILE_TRANSFER_H_
+#define _YAHOO_FILE_TRANSFER_H_
+
+#define FILERESUME_CANCEL 11
+
+typedef struct {
+ int id;
+ char *who;
+ char *msg;
+ char *filename;
+ char *ftoken;
+ HANDLE hContact;
+ int cancel;
+ char *url;
+ char *savepath;
+ unsigned long fsize;
+ HANDLE hWaitEvent;
+ DWORD action;
+ int y7;
+} y_filetransfer;
+
+void YAHOO_SendFile(y_filetransfer *ft);
+void YAHOO_RecvFile(y_filetransfer *ft);
+void YAHOO_FT_cancel(const char *buddy, const char *filename, const char *ft_token, int command);
+
+void ext_yahoo_got_file(int id, const char *me, const char *who, const char *url, long expires, const char *msg, const char *fname, unsigned long fesize, const char *ft_token, int y7);
+
+/* service functions */
+int YahooFileAllow(WPARAM wParam,LPARAM lParam);
+int YahooFileDeny(WPARAM wParam, LPARAM lParam);
+int YahooFileResume(WPARAM wParam, LPARAM lParam);
+int YahooFileCancel(WPARAM wParam, LPARAM lParam);
+int YahooSendFile(WPARAM wParam, LPARAM lParam);
+int YahooRecvFile(WPARAM wParam, LPARAM lParam);
+
+#endif
diff --git a/miranda-wine/protocols/Yahoo/http_gateway.c b/miranda-wine/protocols/Yahoo/http_gateway.c
new file mode 100644
index 0000000..110cc0a
--- /dev/null
+++ b/miranda-wine/protocols/Yahoo/http_gateway.c
@@ -0,0 +1,88 @@
+/*
+ * $Id: http_gateway.c 3566 2006-08-22 01:55:32Z gena01 $
+ *
+ * myYahoo Miranda Plugin
+ *
+ * Authors: Gennady Feldman (aka Gena01)
+ * Laurent Marechal (aka Peorth)
+ *
+ * This code is under GPL and is based on AIM, MSN and Miranda source code.
+ * I want to thank Robert Rainwater and George Hazan for their code and support
+ * and for answering some of my questions during development of this plugin.
+ */
+#ifdef HTTP_GATEWAY
+
+#include <windows.h>
+#include "yahoo.h"
+
+extern yahoo_local_account * ylad;
+
+int YAHOO_httpGatewayInit(HANDLE hConn, NETLIBOPENCONNECTION *nloc, NETLIBHTTPREQUEST *nlhr)
+{
+ NETLIBHTTPPROXYINFO nlhpi;
+
+ YAHOO_DebugLog("YAHOO_httpGatewayInit!!!");
+
+ ZeroMemory(&nlhpi, sizeof(nlhpi) );
+ nlhpi.cbSize = sizeof(nlhpi);
+ nlhpi.szHttpPostUrl = "http://shttp.msg.yahoo.com/notify/";
+
+ //CallService( MS_NETLIB_SETPOLLINGTIMEOUT, (WPARAM) hConn, 15 );
+
+ return CallService(MS_NETLIB_SETHTTPPROXYINFO, (WPARAM)hConn, (LPARAM)&nlhpi);
+}
+
+int YAHOO_httpGatewayWrapSend(HANDLE hConn, PBYTE buf, int len, int flags, MIRANDASERVICE pfnNetlibSend)
+{
+ YAHOO_DebugLog("YAHOO_httpGatewayWrapSend!!! Len: %d", len);
+
+ if (len == 0 && ylad != NULL) { // we need to send something!!!
+ int n;
+ char *z = yahoo_webmessenger_idle_packet(ylad->id, &n);
+ int ret = 0;
+
+ if (z != NULL) {
+ YAHOO_DebugLog("YAHOO_httpGatewayWrapSend!!! Got Len: %d", n);
+ NETLIBBUFFER tBuf = { ( char* )z, n, flags };
+ ret = pfnNetlibSend(( LPARAM )hConn, (WPARAM) &tBuf );
+ FREE(z);
+ } else {
+ YAHOO_DebugLog("YAHOO_httpGatewayWrapSend!!! GOT NULL???");
+ }
+
+ return ret;
+ } else {
+ NETLIBBUFFER tBuf = { ( char* )buf, len, flags };
+
+ return pfnNetlibSend(( LPARAM )hConn, (WPARAM) &tBuf );
+ }
+}
+
+PBYTE YAHOO_httpGatewayUnwrapRecv(NETLIBHTTPREQUEST *nlhr, PBYTE buf, int len, int *outBufLen, void *(*NetlibRealloc)(void *, size_t))
+{
+ YAHOO_DebugLog("YAHOO_httpGatewayUnwrapRecv!!! Len: %d", len);
+
+ YAHOO_DebugLog("Got headers: %d", nlhr->headersCount);
+ /* we need to get the first 4 bytes! */
+ if (len < 4)
+ return NULL;
+
+ if (ylad != NULL) {
+ ylad->rpkts = buf[0] + buf[1] *256;
+ YAHOO_DebugLog("Got packets: %d", ylad->rpkts);
+ }
+
+ if (len == 4){
+ *outBufLen = 0;
+ return buf;
+ } else if ( (buf[4] == 'Y') && (buf[5] == 'M') && (buf[6] == 'S') && (buf[7] == 'G') ) {
+ MoveMemory( buf, buf + 4, len - 4);
+ *outBufLen = len-4;// we take off 4 bytes from the beginning
+
+ return buf;
+ } else
+ return NULL; /* Break connection, something went wrong! */
+
+}
+
+#endif
diff --git a/miranda-wine/protocols/Yahoo/http_gateway.h b/miranda-wine/protocols/Yahoo/http_gateway.h
new file mode 100644
index 0000000..43aa4c1
--- /dev/null
+++ b/miranda-wine/protocols/Yahoo/http_gateway.h
@@ -0,0 +1,24 @@
+/*
+ * $Id: http_gateway.h 3541 2006-08-18 21:18:33Z gena01 $
+ *
+ * myYahoo Miranda Plugin
+ *
+ * Authors: Gennady Feldman (aka Gena01)
+ * Laurent Marechal (aka Peorth)
+ *
+ * This code is under GPL and is based on AIM, MSN and Miranda source code.
+ * I want to thank Robert Rainwater and George Hazan for their code and support
+ * and for answering some of my questions during development of this plugin.
+ */
+
+#ifndef _YAHOO_HTTP_GATEWAY_H_
+#define _YAHOO_HTTP_GATEWAY_H_
+
+#define HTTP_PROXY_VERSION 0x0443
+
+int YAHOO_httpGatewayInit(HANDLE hConn, NETLIBOPENCONNECTION *nloc, NETLIBHTTPREQUEST *nlhr);
+int YAHOO_httpGatewayWrapSend(HANDLE hConn, PBYTE buf, int len, int flags, MIRANDASERVICE pfnNetlibSend);
+PBYTE YAHOO_httpGatewayUnwrapRecv(NETLIBHTTPREQUEST *nlhr, PBYTE buf, int bufLen, int *outBufLen, void *(*NetlibRealloc)(void *, size_t));
+
+#endif
+
diff --git a/miranda-wine/protocols/Yahoo/icos/address_book.ico b/miranda-wine/protocols/Yahoo/icos/address_book.ico
new file mode 100644
index 0000000..9ab54fa
--- /dev/null
+++ b/miranda-wine/protocols/Yahoo/icos/address_book.ico
Binary files differ
diff --git a/miranda-wine/protocols/Yahoo/icos/calendar.ico b/miranda-wine/protocols/Yahoo/icos/calendar.ico
new file mode 100644
index 0000000..9eef326
--- /dev/null
+++ b/miranda-wine/protocols/Yahoo/icos/calendar.ico
Binary files differ
diff --git a/miranda-wine/protocols/Yahoo/icos/inbox.ico b/miranda-wine/protocols/Yahoo/icos/inbox.ico
new file mode 100644
index 0000000..55097a1
--- /dev/null
+++ b/miranda-wine/protocols/Yahoo/icos/inbox.ico
Binary files differ
diff --git a/miranda-wine/protocols/Yahoo/icos/invite.ico b/miranda-wine/protocols/Yahoo/icos/invite.ico
new file mode 100644
index 0000000..2efc4dc
--- /dev/null
+++ b/miranda-wine/protocols/Yahoo/icos/invite.ico
Binary files differ
diff --git a/miranda-wine/protocols/Yahoo/icos/profile.ico b/miranda-wine/protocols/Yahoo/icos/profile.ico
new file mode 100644
index 0000000..a2c16ae
--- /dev/null
+++ b/miranda-wine/protocols/Yahoo/icos/profile.ico
Binary files differ
diff --git a/miranda-wine/protocols/Yahoo/icos/refresh.ico b/miranda-wine/protocols/Yahoo/icos/refresh.ico
new file mode 100644
index 0000000..77a399e
--- /dev/null
+++ b/miranda-wine/protocols/Yahoo/icos/refresh.ico
Binary files differ
diff --git a/miranda-wine/protocols/Yahoo/icos/set_status.ico b/miranda-wine/protocols/Yahoo/icos/set_status.ico
new file mode 100644
index 0000000..ac2d356
--- /dev/null
+++ b/miranda-wine/protocols/Yahoo/icos/set_status.ico
Binary files differ
diff --git a/miranda-wine/protocols/Yahoo/icos/yahoo.ico b/miranda-wine/protocols/Yahoo/icos/yahoo.ico
new file mode 100644
index 0000000..fc54d7b
--- /dev/null
+++ b/miranda-wine/protocols/Yahoo/icos/yahoo.ico
Binary files differ
diff --git a/miranda-wine/protocols/Yahoo/im.c b/miranda-wine/protocols/Yahoo/im.c
new file mode 100644
index 0000000..85212c6
--- /dev/null
+++ b/miranda-wine/protocols/Yahoo/im.c
@@ -0,0 +1,333 @@
+/*
+ * $Id: im.c 3659 2006-08-30 19:43:41Z gena01 $
+ *
+ * myYahoo Miranda Plugin
+ *
+ * Authors: Gennady Feldman (aka Gena01)
+ * Laurent Marechal (aka Peorth)
+ *
+ * This code is under GPL and is based on AIM, MSN and Miranda source code.
+ * I want to thank Robert Rainwater and George Hazan for their code and support
+ * and for answering some of my questions during development of this plugin.
+ */
+#include <time.h>
+#include <malloc.h>
+#include <sys/stat.h>
+
+#include "yahoo.h"
+
+#include <m_langpack.h>
+#include <m_protosvc.h>
+
+#include "avatar.h"
+#include "im.h"
+
+extern yahoo_local_account *ylad;
+extern HANDLE hYahooNudge;
+
+static void yahoo_send_msg(const char *id, const char *msg, int utf8)
+{
+ int buddy_icon = 0;
+ LOG(("yahoo_send_msg: %s: %s, utf: %d", id, msg, utf8));
+
+ buddy_icon = (YAHOO_GetDword("AvatarHash", 0) != 0) ? 2: 0;
+
+ yahoo_send_im(ylad->id, NULL, id, msg, utf8, buddy_icon);
+}
+
+void ext_yahoo_got_im(int id, const char *me, const char *who, const char *msg, long tm, int stat, int utf8, int buddy_icon)
+{
+ char *umsg;
+ const char *c = msg;
+ int oidx = 0;
+ wchar_t* tRealBody = NULL;
+ int tRealBodyLen = 0;
+ int msgLen;
+ char* tMsgBuf = NULL;
+ char* p = NULL;
+ CCSDATA ccs;
+ PROTORECVEVENT pre;
+ HANDLE hContact;
+
+
+ LOG(("YAHOO_GOT_IM id:%s %s: %s tm:%lu stat:%i utf8:%i buddy_icon: %i", me, who, msg, tm, stat, utf8, buddy_icon));
+
+ if(stat == 2) {
+ char z[1024];
+
+ snprintf(z, sizeof z, "Error sending message to %s", who);
+ LOG((z));
+ YAHOO_ShowError(Translate("Yahoo Error"), z);
+ return;
+ }
+
+ if(!msg) {
+ LOG(("Empty Incoming Message, exiting."));
+ return;
+ }
+
+ {
+ YList *l;
+
+ /* show our current ignore list */
+ l = (YList *)YAHOO_GetIgnoreList();
+ while (l != NULL) {
+ struct yahoo_buddy *b = (struct yahoo_buddy *) l->data;
+
+ //MessageBox(NULL, b->id, "ID", MB_OK);
+ //SendMessage(GetDlgItem(hwndDlg,IDC_YIGN_LIST), LB_INSERTSTRING, 0, (LPARAM)b->id);
+ if (lstrcmpi(b->id, who) == 0) {
+ LOG(("User '%s' on our Ignore List. Dropping Message.", who));
+ return;
+ }
+ l = l->next;
+ }
+
+ }
+
+ umsg = (char *) alloca(lstrlen(msg) * 2 + 1); /* double size to be on the safe side */
+ while ( *c != '\0') {
+ // Strip the font and font size tag
+ if (!strnicmp(c,"<font face=",11) || !strnicmp(c,"<font size=",11) ||
+ !strnicmp(c, "<font color=",12) || !strnicmp(c,"</font>",6) ||
+ // strip the fade tag
+ !strnicmp(c, "<FADE ",6) || !strnicmp(c,"</FADE>",7) ||
+ // strip the alternate colors tag
+ !strnicmp(c, "<ALT ",5) || !strnicmp(c, "</ALT>",6)){
+ while ((*c++ != '>') && (*c != '\0'));
+ } else
+ // strip ANSI color combination
+ if ((*c == 0x1b) && (*(c+1) == '[')){
+ while ((*c++ != 'm') && (*c != '\0'));
+ } else
+
+ if (*c != '\0'){
+ umsg[oidx++] = *c;
+
+ /* Adding \r to \r\n conversion */
+ if (*c == '\r' && *(c + 1) != '\n')
+ umsg[oidx++] = '\n';
+
+ c++;
+ }
+ }
+
+ umsg[oidx++]= '\0';
+
+ /* Need to strip off formatting stuff first. Then do all decoding/converting */
+ if (utf8){
+ Utf8Decode( umsg, 0, &tRealBody );
+ tRealBodyLen = wcslen( tRealBody );
+ }
+
+ LOG(("%s: %s", who, umsg));
+
+ //if(!strcmp(umsg, "<ding>"))
+ // :P("\a");
+
+ if (utf8)
+ msgLen = (lstrlen(umsg) + 1) * (sizeof(wchar_t) + 1);
+ else
+ msgLen = (lstrlen(umsg) + 1);
+
+ tMsgBuf = ( char* )alloca( msgLen );
+ p = tMsgBuf;
+
+ // MSGBUF Blob: <ASCII> \0 <UNICODE> \0
+ strcpy( p, umsg );
+
+ p += lstrlen(umsg) + 1;
+
+ if ( tRealBodyLen != 0 ) {
+ memcpy( p, tRealBody, sizeof( wchar_t )*( tRealBodyLen+1 ));
+ free( tRealBody );
+ }
+
+ ccs.szProtoService = PSR_MESSAGE;
+ ccs.hContact = hContact = add_buddy(who, who, PALF_TEMPORARY);
+ ccs.wParam = 0;
+ ccs.lParam = (LPARAM) &pre;
+ pre.flags = (utf8) ? PREF_UNICODE : 0;
+
+ if (tm) {
+ HANDLE hEvent = (HANDLE)CallService(MS_DB_EVENT_FINDLAST, (WPARAM)hContact, 0);
+
+ if (hEvent) { // contact has events
+ DBEVENTINFO dbei;
+ DWORD dummy;
+
+ dbei.cbSize = sizeof (DBEVENTINFO);
+ dbei.pBlob = (char*)&dummy;
+ dbei.cbBlob = 2;
+ if (!CallService(MS_DB_EVENT_GET, (WPARAM)hEvent, (LPARAM)&dbei))
+ // got that event, if newer than ts then reset to current time
+ if (tm < dbei.timestamp) tm = time(NULL);
+ }
+
+ pre.timestamp = tm;
+ } else
+ pre.timestamp = time(NULL);
+
+ pre.szMessage = tMsgBuf;
+ pre.lParam = 0;
+
+ // Turn off typing
+ CallService(MS_PROTO_CONTACTISTYPING, (WPARAM) hContact, PROTOTYPE_CONTACTTYPING_OFF);
+ CallService(MS_PROTO_CHAINRECV, 0, (LPARAM) & ccs);
+
+ if (buddy_icon < 0) return;
+
+ //?? Don't generate floods!!
+ DBWriteContactSettingByte(hContact, yahooProtocolName, "AvatarType", buddy_icon);
+ if (buddy_icon != 2) {
+ yahoo_reset_avatar(hContact);
+ } else if (DBGetContactSettingDword(hContact, yahooProtocolName,"PictCK", 0) == 0) {
+ /* request the buddy image */
+ YAHOO_request_avatar(who);
+ }
+}
+
+
+static void __cdecl yahoo_im_sendacksuccess(HANDLE hContact)
+{
+ ProtoBroadcastAck(yahooProtocolName, hContact, ACKTYPE_MESSAGE, ACKRESULT_SUCCESS, (HANDLE) 1, 0);
+}
+
+static void __cdecl yahoo_im_sendackfail(HANDLE hContact)
+{
+ SleepEx(1000, TRUE);
+ ProtoBroadcastAck(yahooProtocolName, hContact, ACKTYPE_MESSAGE, ACKRESULT_FAILED, (HANDLE) 1,
+ (LPARAM) Translate("The message send timed out."));
+}
+
+static void __cdecl yahoo_im_sendackfail_longmsg(HANDLE hContact)
+{
+ SleepEx(1000, TRUE);
+ ProtoBroadcastAck(yahooProtocolName, hContact, ACKTYPE_MESSAGE, ACKRESULT_FAILED, (HANDLE) 1,
+ (LPARAM)Translate("Message is too long: Yahoo messages are limited by 800 UTF8 chars"));
+}
+
+//=======================================================
+//Send a message
+//=======================================================
+//#define MSG_LEN 2048
+int YahooSendMessage(WPARAM wParam, LPARAM lParam)
+{
+ CCSDATA *ccs = (CCSDATA *) lParam;
+ DBVARIANT dbv;
+ char *msg = (char *) ccs->lParam;
+
+ if (!yahooLoggedIn) {/* don't send message if we not connected! */
+ pthread_create(yahoo_im_sendackfail, ccs->hContact);
+ return 1;
+ }
+
+ if (lstrlen(msg) > 800) {/* don't send message if we not connected! */
+ pthread_create( yahoo_im_sendackfail_longmsg, ccs->hContact);
+ return 1;
+ }
+
+ if (!DBGetContactSetting(ccs->hContact, yahooProtocolName, YAHOO_LOGINID, &dbv)) {
+ yahoo_send_msg(dbv.pszVal, msg, 0);
+ DBFreeVariant(&dbv);
+
+ pthread_create(yahoo_im_sendacksuccess, ccs->hContact);
+
+ return 1;
+ }
+
+ return 0;
+}
+
+int YahooSendMessageW(WPARAM wParam, LPARAM lParam)
+{
+ CCSDATA *ccs = (CCSDATA *) lParam;
+ DBVARIANT dbv;
+
+ if (!yahooLoggedIn) {/* don't send message if we not connected! */
+ pthread_create(yahoo_im_sendackfail, ccs->hContact);
+ return 1;
+ }
+
+
+ if (!DBGetContactSetting(ccs->hContact, yahooProtocolName, YAHOO_LOGINID, &dbv)) {
+ char* p = ( char* )ccs->lParam;
+ char* msg = Utf8EncodeUcs2(( wchar_t* )&p[ strlen(p)+1 ] );
+
+ if (lstrlen(msg) > 800) {/* don't send message if we not connected! */
+ pthread_create(yahoo_im_sendackfail_longmsg, ccs->hContact);
+ } else {
+ yahoo_send_msg(dbv.pszVal, msg, 1);
+ pthread_create(yahoo_im_sendacksuccess, ccs->hContact);
+ }
+
+ DBFreeVariant(&dbv);
+ free(msg);
+
+ return 1;
+ }
+
+ return 0;
+}
+
+//=======================================================
+//Receive a message
+//=======================================================
+int YahooRecvMessage(WPARAM wParam, LPARAM lParam)
+{
+ DBEVENTINFO dbei;
+ CCSDATA *ccs = (CCSDATA *) lParam;
+ PROTORECVEVENT *pre = (PROTORECVEVENT *) ccs->lParam;
+
+ DBDeleteContactSetting(ccs->hContact, "CList", "Hidden");
+
+ // NUDGES
+ if( !lstrcmp(pre->szMessage, "<ding>") && ServiceExists("NUDGE/Send")){
+ YAHOO_DebugLog("[YahooRecvMessage] Doing Nudge Service!");
+ NotifyEventHooks(hYahooNudge, (WPARAM) ccs->hContact, 0);
+ return 0;
+ }
+
+ ZeroMemory(&dbei, sizeof(dbei));
+ dbei.cbSize = sizeof(dbei);
+ dbei.szModule = yahooProtocolName;
+ dbei.timestamp = pre->timestamp;
+ dbei.flags = pre->flags & (PREF_CREATEREAD ? DBEF_READ : 0);
+ dbei.eventType = EVENTTYPE_MESSAGE;
+ dbei.cbBlob = (!lstrcmp(pre->szMessage, "<ding>"))? lstrlen("BUZZ!!!")+1:lstrlen(pre->szMessage) + 1;
+ if ( pre->flags & PREF_UNICODE )
+ dbei.cbBlob *= ( sizeof( wchar_t )+1 );
+
+
+ dbei.pBlob = (PBYTE) (!lstrcmp(pre->szMessage, "<ding>"))? "BUZZ!!!":pre->szMessage;
+ CallService(MS_DB_EVENT_ADD, (WPARAM) ccs->hContact, (LPARAM) & dbei);
+ return 0;
+}
+
+//=======================================================
+//Send a nudge
+//=======================================================
+int YahooSendNudge(WPARAM wParam, LPARAM lParam)
+{
+ HANDLE hContact = (HANDLE) wParam;
+ DBVARIANT dbv;
+
+ YAHOO_DebugLog("[YAHOO_SENDNUDGE]");
+
+ if (!yahooLoggedIn) {/* don't send nudge if we not connected! */
+ pthread_create(yahoo_im_sendackfail, hContact);
+ return 1;
+ }
+
+ if (!DBGetContactSetting(hContact, yahooProtocolName, YAHOO_LOGINID, &dbv)) {
+ yahoo_send_msg(dbv.pszVal, "<ding>", 0);
+ DBFreeVariant(&dbv);
+
+ pthread_create(yahoo_im_sendacksuccess, hContact);
+
+ return 1;
+ }
+
+ return 0;
+}
+
diff --git a/miranda-wine/protocols/Yahoo/im.h b/miranda-wine/protocols/Yahoo/im.h
new file mode 100644
index 0000000..2c6a509
--- /dev/null
+++ b/miranda-wine/protocols/Yahoo/im.h
@@ -0,0 +1,23 @@
+/*
+ * $Id: im.h 3632 2006-08-28 20:33:30Z gena01 $
+ *
+ * myYahoo Miranda Plugin
+ *
+ * Authors: Gennady Feldman (aka Gena01)
+ * Laurent Marechal (aka Peorth)
+ *
+ * This code is under GPL and is based on AIM, MSN and Miranda source code.
+ * I want to thank Robert Rainwater and George Hazan for their code and support
+ * and for answering some of my questions during development of this plugin.
+ */
+#ifndef _YAHOO_IM_H_
+#define _YAHOO_IM_H_
+
+void ext_yahoo_got_im(int id, const char *me, const char *who, const char *msg, long tm, int stat, int utf8, int buddy_icon);
+
+int YahooSendNudge(WPARAM wParam, LPARAM lParam);
+int YahooRecvMessage(WPARAM wParam, LPARAM lParam);
+int YahooSendMessageW(WPARAM wParam, LPARAM lParam);
+int YahooSendMessage(WPARAM wParam, LPARAM lParam);
+
+#endif
diff --git a/miranda-wine/protocols/Yahoo/libyahoo2/config.h b/miranda-wine/protocols/Yahoo/libyahoo2/config.h
new file mode 100644
index 0000000..de46a4f
--- /dev/null
+++ b/miranda-wine/protocols/Yahoo/libyahoo2/config.h
@@ -0,0 +1,35 @@
+#define HAVE_STRING_H 1
+#define STDC_HEADERS 1
+#define HAVE_STRCHR 1
+#define HAVE_MEMCPY 1
+
+#define PACKAGE "libyahoo2"
+#define VERSION "0.7.5"
+
+/* Add some WIN32 size savers */
+#include <windows.h>
+#include <stdio.h>
+
+#define strlen lstrlen
+#define strcat lstrcat
+#define strcmp lstrcmp
+#define strcpy lstrcpy
+
+#ifdef _MSC_VER
+
+#define strncasecmp strnicmp
+
+#define wsnprintf _wsnprintf
+#define snprintf _snprintf
+#define vsnprintf _vsnprintf
+
+#endif
+
+#define USE_STRUCT_CALLBACKS
+
+#define write(a,b,c) send(a,b,c,0)
+#define read(a,b,c) recv(a,b,c,0)
+
+#include <newpluginapi.h>
+#include <m_netlib.h>
+#define close(a) Netlib_CloseHandle((HANDLE)a)
diff --git a/miranda-wine/protocols/Yahoo/libyahoo2/crypt.c b/miranda-wine/protocols/Yahoo/libyahoo2/crypt.c
new file mode 100644
index 0000000..981be0d
--- /dev/null
+++ b/miranda-wine/protocols/Yahoo/libyahoo2/crypt.c
@@ -0,0 +1,207 @@
+/* One way encryption based on MD5 sum.
+ Copyright (C) 1996, 1997, 1999, 2000 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library 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
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+/* warmenhoven took this file and made it work with the md5.[ch] we
+ * already had. isn't that lovely. people should just use linux or
+ * freebsd, crypt works properly on those systems. i hate solaris */
+
+#if HAVE_CONFIG_H
+# include "config.h"
+#endif
+
+#if HAVE_STRING_H
+# include <string.h>
+#elif HAVE_STRINGS_H
+# include <strings.h>
+#endif
+
+#include <stdlib.h>
+#include "yahoo_util.h"
+
+#include "md5.h"
+
+/* Define our magic string to mark salt for MD5 "encryption"
+ replacement. This is meant to be the same as for other MD5 based
+ encryption implementations. */
+static const char md5_salt_prefix[] = "$1$";
+
+/* Table with characters for base64 transformation. */
+static const char b64t[64] =
+"./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
+
+char *yahoo_crypt(char *key, char *salt)
+{
+ char *buffer = NULL;
+ int buflen = 0;
+ int needed = 3 + strlen (salt) + 1 + 26 + 1;
+
+ md5_byte_t alt_result[16];
+ md5_state_t ctx;
+ md5_state_t alt_ctx;
+ size_t salt_len;
+ size_t key_len;
+ size_t cnt;
+ char *cp;
+
+ if (buflen < needed) {
+ buflen = needed;
+ if ((buffer = realloc(buffer, buflen)) == NULL)
+ return NULL;
+ }
+
+ /* Find beginning of salt string. The prefix should normally always
+ be present. Just in case it is not. */
+ if (strncmp (md5_salt_prefix, salt, sizeof (md5_salt_prefix) - 1) == 0)
+ /* Skip salt prefix. */
+ salt += sizeof (md5_salt_prefix) - 1;
+
+ salt_len = MIN (strcspn (salt, "$"), 8);
+ key_len = strlen (key);
+
+ /* Prepare for the real work. */
+ md5_init(&ctx);
+
+ /* Add the key string. */
+ md5_append(&ctx, (md5_byte_t *)key, key_len);
+
+ /* Because the SALT argument need not always have the salt prefix we
+ add it separately. */
+ md5_append(&ctx, (md5_byte_t *)md5_salt_prefix, sizeof (md5_salt_prefix) - 1);
+
+ /* The last part is the salt string. This must be at most 8
+ characters and it ends at the first `$' character (for
+ compatibility which existing solutions). */
+ md5_append(&ctx, (md5_byte_t *)salt, salt_len);
+
+ /* Compute alternate MD5 sum with input KEY, SALT, and KEY. The
+ final result will be added to the first context. */
+ md5_init(&alt_ctx);
+
+ /* Add key. */
+ md5_append(&alt_ctx, (md5_byte_t *)key, key_len);
+
+ /* Add salt. */
+ md5_append(&alt_ctx, (md5_byte_t *)salt, salt_len);
+
+ /* Add key again. */
+ md5_append(&alt_ctx, (md5_byte_t *)key, key_len);
+
+ /* Now get result of this (16 bytes) and add it to the other
+ context. */
+ md5_finish(&alt_ctx, alt_result);
+
+ /* Add for any character in the key one byte of the alternate sum. */
+ for (cnt = key_len; cnt > 16; cnt -= 16)
+ md5_append(&ctx, alt_result, 16);
+ md5_append(&ctx, alt_result, cnt);
+
+ /* For the following code we need a NUL byte. */
+ alt_result[0] = '\0';
+
+ /* The original implementation now does something weird: for every 1
+ bit in the key the first 0 is added to the buffer, for every 0
+ bit the first character of the key. This does not seem to be
+ what was intended but we have to follow this to be compatible. */
+ for (cnt = key_len; cnt > 0; cnt >>= 1)
+ md5_append(&ctx, (cnt & 1) != 0 ? alt_result : (md5_byte_t *)key, 1);
+
+ /* Create intermediate result. */
+ md5_finish(&ctx, alt_result);
+
+ /* Now comes another weirdness. In fear of password crackers here
+ comes a quite long loop which just processes the output of the
+ previous round again. We cannot ignore this here. */
+ for (cnt = 0; cnt < 1000; ++cnt) {
+ /* New context. */
+ md5_init(&ctx);
+
+ /* Add key or last result. */
+ if ((cnt & 1) != 0)
+ md5_append(&ctx, (md5_byte_t *)key, key_len);
+ else
+ md5_append(&ctx, alt_result, 16);
+
+ /* Add salt for numbers not divisible by 3. */
+ if (cnt % 3 != 0)
+ md5_append(&ctx, (md5_byte_t *)salt, salt_len);
+
+ /* Add key for numbers not divisible by 7. */
+ if (cnt % 7 != 0)
+ md5_append(&ctx, (md5_byte_t *)key, key_len);
+
+ /* Add key or last result. */
+ if ((cnt & 1) != 0)
+ md5_append(&ctx, alt_result, 16);
+ else
+ md5_append(&ctx, (md5_byte_t *)key, key_len);
+
+ /* Create intermediate result. */
+ md5_finish(&ctx, alt_result);
+ }
+
+ /* Now we can construct the result string. It consists of three
+ parts. */
+
+ strncpy(buffer, md5_salt_prefix, MAX (0, buflen));
+ cp = buffer + strlen(buffer);
+ buflen -= sizeof (md5_salt_prefix);
+
+ strncpy(cp, salt, MIN ((size_t) buflen, salt_len));
+ cp = cp + strlen(cp);
+ buflen -= MIN ((size_t) buflen, salt_len);
+
+ if (buflen > 0) {
+ *cp++ = '$';
+ --buflen;
+ }
+
+#define b64_from_24bit(B2, B1, B0, N) \
+ do { \
+ unsigned int w = ((B2) << 16) | ((B1) << 8) | (B0); \
+ int n = (N); \
+ while (n-- > 0 && buflen > 0) { \
+ *cp++ = b64t[w & 0x3f]; \
+ --buflen; \
+ w >>= 6; \
+ }\
+ } while (0)
+
+ b64_from_24bit (alt_result[0], alt_result[6], alt_result[12], 4);
+ b64_from_24bit (alt_result[1], alt_result[7], alt_result[13], 4);
+ b64_from_24bit (alt_result[2], alt_result[8], alt_result[14], 4);
+ b64_from_24bit (alt_result[3], alt_result[9], alt_result[15], 4);
+ b64_from_24bit (alt_result[4], alt_result[10], alt_result[5], 4);
+ b64_from_24bit (0, 0, alt_result[11], 2);
+ if (buflen <= 0) {
+ FREE(buffer);
+ } else
+ *cp = '\0'; /* Terminate the string. */
+
+ /* Clear the buffer for the intermediate result so that people
+ attaching to processes or reading core dumps cannot get any
+ information. We do it in this way to clear correct_words[]
+ inside the MD5 implementation as well. */
+ md5_init(&ctx);
+ md5_finish(&ctx, alt_result);
+ memset (&ctx, '\0', sizeof (ctx));
+ memset (&alt_ctx, '\0', sizeof (alt_ctx));
+
+ return buffer;
+}
diff --git a/miranda-wine/protocols/Yahoo/libyahoo2/libyahoo2.c b/miranda-wine/protocols/Yahoo/libyahoo2/libyahoo2.c
new file mode 100644
index 0000000..d749d62
--- /dev/null
+++ b/miranda-wine/protocols/Yahoo/libyahoo2/libyahoo2.c
@@ -0,0 +1,6319 @@
+/*
+ * libyahoo2: libyahoo2.c
+ *
+ * Some code copyright (C) 2002-2004, Philip S Tellis <philip.tellis AT gmx.net>
+ *
+ * Yahoo Search copyright (C) 2003, Konstantin Klyagin <konst AT konst.org.ua>
+ *
+ * Much of this code was taken and adapted from the yahoo module for
+ * gaim released under the GNU GPL. This code is also released under the
+ * GNU GPL.
+ *
+ * This code is derivitive of Gaim <http://gaim.sourceforge.net>
+ * copyright (C) 1998-1999, Mark Spencer <markster@marko.net>
+ * 1998-1999, Adam Fritzler <afritz@marko.net>
+ * 1998-2002, Rob Flynn <rob@marko.net>
+ * 2000-2002, Eric Warmenhoven <eric@warmenhoven.org>
+ * 2001-2002, Brian Macke <macke@strangelove.net>
+ * 2001, Anand Biligiri S <abiligiri@users.sf.net>
+ * 2001, Valdis Kletnieks
+ * 2002, Sean Egan <bj91704@binghamton.edu>
+ * 2002, Toby Gray <toby.gray@ntlworld.com>
+ *
+ * This library also uses code from other libraries, namely:
+ * Portions from libfaim copyright 1998, 1999 Adam Fritzler
+ * <afritz@auk.cx>
+ * Portions of Sylpheed copyright 2000-2002 Hiroyuki Yamamoto
+ * <hiro-y@kcn.ne.jp>
+ *
+ *
+ * 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
+ *
+ */
+
+#if HAVE_CONFIG_H
+# include "config.h"
+#endif
+
+#ifndef _WIN32
+# include <unistd.h>
+#endif
+
+#include <errno.h>
+#include <stdio.h>
+#include <stdarg.h>
+
+#if STDC_HEADERS
+# include <string.h>
+#else
+# if !HAVE_STRCHR
+# define strchr index
+# define strrchr rindex
+# endif
+char *strchr (), *strrchr ();
+# if !HAVE_MEMCPY
+# define memcpy(d, s, n) bcopy ((s), (d), (n))
+# define memmove(d, s, n) bcopy ((s), (d), (n))
+# endif
+#endif
+
+#include <sys/types.h>
+
+#include <stdlib.h>
+#include <ctype.h>
+
+#include "sha.h"
+#include "md5.h"
+#include "yahoo2.h"
+#include "yahoo_httplib.h"
+#include "yahoo_util.h"
+#include "yahoo_fn.h"
+
+#include "yahoo2_callbacks.h"
+#include "yahoo_debug.h"
+
+#ifdef USE_STRUCT_CALLBACKS
+struct yahoo_callbacks *yc=NULL;
+
+void yahoo_register_callbacks(struct yahoo_callbacks * tyc)
+{
+ yc = tyc;
+}
+
+#define YAHOO_CALLBACK(x) yc->x
+#else
+#define YAHOO_CALLBACK(x) x
+#endif
+
+static int yahoo_send_data(int fd, void *data, int len);
+
+int yahoo_log_message(char * fmt, ...)
+{
+ char out[1024];
+ va_list ap;
+ va_start(ap, fmt);
+ vsnprintf(out, sizeof(out), fmt, ap);
+ va_end(ap);
+ return YAHOO_CALLBACK(ext_yahoo_log)("%s", out);
+}
+
+int yahoo_connect(char * host, int port, int type)
+{
+ return YAHOO_CALLBACK(ext_yahoo_connect)(host, port, type);
+}
+
+static enum yahoo_log_level log_level = YAHOO_LOG_NONE;
+
+enum yahoo_log_level yahoo_get_log_level()
+{
+ return log_level;
+}
+
+int yahoo_set_log_level(enum yahoo_log_level level)
+{
+ enum yahoo_log_level l = log_level;
+ log_level = level;
+ return l;
+}
+
+/* default values for servers */
+static char pager_host[] = "scs.msg.yahoo.com";
+static int pager_port = 5050;
+static int fallback_ports[]={23, 25, 80, 20, 119, 8001, 8002, 5050, 0};
+static char filetransfer_host[]="filetransfer.msg.yahoo.com";
+static int filetransfer_port=80;
+static char webcam_host[]="webcam.yahoo.com";
+static int webcam_port=5100;
+static char webcam_description[]="";
+static char local_host[]="";
+static int conn_type=Y_WCM_DSL;
+
+static char profile_url[] = "http://profiles.yahoo.com/";
+
+enum yahoo_service { /* these are easier to see in hex */
+ YAHOO_SERVICE_LOGON = 1,
+ YAHOO_SERVICE_LOGOFF,
+ YAHOO_SERVICE_ISAWAY,
+ YAHOO_SERVICE_ISBACK,
+ YAHOO_SERVICE_IDLE, /* 5 (placemarker) */
+ YAHOO_SERVICE_MESSAGE,
+ YAHOO_SERVICE_IDACT,
+ YAHOO_SERVICE_IDDEACT,
+ YAHOO_SERVICE_MAILSTAT,
+ YAHOO_SERVICE_USERSTAT, /* 0xa */
+ YAHOO_SERVICE_NEWMAIL,
+ YAHOO_SERVICE_CHATINVITE,
+ YAHOO_SERVICE_CALENDAR,
+ YAHOO_SERVICE_NEWPERSONALMAIL,
+ YAHOO_SERVICE_NEWCONTACT,
+ YAHOO_SERVICE_ADDIDENT, /* 0x10 */
+ YAHOO_SERVICE_ADDIGNORE,
+ YAHOO_SERVICE_PING,
+ YAHOO_SERVICE_GOTGROUPRENAME, /* < 1, 36(old), 37(new) */
+ YAHOO_SERVICE_SYSMESSAGE = 0x14,
+ YAHOO_SERVICE_SKINNAME = 0x15,
+ YAHOO_SERVICE_PASSTHROUGH2 = 0x16,
+ YAHOO_SERVICE_CONFINVITE = 0x18,
+ YAHOO_SERVICE_CONFLOGON,
+ YAHOO_SERVICE_CONFDECLINE,
+ YAHOO_SERVICE_CONFLOGOFF,
+ YAHOO_SERVICE_CONFADDINVITE,
+ YAHOO_SERVICE_CONFMSG,
+ YAHOO_SERVICE_CHATLOGON,
+ YAHOO_SERVICE_CHATLOGOFF,
+ YAHOO_SERVICE_CHATMSG = 0x20,
+ YAHOO_SERVICE_GAMELOGON = 0x28,
+ YAHOO_SERVICE_GAMELOGOFF,
+ YAHOO_SERVICE_GAMEMSG = 0x2a,
+ YAHOO_SERVICE_FILETRANSFER = 0x46,
+ YAHOO_SERVICE_VOICECHAT = 0x4A,
+ YAHOO_SERVICE_NOTIFY,
+ YAHOO_SERVICE_VERIFY,
+ YAHOO_SERVICE_P2PFILEXFER,
+ YAHOO_SERVICE_PEERTOPEER = 0x4F, /* Checks if P2P possible */
+ YAHOO_SERVICE_WEBCAM,
+ YAHOO_SERVICE_AUTHRESP = 0x54,
+ YAHOO_SERVICE_LIST,
+ YAHOO_SERVICE_AUTH = 0x57,
+ YAHOO_SERVICE_ADDBUDDY = 0x83,
+ YAHOO_SERVICE_REMBUDDY,
+ YAHOO_SERVICE_IGNORECONTACT, /* > 1, 7, 13 < 1, 66, 13, 0*/
+ YAHOO_SERVICE_REJECTCONTACT,
+ YAHOO_SERVICE_GROUPRENAME = 0x89, /* > 1, 65(new), 66(0), 67(old) */
+ /* YAHOO_SERVICE_??? = 0x8A, ?? 0 - id and that's it?? */
+ YAHOO_SERVICE_CHATONLINE = 0x96, /* > 109(id), 1, 6(abcde) < 0,1*/
+ YAHOO_SERVICE_CHATGOTO,
+ YAHOO_SERVICE_CHATJOIN, /* > 1 104-room 129-1600326591 62-2 */
+ YAHOO_SERVICE_CHATLEAVE,
+ YAHOO_SERVICE_CHATEXIT = 0x9b,
+ YAHOO_SERVICE_CHATADDINVITE = 0x9d,
+ YAHOO_SERVICE_CHATLOGOUT = 0xa0,
+ YAHOO_SERVICE_CHATPING,
+ YAHOO_SERVICE_COMMENT = 0xa8,
+ YAHOO_SERVICE_GAME_INVITE = 0xb7,
+ YAHOO_SERVICE_STEALTH_PERM = 0xb9,
+ YAHOO_SERVICE_STEALTH_SESSION = 0xba,
+ YAHOO_SERVICE_AVATAR = 0xbc,
+ YAHOO_SERVICE_PICTURE_CHECKSUM = 0xbd,
+ YAHOO_SERVICE_PICTURE = 0xbe,
+ YAHOO_SERVICE_PICTURE_UPDATE = 0xc1,
+ YAHOO_SERVICE_PICTURE_UPLOAD = 0xc2,
+ YAHOO_SERVICE_YAB_UPDATE = 0xc4,
+ YAHOO_SERVICE_Y6_VISIBLE_TOGGLE = 0xc5, /* YMSG13, key 13: 2 = invisible, 1 = visible */
+ YAHOO_SERVICE_Y6_STATUS_UPDATE = 0xc6, /* YMSG13 */
+ /* Kopete Calls YAHOO_SERVICE_AVATAR_UPDATE = ServicePictureStatus ? */
+ YAHOO_SERVICE_AVATAR_UPDATE = 0xc7, /* YMSG13, key 213: 0 = none, 1 = avatar, 2 = picture */
+ YAHOO_SERVICE_VERIFY_ID_EXISTS = 0xc8,
+ YAHOO_SERVICE_AUDIBLE = 0xd0,
+ YAHOO_SERVICE_Y7_PHOTO_SHARING = 0xd2,
+ YAHOO_SERVICE_Y7_CONTACT_DETAILS = 0xd3, /* YMSG13 */
+ YAHOO_SERVICE_Y7_CHAT_SESSION = 0xd4,
+ YAHOO_SERVICE_Y7_AUTHORIZATION = 0xd6, /* YMSG13 */
+ YAHOO_SERVICE_Y7_FILETRANSFER = 0xdc, /* YMSG13 */
+ YAHOO_SERVICE_Y7_FILETRANSFERINFO, /* YMSG13 */
+ YAHOO_SERVICE_Y7_FILETRANSFERACCEPT, /* YMSG13 */
+ YAHOO_SERVICE_Y7_CHANGE_GROUP = 0xe7, /* YMSG13 */
+ YAHOO_SERVICE_WEBLOGIN = 0x0226,
+ YAHOO_SERVICE_SMS_MSG = 0x02ea
+};
+
+typedef struct {
+ int key;
+ char *name;
+}value_string;
+
+static const value_string ymsg_service_vals[] = {
+ {YAHOO_SERVICE_LOGON, "Pager Logon"},
+ {YAHOO_SERVICE_LOGOFF, "Pager Logoff"},
+ {YAHOO_SERVICE_ISAWAY, "Is Away"},
+ {YAHOO_SERVICE_ISBACK, "Is Back"},
+ {YAHOO_SERVICE_IDLE, "Idle"},
+ {YAHOO_SERVICE_MESSAGE, "Message"},
+ {YAHOO_SERVICE_IDACT, "Activate Identity"},
+ {YAHOO_SERVICE_IDDEACT, "Deactivate Identity"},
+ {YAHOO_SERVICE_MAILSTAT, "Mail Status"},
+ {YAHOO_SERVICE_USERSTAT, "User Status"},
+ {YAHOO_SERVICE_NEWMAIL, "New Mail"},
+ {YAHOO_SERVICE_CHATINVITE, "Chat Invitation"},
+ {YAHOO_SERVICE_CALENDAR, "Calendar Reminder"},
+ {YAHOO_SERVICE_NEWPERSONALMAIL, "New Personals Mail"},
+ {YAHOO_SERVICE_NEWCONTACT, "New Friend"},
+ {YAHOO_SERVICE_ADDIDENT, "Add Identity"},
+ {YAHOO_SERVICE_ADDIGNORE, "Add Ignore"},
+ {YAHOO_SERVICE_PING, "Ping"},
+ {YAHOO_SERVICE_GOTGROUPRENAME, "YAHOO_SERVICE_GOTGROUPRENAME"},
+ {YAHOO_SERVICE_SYSMESSAGE, "System Message"},
+ {YAHOO_SERVICE_PASSTHROUGH2, "Passthrough 2"},
+ {YAHOO_SERVICE_CONFINVITE, "Conference Invitation"},
+ {YAHOO_SERVICE_CONFLOGON, "Conference Logon"},
+ {YAHOO_SERVICE_CONFDECLINE, "Conference Decline"},
+ {YAHOO_SERVICE_CONFLOGOFF, "Conference Logoff"},
+ {YAHOO_SERVICE_CONFADDINVITE, "Conference Additional Invitation"},
+ {YAHOO_SERVICE_CONFMSG, "Conference Message"},
+ {YAHOO_SERVICE_CHATLOGON, "Chat Logon"},
+ {YAHOO_SERVICE_CHATLOGOFF, "Chat Logoff"},
+ {YAHOO_SERVICE_CHATMSG, "Chat Message"},
+ {YAHOO_SERVICE_GAMELOGON, "Game Logon"},
+ {YAHOO_SERVICE_GAMELOGOFF, "Game Logoff"},
+ {YAHOO_SERVICE_GAMEMSG, "Game Message"},
+ {YAHOO_SERVICE_FILETRANSFER, "File Transfer"},
+ {YAHOO_SERVICE_VOICECHAT, "Voice Chat"},
+ {YAHOO_SERVICE_NOTIFY, "YAHOO_SERVICE_NOTIFY"},
+ {YAHOO_SERVICE_VERIFY, "YAHOO_SERVICE_VERIFY"},
+ {YAHOO_SERVICE_P2PFILEXFER, "YAHOO_SERVICE_P2PFILEXFER"},
+ {YAHOO_SERVICE_PEERTOPEER, "YAHOO_SERVICE_PEERTOPEER"},
+ {YAHOO_SERVICE_AUTHRESP, "YAHOO_SERVICE_AUTHRESP"},
+ {YAHOO_SERVICE_LIST, "YAHOO_SERVICE_LIST"},
+ {YAHOO_SERVICE_AUTH, "YAHOO_SERVICE_AUTH"},
+ {YAHOO_SERVICE_ADDBUDDY, "YAHOO_SERVICE_ADDBUDDY"},
+ {YAHOO_SERVICE_REMBUDDY, "YAHOO_SERVICE_REMBUDDY"},
+ {YAHOO_SERVICE_IGNORECONTACT, "YAHOO_SERVICE_IGNORECONTACT"},
+ {YAHOO_SERVICE_REJECTCONTACT, "YAHOO_SERVICE_REJECTCONTACT"},
+ {YAHOO_SERVICE_GROUPRENAME, "Group Renamed"},
+ {YAHOO_SERVICE_CHATONLINE, "YAHOO_SERVICE_CHATONLINE"},
+ {YAHOO_SERVICE_CHATGOTO, "YAHOO_SERVICE_CHATGOTO"},
+ {YAHOO_SERVICE_CHATJOIN, "YAHOO_SERVICE_CHATJOIN"},
+ {YAHOO_SERVICE_CHATLEAVE, "YAHOO_SERVICE_CHATLEAVE"},
+ {YAHOO_SERVICE_CHATEXIT, "YAHOO_SERVICE_CHATEXIT"},
+ {YAHOO_SERVICE_CHATLOGOUT, "YAHOO_SERVICE_CHATLOGOUT"},
+ {YAHOO_SERVICE_CHATPING, "YAHOO_SERVICE_CHATPING"},
+ {YAHOO_SERVICE_COMMENT, "YAHOO_SERVICE_COMMENT"},
+ {YAHOO_SERVICE_GAME_INVITE,"YAHOO_SERVICE_GAME_INVITE "},
+ {YAHOO_SERVICE_STEALTH_PERM, "YAHOO_SERVICE_STEALTH_PERM"},
+ {YAHOO_SERVICE_STEALTH_SESSION, "YAHOO_SERVICE_STEALTH_SESSION"},
+ {YAHOO_SERVICE_AVATAR,"YAHOO_SERVICE_AVATAR"},
+ {YAHOO_SERVICE_PICTURE_CHECKSUM,"YAHOO_SERVICE_PICTURE_CHECKSUM"},
+ {YAHOO_SERVICE_PICTURE,"YAHOO_SERVICE_PICTURE"},
+ {YAHOO_SERVICE_YAB_UPDATE,"YAHOO_SERVICE_YAB_UPDATE"},
+ {YAHOO_SERVICE_PICTURE_UPDATE,"YAHOO_SERVICE_PICTURE_UPDATE"},
+ {YAHOO_SERVICE_PICTURE_UPLOAD,"YAHOO_SERVICE_PICTURE_UPLOAD"},
+ {YAHOO_SERVICE_Y6_VISIBLE_TOGGLE, "YAHOO_SERVICE_Y6_VISIBLE_TOGGLE"},
+ {YAHOO_SERVICE_Y6_STATUS_UPDATE,"YAHOO_SERVICE_Y6_STATUS_UPDATE"},
+ {YAHOO_SERVICE_AVATAR_UPDATE,"YAHOO_SERVICE_AVATAR_UPDATE"},
+ {YAHOO_SERVICE_AUDIBLE,"YAHOO_SERVICE_AUDIBLE"},
+ {YAHOO_SERVICE_Y7_CONTACT_DETAILS,"YAHOO_SERVICE_Y7_CONTACT_DETAILS"},
+ {YAHOO_SERVICE_Y7_CHAT_SESSION, "YAHOO_SERVICE_Y7_CHAT_SESSION"},
+ {YAHOO_SERVICE_Y7_AUTHORIZATION,"YAHOO_SERVICE_Y7_AUTHORIZATION"},
+ {YAHOO_SERVICE_Y7_FILETRANSFER,"YAHOO_SERVICE_Y7_FILETRANSFER"},
+ {YAHOO_SERVICE_Y7_FILETRANSFERINFO,"YAHOO_SERVICE_Y7_FILETRANSFERINFO"},
+ {YAHOO_SERVICE_Y7_FILETRANSFERACCEPT,"YAHOO_SERVICE_Y7_FILETRANSFERACCEPT"},
+ {YAHOO_SERVICE_Y7_CHANGE_GROUP, "YAHOO_SERVICE_Y7_CHANGE_GROUP"},
+ {YAHOO_SERVICE_WEBLOGIN,"YAHOO_SERVICE_WEBLOGIN"},
+ {YAHOO_SERVICE_SMS_MSG,"YAHOO_SERVICE_SMS_MSG"},
+ {0, NULL}
+};
+
+static const value_string ymsg_status_vals[] = {
+ {YAHOO_STATUS_DISCONNECTED, "YAHOO_STATUS_DISCONNECTED"},
+ {YAHOO_STATUS_AVAILABLE, "YAHOO_STATUS_AVAILABLE"},
+ {YAHOO_STATUS_BRB, "YAHOO_STATUS_BRB"},
+ {YAHOO_STATUS_BUSY, "YAHOO_STATUS_BUSY"},
+ {YAHOO_STATUS_NOTATHOME, "YAHOO_STATUS_NOTATHOME"},
+ {YAHOO_STATUS_NOTATDESK, "YAHOO_STATUS_NOTATDESK"},
+ {YAHOO_STATUS_NOTINOFFICE, "YAHOO_STATUS_NOTINOFFICE"},
+ {YAHOO_STATUS_ONPHONE, "YAHOO_STATUS_ONPHONE"},
+ {YAHOO_STATUS_ONVACATION, "YAHOO_STATUS_ONVACATION"},
+ {YAHOO_STATUS_OUTTOLUNCH, "YAHOO_STATUS_OUTTOLUNCH"},
+ {YAHOO_STATUS_STEPPEDOUT, "YAHOO_STATUS_STEPPEDOUT"},
+ {YAHOO_STATUS_INVISIBLE, "YAHOO_STATUS_INVISIBLE"},
+ {YAHOO_STATUS_CUSTOM, "YAHOO_STATUS_CUSTOM"},
+ {YAHOO_STATUS_IDLE, "YAHOO_STATUS_IDLE"},
+ {YAHOO_STATUS_OFFLINE, "YAHOO_STATUS_OFFLINE"},
+ {YAHOO_STATUS_NOTIFY, "YAHOO_STATUS_NOTIFY"},
+ {YAHOO_STATUS_WEBLOGIN, "YAHOO_STATUS_WEBLOGIN"},
+ {0, NULL}
+};
+
+static const value_string packet_keys[]={
+ { 0, "identity" },
+ { 1, "ID" },
+ { 2, "id?" },
+ { 3, "my id"},
+ { 4, "ID/Nick"},
+ { 5, "To"},
+ { 6, "auth token 1"},
+ { 7, "Buddy" },
+ { 8, "# buddies"},
+ { 9, "# mails"},
+ { 10, "state"},
+ { 11, "session"},
+ { 12, "reverse ip? [gaim]"},
+ { 13, "stat/location"}, // bitnask: 0 = pager, 1 = chat, 2 = game
+ { 14, "ind/msg"},
+ { 15, "time"},
+ { 16, "Error msg"},
+ { 17, "chat"},
+ { 18, "subject/topic?"},
+ { 19, "custom msg"},
+ { 20, "url"},
+ { 24, "session timestamp"},
+ { 27, "filename"},
+ { 28, "filesize"},
+ { 31, "visibility?"},
+ { 38, "expires"},
+ { 42, "email"},
+ { 43, "email who"},
+ { 47, "away"},
+ { 49, "service"},
+ { 50, "conf host"},
+ { 52, "conf invite"},
+ { 53, "conf logon"},
+ { 54, "conf decline"},
+ { 55, "conf unavail"},
+ { 56, "conf logoff"},
+ { 57, "conf room"},
+ { 58, "conf joinmsg"},
+ { 59, "cookies"},
+ { 60, "SMS/Mobile"},
+ { 61, "Cookie?"},
+ { 63, "imvironment name;num"},
+ { 64, "imvironment enabled/avail"},
+ { 65, "group"},
+ { 66, "login status"},
+ { 73, "user name"},
+ { 87, "buds/groups"},
+ { 88, "ignore list"},
+ { 89, "identities"},
+ { 94, "auth seed"},
+ { 96, "auth token 2"},
+ { 97, "utf8"},
+ {104, "room name"},
+ {105, "chat topic"},
+ {108, "chat nbuddies"},
+ {109, "chat from"},
+ {110, "chat age"},
+ {113, "chat attrs"},
+ {117, "chat msg"},
+ {124, "chat msg type"},
+ {128, "chat room category?"},
+ {129, "chat room serial 2"},
+ {130, "first join/chat room cookie"},
+ {135, "YIM version"},
+ {137, "idle time"},
+ {138, "idle?"},
+ {142, "chat location"},
+ {185, "stealth/hide?"},
+ {192, "Pictures/Buddy Icons"},
+ {197, "Avatars"},
+ {203, "YAB data?"},
+ {206, "display image type"},
+ {213, "share avatar type"},
+ {216, "first name"},
+ {219, "cookie separator?"},
+ {222, "FT7 Service"},
+ {223, "authorized?"},
+ {230, "the audible, in foo.bar.baz format"},
+ {231, "audible text"},
+ {232, "weird number (md5 hash?) [audible]"},
+ {244, "YIM6/YIM7 detection.(278527 - YIM6, 524223 - YIM7)"},
+ {254, "last name"},
+ {265, "FT7 Token"},
+ {1002, "YIM6+"},
+ {10093, "YIM7 (sets it to 4)"},
+ {10097, "Region (SMS?)"},
+ { -1, "" }
+};
+
+const char *dbg_key(int key)
+{
+ int i=0;
+
+ while ((packet_keys[i].key >=0) && (packet_keys[i].key != key) )
+ i++;
+
+ if (packet_keys[i].key != key)
+ return NULL;
+ else
+ return packet_keys[i].name;
+}
+
+const char *dbg_service(int key)
+{
+ int i=0;
+
+ while ((ymsg_service_vals[i].key > 0) && (ymsg_service_vals[i].key != key) )
+ i++;
+
+ if (ymsg_service_vals[i].key != key)
+ return NULL;
+ else
+ return ymsg_service_vals[i].name;
+}
+
+const char *dbg_status(int key)
+{
+ int i;
+
+ for (i = 0; ymsg_status_vals[i].name != NULL; i++ ) {
+ if (ymsg_status_vals[i].key == key)
+ return ymsg_status_vals[i].name;
+ }
+
+ return NULL;
+}
+
+struct yahoo_pair {
+ int key;
+ char *value;
+};
+
+struct yahoo_packet {
+ unsigned short int service;
+ unsigned int status;
+ unsigned int id;
+ YList *hash;
+};
+
+struct yahoo_search_state {
+ int lsearch_type;
+ char *lsearch_text;
+ int lsearch_gender;
+ int lsearch_agerange;
+ int lsearch_photo;
+ int lsearch_yahoo_only;
+ int lsearch_nstart;
+ int lsearch_nfound;
+ int lsearch_ntotal;
+};
+
+struct data_queue {
+ unsigned char *queue;
+ int len;
+};
+
+struct yahoo_input_data {
+ struct yahoo_data *yd;
+ struct yahoo_webcam *wcm;
+ struct yahoo_webcam_data *wcd;
+ struct yahoo_search_state *ys;
+
+ int fd;
+ enum yahoo_connection_type type;
+
+ unsigned char *rxqueue;
+ int rxlen;
+ int read_tag;
+
+ YList *txqueues;
+ int write_tag;
+};
+
+struct yahoo_server_settings {
+ char *pager_host;
+ int pager_port;
+ char *filetransfer_host;
+ int filetransfer_port;
+ char *webcam_host;
+ int webcam_port;
+ char *webcam_description;
+ char *local_host;
+ int conn_type;
+ int pic_cksum;
+ int web_messenger;
+};
+
+static void * _yahoo_default_server_settings()
+{
+ struct yahoo_server_settings *yss = y_new0(struct yahoo_server_settings, 1);
+
+ yss->pager_host = strdup(pager_host);
+ yss->pager_port = pager_port;
+ yss->filetransfer_host = strdup(filetransfer_host);
+ yss->filetransfer_port = filetransfer_port;
+ yss->webcam_host = strdup(webcam_host);
+ yss->webcam_port = webcam_port;
+ yss->webcam_description = strdup(webcam_description);
+ yss->local_host = strdup(local_host);
+ yss->conn_type = conn_type;
+ yss->pic_cksum = -1;
+
+ return yss;
+}
+
+static void * _yahoo_assign_server_settings(va_list ap)
+{
+ struct yahoo_server_settings *yss = _yahoo_default_server_settings();
+ char *key;
+ char *svalue;
+ int nvalue;
+
+ while(1) {
+ key = va_arg(ap, char *);
+ if(key == NULL)
+ break;
+
+ if(!strcmp(key, "pager_host")) {
+ svalue = va_arg(ap, char *);
+ free(yss->pager_host);
+ yss->pager_host = strdup(svalue);
+ } else if(!strcmp(key, "pager_port")) {
+ nvalue = va_arg(ap, int);
+ yss->pager_port = nvalue;
+ } else if(!strcmp(key, "filetransfer_host")) {
+ svalue = va_arg(ap, char *);
+ free(yss->filetransfer_host);
+ yss->filetransfer_host = strdup(svalue);
+ } else if(!strcmp(key, "filetransfer_port")) {
+ nvalue = va_arg(ap, int);
+ yss->filetransfer_port = nvalue;
+ } else if(!strcmp(key, "webcam_host")) {
+ svalue = va_arg(ap, char *);
+ free(yss->webcam_host);
+ yss->webcam_host = strdup(svalue);
+ } else if(!strcmp(key, "webcam_port")) {
+ nvalue = va_arg(ap, int);
+ yss->webcam_port = nvalue;
+ } else if(!strcmp(key, "webcam_description")) {
+ svalue = va_arg(ap, char *);
+ free(yss->webcam_description);
+ yss->webcam_description = strdup(svalue);
+ } else if(!strcmp(key, "local_host")) {
+ svalue = va_arg(ap, char *);
+ free(yss->local_host);
+ yss->local_host = strdup(svalue);
+ } else if(!strcmp(key, "conn_type")) {
+ nvalue = va_arg(ap, int);
+ yss->conn_type = nvalue;
+ } else if(!strcmp(key, "picture_checksum")) {
+ nvalue = va_arg(ap, int);
+ yss->pic_cksum = nvalue;
+ } else if(!strcmp(key, "web_messenger")) {
+ nvalue = va_arg(ap, int);
+ yss->web_messenger = nvalue;
+ } else {
+ WARNING(("Unknown key passed to yahoo_init, "
+ "perhaps you didn't terminate the list "
+ "with NULL"));
+ }
+ }
+
+ return yss;
+}
+
+static void yahoo_free_server_settings(struct yahoo_server_settings *yss)
+{
+ if(!yss)
+ return;
+
+ free(yss->pager_host);
+ free(yss->filetransfer_host);
+ free(yss->webcam_host);
+ free(yss->webcam_description);
+ free(yss->local_host);
+
+ free(yss);
+}
+
+static YList *conns=NULL;
+static YList *inputs=NULL;
+static int last_id=0;
+
+static void add_to_list(struct yahoo_data *yd)
+{
+ conns = y_list_prepend(conns, yd);
+}
+static struct yahoo_data * find_conn_by_id(int id)
+{
+ YList *l;
+ for(l = conns; l; l = y_list_next(l)) {
+ struct yahoo_data *yd = l->data;
+ if(yd->client_id == id)
+ return yd;
+ }
+ return NULL;
+}
+static void del_from_list(struct yahoo_data *yd)
+{
+ conns = y_list_remove(conns, yd);
+}
+
+/* call repeatedly to get the next one */
+/*
+static struct yahoo_input_data * find_input_by_id(int id)
+{
+ YList *l;
+ for(l = inputs; l; l = y_list_next(l)) {
+ struct yahoo_input_data *yid = l->data;
+ if(yid->yd->client_id == id)
+ return yid;
+ }
+ return NULL;
+}
+*/
+
+static struct yahoo_input_data * find_input_by_id_and_webcam_user(int id, const char * who)
+{
+ YList *l;
+ LOG(("find_input_by_id_and_webcam_user"));
+ for(l = inputs; l; l = y_list_next(l)) {
+ struct yahoo_input_data *yid = l->data;
+ if(yid->type == YAHOO_CONNECTION_WEBCAM && yid->yd->client_id == id
+ && yid->wcm &&
+ ((who && yid->wcm->user && !strcmp(who, yid->wcm->user)) ||
+ !(yid->wcm->user && !who)))
+ return yid;
+ }
+ return NULL;
+}
+
+static struct yahoo_input_data * find_input_by_id_and_type(int id, enum yahoo_connection_type type)
+{
+ YList *l;
+ LOG(("[find_input_by_id_and_type] id: %d, type: %d", id, type));
+ for(l = inputs; l; l = y_list_next(l)) {
+ struct yahoo_input_data *yid = l->data;
+ if(yid->type == type && yid->yd->client_id == id) {
+ LOG(("[find_input_by_id_and_type] Got it!!!"));
+ return yid;
+ }
+ }
+ return NULL;
+}
+
+static struct yahoo_input_data * find_input_by_id_and_fd(int id, int fd)
+{
+ YList *l;
+ LOG(("find_input_by_id_and_fd"));
+ for(l = inputs; l; l = y_list_next(l)) {
+ struct yahoo_input_data *yid = l->data;
+ if(yid->fd == fd && yid->yd->client_id == id)
+ return yid;
+ }
+ return NULL;
+}
+
+static int count_inputs_with_id(int id)
+{
+ int c=0;
+ YList *l;
+ LOG(("counting %d", id));
+ for(l = inputs; l; l = y_list_next(l)) {
+ struct yahoo_input_data *yid = l->data;
+ if(yid->yd->client_id == id)
+ c++;
+ }
+ LOG(("%d", c));
+ return c;
+}
+
+
+extern char *yahoo_crypt(char *, char *);
+
+/* Free a buddy list */
+static void yahoo_free_buddies(YList * list)
+{
+ YList *l;
+
+ for(l = list; l; l = l->next)
+ {
+ struct yahoo_buddy *bud = l->data;
+ if(!bud)
+ continue;
+
+ FREE(bud->group);
+ FREE(bud->id);
+ FREE(bud->real_name);
+ if(bud->yab_entry) {
+ FREE(bud->yab_entry->fname);
+ FREE(bud->yab_entry->lname);
+ FREE(bud->yab_entry->nname);
+ FREE(bud->yab_entry->id);
+ FREE(bud->yab_entry->email);
+ FREE(bud->yab_entry->hphone);
+ FREE(bud->yab_entry->wphone);
+ FREE(bud->yab_entry->mphone);
+ FREE(bud->yab_entry);
+ }
+ FREE(bud);
+ l->data = bud = NULL;
+ }
+
+ y_list_free(list);
+}
+
+/* Free an identities list */
+static void yahoo_free_identities(YList * list)
+{
+ while (list) {
+ YList *n = list;
+ FREE(list->data);
+ list = y_list_remove_link(list, list);
+ y_list_free_1(n);
+ }
+}
+
+/* Free webcam data */
+static void yahoo_free_webcam(struct yahoo_webcam *wcm)
+{
+ if (wcm) {
+ FREE(wcm->user);
+ FREE(wcm->server);
+ FREE(wcm->key);
+ FREE(wcm->description);
+ FREE(wcm->my_ip);
+ }
+ FREE(wcm);
+}
+
+static void yahoo_free_data(struct yahoo_data *yd)
+{
+ FREE(yd->user);
+ FREE(yd->password);
+ FREE(yd->cookie_y);
+ FREE(yd->cookie_t);
+ FREE(yd->cookie_c);
+ FREE(yd->login_cookie);
+ FREE(yd->login_id);
+ FREE(yd->rawstealthlist);
+
+ yahoo_free_buddies(yd->buddies);
+ yahoo_free_buddies(yd->ignore);
+ yahoo_free_identities(yd->identities);
+
+ yahoo_free_server_settings(yd->server_settings);
+
+ FREE(yd);
+}
+
+#define YAHOO_PACKET_HDRLEN (4 + 2 + 2 + 2 + 2 + 4 + 4)
+
+static struct yahoo_packet *yahoo_packet_new(enum yahoo_service service,
+ enum yahoo_status status, int id)
+{
+ struct yahoo_packet *pkt = y_new0(struct yahoo_packet, 1);
+
+ pkt->service = service;
+ pkt->status = status;
+ pkt->id = id;
+
+ return pkt;
+}
+
+static void yahoo_packet_hash(struct yahoo_packet *pkt, int key, const char *value)
+{
+ struct yahoo_pair *pair = y_new0(struct yahoo_pair, 1);
+ pair->key = key;
+ pair->value = strdup(value);
+ pkt->hash = y_list_append(pkt->hash, pair);
+}
+
+static int yahoo_packet_length(struct yahoo_packet *pkt)
+{
+ YList *l;
+
+ int len = 0;
+
+ for (l = pkt->hash; l; l = l->next) {
+ struct yahoo_pair *pair = l->data;
+ int tmp = pair->key;
+ do {
+ tmp /= 10;
+ len++;
+ } while (tmp);
+ len += 2;
+ len += strlen(pair->value);
+ len += 2;
+ }
+
+ return len;
+}
+
+#define yahoo_put16(buf, data) ( \
+ (*(buf) = (unsigned char)((data)>>8)&0xff), \
+ (*((buf)+1) = (unsigned char)(data)&0xff), \
+ 2)
+#define yahoo_get16(buf) ((((*(buf))&0xff)<<8) + ((*((buf)+1)) & 0xff))
+#define yahoo_put32(buf, data) ( \
+ (*((buf)) = (unsigned char)((data)>>24)&0xff), \
+ (*((buf)+1) = (unsigned char)((data)>>16)&0xff), \
+ (*((buf)+2) = (unsigned char)((data)>>8)&0xff), \
+ (*((buf)+3) = (unsigned char)(data)&0xff), \
+ 4)
+#define yahoo_get32(buf) ((((*(buf) )&0xff)<<24) + \
+ (((*((buf)+1))&0xff)<<16) + \
+ (((*((buf)+2))&0xff)<< 8) + \
+ (((*((buf)+3))&0xff)))
+
+static void yahoo_packet_read(struct yahoo_packet *pkt, unsigned char *data, int len)
+{
+ int pos = 0;
+
+ DEBUG_MSG(("[Reading packet] len: %d", len));
+ while (pos + 1 < len) {
+ char *key, *value = NULL;
+ int accept;
+ int x;
+
+ struct yahoo_pair *pair = y_new0(struct yahoo_pair, 1);
+
+ key = malloc(len + 1);
+ x = 0;
+ while (pos + 1 < len) {
+ if (data[pos] == 0xc0 && data[pos + 1] == 0x80)
+ break;
+ key[x++] = data[pos++];
+ }
+ key[x] = 0;
+ pos += 2;
+ pair->key = strtol(key, NULL, 10);
+ free(key);
+
+ accept = x;
+ /* if x is 0 there was no key, so don't accept it */
+ if (accept)
+ value = malloc(len - pos + 1);
+ x = 0;
+ while (pos + 1 < len) {
+ if (data[pos] == 0xc0 && data[pos + 1] == 0x80)
+ break;
+ if (accept)
+ value[x++] = data[pos++];
+ }
+ if (accept)
+ value[x] = 0;
+ pos += 2;
+ if (accept) {
+ pair->value = strdup(value);
+ FREE(value);
+ pkt->hash = y_list_append(pkt->hash, pair);
+
+ DEBUG_MSG1(("Key: %s (%d) \tValue: '%s'", dbg_key(pair->key), pair->key, pair->value));
+ } else {
+ FREE(pair);
+ }
+ }
+
+ DEBUG_MSG(("[Reading packet done]"));
+}
+
+static void yahoo_packet_write(struct yahoo_packet *pkt, unsigned char *data)
+{
+ YList *l;
+ int pos = 0;
+
+ for (l = pkt->hash; l; l = l->next) {
+ struct yahoo_pair *pair = l->data;
+ unsigned char buf[100];
+
+ snprintf((char *)buf, sizeof(buf), "%d", pair->key);
+ strcpy((char *)data + pos, (char *)buf);
+ pos += strlen((char *)buf);
+ data[pos++] = 0xc0;
+ data[pos++] = 0x80;
+
+ strcpy((char *)data + pos, pair->value);
+ pos += strlen(pair->value);
+ data[pos++] = 0xc0;
+ data[pos++] = 0x80;
+ }
+}
+
+static void yahoo_dump_unhandled(struct yahoo_packet *pkt)
+{
+ YList *l;
+
+ NOTICE(("Service: %s (0x%02x)\tStatus: %s (%d)", dbg_service(pkt->service),pkt->service, dbg_status(pkt->status), pkt->status));
+ for (l = pkt->hash; l; l = l->next) {
+ struct yahoo_pair *pair = l->data;
+ NOTICE(("\t%d => %s", pair->key, pair->value));
+ }
+}
+
+
+static void yahoo_packet_dump(unsigned char *data, int len)
+{
+ if(yahoo_get_log_level() >= YAHOO_LOG_DEBUG) {
+ char z[4096], t[10];
+ int i;
+
+ z[0]='\0';
+
+ for (i = 0; i < len; i++) {
+ if ((i % 8 == 0) && i)
+ //YAHOO_CALLBACK(ext_yahoo_log)(" ");
+ lstrcat(z, " ");
+ if ((i % 16 == 0) && i)
+ lstrcat(z, "\n");
+
+ wsprintf(t, "%02x ", data[i]);
+ lstrcat(z, t);
+ }
+ lstrcat(z, "\n");
+ YAHOO_CALLBACK(ext_yahoo_log)(z);
+
+ z[0]='\0';
+ for (i = 0; i < len; i++) {
+ if ((i % 8 == 0) && i)
+ //YAHOO_CALLBACK(ext_yahoo_log)(" ");
+ lstrcat(z, " ");
+ if ((i % 16 == 0) && i)
+ //YAHOO_CALLBACK(ext_yahoo_log)("\n");
+ lstrcat(z, "\n");
+ if (isprint(data[i])) {
+ //YAHOO_CALLBACK(ext_yahoo_log)(" %c ", data[i]);
+ wsprintf(t, " %c ", data[i]);
+ lstrcat(z, t);
+ } else
+ //YAHOO_CALLBACK(ext_yahoo_log)(" . ");
+ lstrcat(z, " . ");
+ }
+ //YAHOO_CALLBACK(ext_yahoo_log)("\n");
+ lstrcat(z, "\n");
+ YAHOO_CALLBACK(ext_yahoo_log)(z);
+ }
+}
+
+static char base64digits[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
+ "abcdefghijklmnopqrstuvwxyz"
+ "0123456789._";
+static void to_y64(unsigned char *out, const unsigned char *in, int inlen)
+/* raw bytes in quasi-big-endian order to base 64 string (NUL-terminated) */
+{
+ for (; inlen >= 3; inlen -= 3)
+ {
+ *out++ = base64digits[in[0] >> 2];
+ *out++ = base64digits[((in[0]<<4) & 0x30) | (in[1]>>4)];
+ *out++ = base64digits[((in[1]<<2) & 0x3c) | (in[2]>>6)];
+ *out++ = base64digits[in[2] & 0x3f];
+ in += 3;
+ }
+ if (inlen > 0)
+ {
+ unsigned char fragment;
+
+ *out++ = base64digits[in[0] >> 2];
+ fragment = (in[0] << 4) & 0x30;
+ if (inlen > 1)
+ fragment |= in[1] >> 4;
+ *out++ = base64digits[fragment];
+ *out++ = (inlen < 2) ? '-'
+ : base64digits[(in[1] << 2) & 0x3c];
+ *out++ = '-';
+ }
+ *out = '\0';
+}
+
+static void yahoo_add_to_send_queue(struct yahoo_input_data *yid, void *data, int length)
+{
+ struct data_queue *tx = y_new0(struct data_queue, 1);
+ tx->queue = y_new0(unsigned char, length);
+ tx->len = length;
+ memcpy(tx->queue, data, length);
+
+ yid->txqueues = y_list_append(yid->txqueues, tx);
+
+ if(!yid->write_tag)
+ yid->write_tag=YAHOO_CALLBACK(ext_yahoo_add_handler)(yid->yd->client_id, yid->fd, YAHOO_INPUT_WRITE, yid);
+}
+
+static void yahoo_send_packet(struct yahoo_input_data *yid, struct yahoo_packet *pkt, int extra_pad)
+{
+ int pktlen = yahoo_packet_length(pkt);
+ int len = YAHOO_PACKET_HDRLEN + pktlen;
+ unsigned char *data;
+ int pos = 0;
+
+ if (yid->fd < 0)
+ return;
+
+ data = y_new0(unsigned char, len + 1);
+
+ memcpy(data + pos, "YMSG", 4); pos += 4;
+ pos += yahoo_put16(data + pos, YAHOO_PROTO_VER); /* version [latest 12 0x000c] */
+ pos += yahoo_put16(data + pos, 0x0000); /* HIWORD pkt length??? */
+ pos += yahoo_put16(data + pos, pktlen + extra_pad); /* LOWORD pkt length? */
+ pos += yahoo_put16(data + pos, pkt->service); /* service */
+ pos += yahoo_put32(data + pos, pkt->status); /* status [4bytes] */
+ pos += yahoo_put32(data + pos, pkt->id); /* session [4bytes] */
+
+ yahoo_packet_write(pkt, data + pos);
+
+ //yahoo_packet_dump(data, len);
+ DEBUG_MSG(("Sending Packet:"));
+ DEBUG_MSG(("Yahoo Service: %s (0x%02x) Status: %s (%d)", dbg_service(pkt->service), pkt->service,
+ dbg_status(pkt->status),pkt->status));
+
+ yahoo_packet_read(pkt, data + pos, len - pos);
+
+/* if( yid->type == YAHOO_CONNECTION_FT )
+ yahoo_send_data(yid->fd, data, len);
+ else
+ yahoo_add_to_send_queue(yid, data, len);
+ */
+ yahoo_send_data(yid->fd, data, len);
+
+ FREE(data);
+}
+
+static void yahoo_packet_free(struct yahoo_packet *pkt)
+{
+ while (pkt->hash) {
+ struct yahoo_pair *pair = pkt->hash->data;
+ YList *tmp;
+ FREE(pair->value);
+ FREE(pair);
+ tmp = pkt->hash;
+ pkt->hash = y_list_remove_link(pkt->hash, pkt->hash);
+ y_list_free_1(tmp);
+ }
+ FREE(pkt);
+}
+
+static int yahoo_send_data(int fd, void *data, int len)
+{
+ int ret;
+ int e;
+
+ if (fd < 0)
+ return -1;
+
+ //yahoo_packet_dump(data, len);
+
+ do {
+ ret = write(fd, data, len);
+ } while(ret == -1 && errno==EINTR);
+ e=errno;
+
+ if (ret == -1) {
+ LOG(("wrote data: ERR %s", strerror(errno)));
+ } else {
+ LOG(("wrote data: OK"));
+ }
+
+ errno=e;
+ return ret;
+}
+
+void yahoo_close(int id)
+{
+ struct yahoo_data *yd = find_conn_by_id(id);
+ if(!yd)
+ return;
+
+ del_from_list(yd);
+
+ yahoo_free_data(yd);
+ if(id == last_id)
+ last_id--;
+}
+
+static void yahoo_input_close(struct yahoo_input_data *yid)
+{
+ inputs = y_list_remove(inputs, yid);
+
+ LOG(("yahoo_input_close(read)"));
+ YAHOO_CALLBACK(ext_yahoo_remove_handler)(yid->yd->client_id, yid->read_tag);
+ LOG(("yahoo_input_close(write)"));
+ YAHOO_CALLBACK(ext_yahoo_remove_handler)(yid->yd->client_id, yid->write_tag);
+ yid->read_tag = yid->write_tag = 0;
+ if(yid->fd)
+ close(yid->fd);
+ yid->fd = 0;
+ FREE(yid->rxqueue);
+ if(count_inputs_with_id(yid->yd->client_id) == 0) {
+ LOG(("closing %d", yid->yd->client_id));
+ yahoo_close(yid->yd->client_id);
+ }
+ yahoo_free_webcam(yid->wcm);
+ if(yid->wcd)
+ FREE(yid->wcd);
+ if(yid->ys) {
+ FREE(yid->ys->lsearch_text);
+ FREE(yid->ys);
+ }
+ FREE(yid);
+}
+
+static int is_same_bud(const void * a, const void * b) {
+ const struct yahoo_buddy *subject = a;
+ const struct yahoo_buddy *object = b;
+
+ return strcmp(subject->id, object->id);
+}
+
+static YList * bud_str2list(char *rawlist)
+{
+ YList * l = NULL;
+
+ char **lines;
+ char **split;
+ char **buddies;
+ char **tmp, **bud;
+
+ lines = y_strsplit(rawlist, "\n", -1);
+ for (tmp = lines; *tmp; tmp++) {
+ struct yahoo_buddy *newbud;
+
+ split = y_strsplit(*tmp, ":", 2);
+ if (!split)
+ continue;
+ if (!split[0] || !split[1]) {
+ y_strfreev(split);
+ continue;
+ }
+ buddies = y_strsplit(split[1], ",", -1);
+
+ for (bud = buddies; bud && *bud; bud++) {
+ newbud = y_new0(struct yahoo_buddy, 1);
+ newbud->id = strdup(*bud);
+ newbud->group = strdup(split[0]);
+
+ if(y_list_find_custom(l, newbud, is_same_bud)) {
+ FREE(newbud->id);
+ FREE(newbud->group);
+ FREE(newbud);
+ continue;
+ }
+
+ newbud->real_name = NULL;
+
+ l = y_list_append(l, newbud);
+
+ NOTICE(("Added buddy %s to group %s", newbud->id, newbud->group));
+ }
+
+ y_strfreev(buddies);
+ y_strfreev(split);
+ }
+ y_strfreev(lines);
+
+ return l;
+}
+
+char * getcookie(char *rawcookie)
+{
+ char * cookie=NULL;
+ char * tmpcookie;
+ char * cookieend;
+
+ if (strlen(rawcookie) < 2)
+ return NULL;
+
+ tmpcookie = strdup(rawcookie+2);
+ cookieend = strchr(tmpcookie, ';');
+
+ if(cookieend)
+ *cookieend = '\0';
+
+ cookie = strdup(tmpcookie);
+ FREE(tmpcookie);
+ /* cookieend=NULL; not sure why this was there since the value is not preserved in the stack -dd */
+
+ return cookie;
+}
+
+static char * getlcookie(char *cookie)
+{
+ char *tmp;
+ char *tmpend;
+ char *login_cookie = NULL;
+
+ tmpend = strstr(cookie, "n=");
+ if(tmpend) {
+ tmp = strdup(tmpend+2);
+ tmpend = strchr(tmp, '&');
+ if(tmpend)
+ *tmpend='\0';
+ login_cookie = strdup(tmp);
+ FREE(tmp);
+ }
+
+ return login_cookie;
+}
+
+static void yahoo_process_notify(struct yahoo_input_data *yid, struct yahoo_packet *pkt)
+{
+ struct yahoo_data *yd = yid->yd;
+ char *msg = NULL;
+ char *from = NULL;
+ char *to = NULL;
+ int stat = 0;
+ int accept = 0;
+ char *ind = NULL;
+ YList *l;
+ for (l = pkt->hash; l; l = l->next) {
+ struct yahoo_pair *pair = l->data;
+ if (pair->key == 4)
+ from = pair->value;
+ if (pair->key == 5)
+ to = pair->value;
+ if (pair->key == 49)
+ msg = pair->value;
+ if (pair->key == 13)
+ stat = atoi(pair->value);
+ if (pair->key == 14)
+ ind = pair->value;
+ if (pair->key == 16) { /* status == -1 */
+ NOTICE((pair->value));
+ return;
+ }
+
+ }
+
+ if (!msg)
+ return;
+
+ if (!strncasecmp(msg, "TYPING", strlen("TYPING")))
+ YAHOO_CALLBACK(ext_yahoo_typing_notify)(yd->client_id, to, from, stat);
+ else if (!strncasecmp(msg, "GAME", strlen("GAME")))
+ YAHOO_CALLBACK(ext_yahoo_game_notify)(yd->client_id, to, from, stat, ind);
+ else if (!strncasecmp(msg, "WEBCAMINVITE", strlen("WEBCAMINVITE")))
+ {
+ if (!strcmp(ind, " ")) {
+ YAHOO_CALLBACK(ext_yahoo_webcam_invite)(yd->client_id, to, from);
+ } else {
+ accept = atoi(ind);
+ /* accept the invitation (-1 = deny 1 = accept) */
+ if (accept < 0)
+ accept = 0;
+ YAHOO_CALLBACK(ext_yahoo_webcam_invite_reply)(yd->client_id, to, from, accept);
+ }
+ }
+ else
+ LOG(("Got unknown notification: %s", msg));
+}
+
+static void yahoo_process_filetransfer(struct yahoo_input_data *yid, struct yahoo_packet *pkt)
+{
+ struct yahoo_data *yd = yid->yd;
+ char *from=NULL;
+ char *to=NULL;
+ char *msg=NULL;
+ char *url=NULL;
+ long expires=0;
+
+ char *service=NULL;
+ char *ft_token=NULL;
+ char *filename=NULL;
+ unsigned long filesize=0L;
+
+ YList *l;
+ for (l = pkt->hash; l; l = l->next) {
+ struct yahoo_pair *pair = l->data;
+ if (pair->key == 4)
+ from = pair->value;
+ if (pair->key == 5)
+ to = pair->value;
+ if (pair->key == 14)
+ msg = pair->value;
+ if (pair->key == 20)
+ url = pair->value;
+ if (pair->key == 38)
+ expires = atol(pair->value);
+
+ if (pair->key == 27)
+ filename = pair->value;
+
+ if (pair->key == 28)
+ filesize = atol(pair->value);
+
+ if (pair->key == 49)
+ service = pair->value;
+
+ if (pair->key == 53)
+ ft_token = pair->value;
+ }
+
+ if(pkt->service == YAHOO_SERVICE_P2PFILEXFER) {
+ if(strcmp("FILEXFER", service) != 0) {
+ WARNING(("unhandled service 0x%02x", pkt->service));
+ yahoo_dump_unhandled(pkt);
+ return;
+ }
+ }
+
+ if(msg) {
+ char *tmp;
+ tmp = strchr(msg, '\006');
+ if(tmp)
+ *tmp = '\0';
+ }
+ if(url && from)
+ YAHOO_CALLBACK(ext_yahoo_got_file)(yd->client_id, to, from, url, expires, msg, filename, filesize, ft_token, 0);
+ else if (strcmp(from, "FILE_TRANSFER_SYSTEM") == 0 && msg != NULL)
+ YAHOO_CALLBACK(ext_yahoo_system_message)(yd->client_id, to, from, msg);
+}
+
+static void yahoo_process_filetransfer7(struct yahoo_input_data *yid, struct yahoo_packet *pkt)
+{
+ struct yahoo_data *yd = yid->yd;
+ char *from=NULL;
+ char *to=NULL;
+ char *msg=NULL;
+ char *url=NULL;
+ long expires=0;
+
+ int service=0;
+ char *ft_token=NULL;
+ char *filename=NULL;
+ unsigned long filesize=0L;
+
+ YList *l;
+ for (l = pkt->hash; l; l = l->next) {
+ struct yahoo_pair *pair = l->data;
+ switch (pair->key) {
+ case 4:
+ from = pair->value;
+ break;
+ case 5:
+ to = pair->value;
+ break;
+ case 27:
+ filename = pair->value;
+ break;
+
+ case 28:
+ filesize = atol(pair->value);
+ break;
+
+ case 222:
+ service = atol(pair->value);
+ break;
+ case 265:
+ ft_token = pair->value;
+ break;
+ }
+ }
+
+ switch (service) {
+ case 1: // FT7
+ YAHOO_CALLBACK(ext_yahoo_got_file)(yd->client_id, to, from, url, expires, msg, filename, filesize, ft_token, 1);
+ break;
+ case 2: // FT7 Cancelled
+ break;
+ }
+}
+
+static void yahoo_process_filetransfer7info(struct yahoo_input_data *yid, struct yahoo_packet *pkt)
+{
+ struct yahoo_data *yd = yid->yd;
+ char *from=NULL;
+ char *to=NULL;
+ int service=0;
+ char *ft_token=NULL;
+ char *filename=NULL;
+ char *host = NULL;
+ char *token = NULL;
+ unsigned long filesize=0L;
+
+ YList *l;
+ for (l = pkt->hash; l; l = l->next) {
+ struct yahoo_pair *pair = l->data;
+ switch (pair->key) {
+ case 4:
+ from = pair->value;
+ break;
+ case 5:
+ to = pair->value;
+ break;
+ case 27:
+ filename = pair->value;
+ break;
+
+ case 28:
+ filesize = atol(pair->value);
+ break;
+
+ case 249:
+ service = atol(pair->value);
+ break;
+ case 250:
+ host = pair->value;
+ break;
+ case 251:
+ token = pair->value;
+ break;
+ case 265:
+ ft_token = pair->value;
+ break;
+ }
+ }
+
+ switch (service) {
+ case 1: // P2P
+ //YAHOO_CALLBACK(ext_yahoo_got_file)(yd->client_id, to, from, url, expires, msg, filename, filesize, ft_token, 1);
+ {
+ /*
+ * From Kopete: deny P2P
+ */
+ struct yahoo_packet *pkt1 = NULL;
+
+ pkt1 = yahoo_packet_new(YAHOO_SERVICE_Y7_FILETRANSFERACCEPT, YAHOO_STATUS_AVAILABLE, yd->session_id);
+ yahoo_packet_hash(pkt1, 1, yd->user);
+ yahoo_packet_hash(pkt1, 5, from);
+ yahoo_packet_hash(pkt1,265, ft_token);
+ yahoo_packet_hash(pkt1,66, "-3");
+
+ yahoo_send_packet(yid, pkt1, 0);
+ yahoo_packet_free(pkt1);
+
+ }
+ break;
+ case 3: // Relay
+ {
+ /*
+ * From Kopete: accept the info?
+ */
+ struct yahoo_packet *pkt1 = NULL;
+
+ pkt1 = yahoo_packet_new(YAHOO_SERVICE_Y7_FILETRANSFERACCEPT, YAHOO_STATUS_AVAILABLE, yd->session_id);
+ yahoo_packet_hash(pkt1, 1, yd->user);
+ yahoo_packet_hash(pkt1, 5, from);
+ yahoo_packet_hash(pkt1,265, ft_token);
+ yahoo_packet_hash(pkt1,27, filename);
+ yahoo_packet_hash(pkt1,249, "3"); // use reflection server
+ yahoo_packet_hash(pkt1,251, token);
+
+ yahoo_send_packet(yid, pkt1, 0);
+ yahoo_packet_free(pkt1);
+
+ }
+ break;
+ }
+}
+
+static void yahoo_process_conference(struct yahoo_input_data *yid, struct yahoo_packet *pkt)
+{
+ struct yahoo_data *yd = yid->yd;
+ char *msg = NULL;
+ char *host = NULL;
+ char *who = NULL;
+ char *room = NULL;
+ char *id = NULL;
+ int utf8 = 0;
+ YList *members = NULL;
+ YList *l;
+
+ for (l = pkt->hash; l; l = l->next) {
+ struct yahoo_pair *pair = l->data;
+ if (pair->key == 50)
+ host = pair->value;
+
+ if (pair->key == 52) { /* invite */
+ members = y_list_append(members, strdup(pair->value));
+ }
+ if (pair->key == 53) /* logon */
+ who = pair->value;
+ if (pair->key == 54) /* decline */
+ who = pair->value;
+ if (pair->key == 55) /* unavailable (status == 2) */
+ who = pair->value;
+ if (pair->key == 56) /* logoff */
+ who = pair->value;
+
+ if (pair->key == 57)
+ room = pair->value;
+
+ if (pair->key == 58) /* join message */
+ msg = pair->value;
+ if (pair->key == 14) /* decline/conf message */
+ msg = pair->value;
+
+ if (pair->key == 13)
+ ;
+ if (pair->key == 16) /* error */
+ msg = pair->value;
+
+ if (pair->key == 1) /* my id */
+ id = pair->value;
+ if (pair->key == 3) /* message sender */
+ who = pair->value;
+
+ if (pair->key == 97)
+ utf8 = atoi(pair->value);
+ }
+
+ if(!room)
+ return;
+
+ if(host) {
+ for(l = members; l; l = l->next) {
+ char * w = l->data;
+ if(!strcmp(w, host))
+ break;
+ }
+ if(!l)
+ members = y_list_append(members, strdup(host));
+ }
+ /* invite, decline, join, left, message -> status == 1 */
+
+ switch(pkt->service) {
+ case YAHOO_SERVICE_CONFINVITE:
+ if(pkt->status == 2)
+ ;
+ else if(members)
+ YAHOO_CALLBACK(ext_yahoo_got_conf_invite)(yd->client_id, id, host, room, msg, members);
+ else if(msg)
+ YAHOO_CALLBACK(ext_yahoo_error)(yd->client_id, msg, 0, E_CONFNOTAVAIL);
+ break;
+ case YAHOO_SERVICE_CONFADDINVITE:
+ if(pkt->status == 2)
+ ;
+ else
+ YAHOO_CALLBACK(ext_yahoo_got_conf_invite)(yd->client_id, id, host, room, msg, members);
+ break;
+ case YAHOO_SERVICE_CONFDECLINE:
+ if(who)
+ YAHOO_CALLBACK(ext_yahoo_conf_userdecline)(yd->client_id, id, who, room, msg);
+ break;
+ case YAHOO_SERVICE_CONFLOGON:
+ if(who)
+ YAHOO_CALLBACK(ext_yahoo_conf_userjoin)(yd->client_id, id, who, room);
+ break;
+ case YAHOO_SERVICE_CONFLOGOFF:
+ if(who)
+ YAHOO_CALLBACK(ext_yahoo_conf_userleave)(yd->client_id, id, who, room);
+ break;
+ case YAHOO_SERVICE_CONFMSG:
+ if(who)
+ YAHOO_CALLBACK(ext_yahoo_conf_message)(yd->client_id, id, who, room, msg, utf8);
+ break;
+ }
+}
+
+static void yahoo_process_chat(struct yahoo_input_data *yid, struct yahoo_packet *pkt)
+{
+ char *msg = NULL;
+ char *id = NULL;
+ char *who = NULL;
+ char *room = NULL;
+ char *topic = NULL;
+ YList *members = NULL;
+ struct yahoo_chat_member *currentmember = NULL;
+ int msgtype = 1;
+ int utf8 = 0;
+ int firstjoin = 0;
+ int membercount = 0;
+ int chaterr=0;
+ YList *l;
+
+ yahoo_dump_unhandled(pkt);
+ for (l = pkt->hash; l; l = l->next) {
+ struct yahoo_pair *pair = l->data;
+
+ if (pair->key == 1) {
+ /* My identity */
+ id = pair->value;
+ }
+
+ if (pair->key == 104) {
+ /* Room name */
+ room = pair->value;
+ }
+
+ if (pair->key == 105) {
+ /* Room topic */
+ topic = pair->value;
+ }
+
+ if (pair->key == 108) {
+ /* Number of members in this packet */
+ membercount = atoi(pair->value);
+ }
+
+ if (pair->key == 109) {
+ /* message sender */
+ who = pair->value;
+
+ if (pkt->service == YAHOO_SERVICE_CHATJOIN) {
+ currentmember = y_new0(struct yahoo_chat_member, 1);
+ currentmember->id = strdup(pair->value);
+ members = y_list_append(members, currentmember);
+ }
+ }
+
+ if (pair->key == 110) {
+ /* age */
+ if (pkt->service == YAHOO_SERVICE_CHATJOIN)
+ currentmember->age = atoi(pair->value);
+ }
+
+ if (pair->key == 113) {
+ /* attribs */
+ if (pkt->service == YAHOO_SERVICE_CHATJOIN)
+ currentmember->attribs = atoi(pair->value);
+ }
+
+ if (pair->key == 141) {
+ /* alias */
+ if (pkt->service == YAHOO_SERVICE_CHATJOIN)
+ currentmember->alias = strdup(pair->value);
+ }
+
+ if (pair->key == 142) {
+ /* location */
+ if (pkt->service == YAHOO_SERVICE_CHATJOIN)
+ currentmember->location = strdup(pair->value);
+ }
+
+
+ if (pair->key == 130) {
+ /* first join */
+ firstjoin = 1;
+ }
+
+ if (pair->key == 117) {
+ /* message */
+ msg = pair->value;
+ }
+
+ if (pair->key == 124) {
+ /* Message type */
+ msgtype = atoi(pair->value);
+ }
+ if (pair->key == 114) {
+ /* message error not sure what all the pair values mean */
+ /* but -1 means no session in room */
+ chaterr= atoi(pair->value);
+ }
+ }
+
+ if(!room) {
+ if (pkt->service == YAHOO_SERVICE_CHATLOGOUT) { /* yahoo originated chat logout */
+ YAHOO_CALLBACK(ext_yahoo_chat_yahoologout)(yid->yd->client_id, id);
+ return ;
+ }
+ if (pkt->service == YAHOO_SERVICE_COMMENT && chaterr) {
+ YAHOO_CALLBACK(ext_yahoo_chat_yahooerror)(yid->yd->client_id, id);
+ return ;
+ }
+
+ WARNING(("We didn't get a room name, ignoring packet"));
+ return;
+ }
+
+ switch(pkt->service) {
+ case YAHOO_SERVICE_CHATJOIN:
+ if(y_list_length(members) != membercount) {
+ WARNING(("Count of members doesn't match No. of members we got"));
+ }
+ if(firstjoin && members) {
+ YAHOO_CALLBACK(ext_yahoo_chat_join)(yid->yd->client_id, id, room, topic, members, yid->fd);
+ } else if(who) {
+ if(y_list_length(members) != 1) {
+ WARNING(("Got more than 1 member on a normal join"));
+ }
+ /* this should only ever have one, but just in case */
+ while(members) {
+ YList *n = members->next;
+ currentmember = members->data;
+ YAHOO_CALLBACK(ext_yahoo_chat_userjoin)(yid->yd->client_id, id, room, currentmember);
+ y_list_free_1(members);
+ members=n;
+ }
+ }
+ break;
+ case YAHOO_SERVICE_CHATEXIT:
+ if(who) {
+ YAHOO_CALLBACK(ext_yahoo_chat_userleave)(yid->yd->client_id, id, room, who);
+ }
+ break;
+ case YAHOO_SERVICE_COMMENT:
+ if(who) {
+ YAHOO_CALLBACK(ext_yahoo_chat_message)(yid->yd->client_id, id, who, room, msg, msgtype, utf8);
+ }
+ break;
+ }
+}
+
+static void yahoo_process_message(struct yahoo_input_data *yid, struct yahoo_packet *pkt)
+{
+ struct yahoo_data *yd = yid->yd;
+ YList *l;
+ YList * messages = NULL;
+
+ struct m {
+ int i_31;
+ int i_32;
+ char *to;
+ char *from;
+ long tm;
+ char *msg;
+ int utf8;
+ int buddy_icon;
+ } *message = y_new0(struct m, 1);
+
+ message->buddy_icon = -1; // no info
+
+ for (l = pkt->hash; l; l = l->next) {
+ struct yahoo_pair *pair = l->data;
+ if (pair->key == 1 || pair->key == 4)
+ {
+ if(!message->from)
+ message->from = pair->value;
+ }
+ else if (pair->key == 5)
+ message->to = pair->value;
+ else if (pair->key == 15)
+ message->tm = strtol(pair->value, NULL, 10);
+ else if (pair->key == 206)
+ message->buddy_icon = atoi(pair->value);
+ else if (pair->key == 97)
+ message->utf8 = atoi(pair->value);
+ /* user message */ /* sys message */
+ else if (pair->key == 14 || pair->key == 16)
+ message->msg = pair->value;
+ else if (pair->key == 31) {
+ if(message->i_31) {
+ messages = y_list_append(messages, message);
+ message = y_new0(struct m, 1);
+ }
+ message->i_31 = atoi(pair->value);
+ }
+ else if (pair->key == 32)
+ message->i_32 = atoi(pair->value);
+ else
+ LOG(("yahoo_process_message: status: %d, key: %d, value: %s",
+ pkt->status, pair->key, pair->value));
+ }
+
+ messages = y_list_append(messages, message);
+
+ for (l = messages; l; l=l->next) {
+ message = l->data;
+ if (pkt->service == YAHOO_SERVICE_SYSMESSAGE) {
+ YAHOO_CALLBACK(ext_yahoo_system_message)(yd->client_id, message->to, message->from, message->msg);
+ } else if (pkt->status <= 2 || pkt->status == 5) {
+ YAHOO_CALLBACK(ext_yahoo_got_im)(yd->client_id, message->to, message->from, message->msg, message->tm, pkt->status, message->utf8, message->buddy_icon);
+ } else if (pkt->status == 0xffffffff) {
+ YAHOO_CALLBACK(ext_yahoo_error)(yd->client_id, message->msg, 0, E_SYSTEM);
+ }
+ free(message);
+ }
+
+ y_list_free(messages);
+}
+
+static void yahoo_process_logon(struct yahoo_input_data *yid, struct yahoo_packet *pkt)
+{
+ YList *l;
+ struct yahoo_data *yd = yid->yd;
+ char *name = NULL;
+ int state = 0;
+ int away = 0;
+ int idle = 0;
+ int mobile = 0;
+ int cksum = 0;
+ int buddy_icon = -1;
+ long client_version = 0;
+ char *msg = NULL;
+
+ for (l = pkt->hash; l; l = l->next) {
+ struct yahoo_pair *pair = l->data;
+
+ switch (pair->key) {
+ case 0: /* we won't actually do anything with this */
+ NOTICE(("key %d:%s", pair->key, pair->value));
+ break;
+ case 1: /* we don't get the full buddy list here. */
+ if (!yd->logged_in) {
+ yd->logged_in = TRUE;
+ if(yd->current_status < 0)
+ yd->current_status = yd->initial_status;
+ YAHOO_CALLBACK(ext_yahoo_login_response)(yd->client_id, YAHOO_LOGIN_OK, NULL);
+ }
+ break;
+ case 7: /* the current buddy */
+ if (name != NULL) {
+ YAHOO_CALLBACK(ext_yahoo_status_logon)(yd->client_id, name, state, msg, away, idle, mobile, cksum, buddy_icon, client_version);
+ msg = NULL;
+ client_version = cksum = state = away = idle = mobile = 0;
+ buddy_icon = -1;
+ }
+ name = pair->value;
+ break;
+ case 8: /* how many online buddies we have */
+ NOTICE(("key %d:%s", pair->key, pair->value));
+ break;
+ case 10: /* state */
+ state = strtol(pair->value, NULL, 10);
+ break;
+ case 11: /* this is the buddy's session id */
+ NOTICE(("key %d:%s", pair->key, pair->value));
+ break;
+ case 13: /* bitmask, bit 0 = pager, bit 1 = chat, bit 2 = game */
+ if (strtol(pair->value, NULL, 10) == 0) {
+ YAHOO_CALLBACK(ext_yahoo_status_changed)(yd->client_id, name, YAHOO_STATUS_OFFLINE, NULL, 1, 0, 0);
+ name = NULL;
+ break;
+ }
+ break;
+ case 16: /* Custom error message */
+ YAHOO_CALLBACK(ext_yahoo_error)(yd->client_id, pair->value, 0, E_CUSTOM);
+ break;
+ case 17: /* in chat? */
+ break;
+ case 19: /* custom status message */
+ msg = pair->value;
+ break;
+ case 24: /* session timestamp */
+ yd->session_timestamp = atol(pair->value);
+ break;
+ case 47: /* is it an away message or not */
+ away = atoi(pair->value);
+ break;
+ case 60: /* SMS -> 1 MOBILE USER */
+ /* sometimes going offline makes this 2, but invisible never sends it */
+ NOTICE(("key %d:%s", pair->key, pair->value));
+ if (atoi(pair->value) > 0 )
+ mobile = 1;
+ break;
+ case 137: /* seconds idle */
+ idle = atoi(pair->value);
+ break;
+ case 138: /* either we're not idle, or we are but won't say how long */
+ /* thanx Gaim.. I am seeing 138 -> 1. so don't do idle at all for miranda
+ since we don't have idle w/o time :( */
+ idle = 0;
+ break;
+
+ case 192: /* Pictures aka BuddyIcon checksum*/
+ cksum = strtol(pair->value, NULL, 10);
+ break;
+
+ case 197: /* avatar base64 encodded [Ignored by Gaim?] */
+ /*avatar = pair->value;*/
+ break;
+
+ case 213: /* Pictures aka BuddyIcon type 0-none, 1-avatar, 2-picture*/
+ buddy_icon = strtol(pair->value, NULL, 10);
+ break;
+
+ case 244: /* client version number. Yahoo Client Detection */
+ client_version = strtol(pair->value, NULL, 10);
+ break;
+
+ default:
+ WARNING(("unknown status key %d:%s", pair->key, pair->value));
+ break;
+ }
+ }
+
+ if (name != NULL)
+ YAHOO_CALLBACK(ext_yahoo_status_logon)(yd->client_id, name, state, msg, away, idle, mobile, cksum, buddy_icon, client_version);
+
+}
+
+static void yahoo_process_status(struct yahoo_input_data *yid, struct yahoo_packet *pkt)
+{
+ YList *l;
+ struct yahoo_data *yd = yid->yd;
+ char *name = NULL;
+ int state = 0;
+ int away = 0;
+ int idle = 0;
+ int mobile = 0;
+ int login_status=YAHOO_LOGIN_LOGOFF;
+ char *msg = NULL;
+ char *errmsg = NULL;
+
+ /*if (pkt->service == YAHOO_SERVICE_LOGOFF && pkt->status == YAHOO_STATUS_DISCONNECTED) {
+ YAHOO_CALLBACK(ext_yahoo_login_response)(yd->client_id, YAHOO_LOGIN_DUPL, NULL);
+ return;
+ }*/
+
+ for (l = pkt->hash; l; l = l->next) {
+ struct yahoo_pair *pair = l->data;
+
+ switch (pair->key) {
+ case 0: /* we won't actually do anything with this */
+ NOTICE(("key %d:%s", pair->key, pair->value));
+ break;
+ case 1: /* we don't get the full buddy list here. */
+ if (!yd->logged_in) {
+ yd->logged_in = TRUE;
+ if(yd->current_status < 0)
+ yd->current_status = yd->initial_status;
+ YAHOO_CALLBACK(ext_yahoo_login_response)(yd->client_id, YAHOO_LOGIN_OK, NULL);
+ }
+ break;
+ case 8: /* how many online buddies we have */
+ NOTICE(("key %d:%s", pair->key, pair->value));
+ break;
+ case 7: /* the current buddy */
+ if (name != NULL) {
+ YAHOO_CALLBACK(ext_yahoo_status_changed)(yd->client_id, name, state, msg, away, idle, mobile);
+ msg = NULL;
+ state = away = idle = mobile = 0;
+ }
+ name = pair->value;
+ break;
+ case 10: /* state */
+ state = strtol(pair->value, NULL, 10);
+ break;
+ case 19: /* custom status message */
+ msg = pair->value;
+ break;
+ case 47: /* is it an away message or not */
+ away = atoi(pair->value);
+ break;
+ case 137: /* seconds idle */
+ idle = atoi(pair->value);
+ break;
+ case 138: /* either we're not idle, or we are but won't say how long */
+ /* thanx Gaim.. I am seeing 138 -> 1. so don't do idle at all for miranda
+ since we don't have idle w/o time :( */
+ idle = 0;
+ break;
+ case 11: /* this is the buddy's session id */
+ NOTICE(("key %d:%s", pair->key, pair->value));
+ break;
+ case 17: /* in chat? */
+ break;
+ case 13: /* bitmask, bit 0 = pager, bit 1 = chat, bit 2 = game */
+ if (pkt->service == YAHOO_SERVICE_LOGOFF || strtol(pair->value, NULL, 10) == 0) {
+ YAHOO_CALLBACK(ext_yahoo_status_changed)(yd->client_id, name, YAHOO_STATUS_OFFLINE, NULL, 1, 0, 0);
+ name = NULL;
+ break;
+ }
+ break;
+ case 60: /* SMS -> 1 MOBILE USER */
+ /* sometimes going offline makes this 2, but invisible never sends it */
+ NOTICE(("key %d:%s", pair->key, pair->value));
+ if (atoi(pair->value) > 0 )
+ mobile = 1;
+ break;
+ case 16: /* Custom error message */
+ errmsg = pair->value;
+ break;
+ case 66: /* login status */
+ {
+ int i = atoi(pair->value);
+
+ switch(i) {
+ case 42: /* duplicate login */
+ login_status = YAHOO_LOGIN_DUPL;
+ break;
+ case 28: /* session expired */
+
+ break;
+ }
+ }
+ break;
+ default:
+ WARNING(("unknown status key %d:%s", pair->key, pair->value));
+ break;
+ }
+ }
+
+ if (name != NULL)
+ YAHOO_CALLBACK(ext_yahoo_status_changed)(yd->client_id, name, state, msg, away, idle, mobile);
+ else if (pkt->service == YAHOO_SERVICE_LOGOFF && pkt->status == YAHOO_STATUS_DISCONNECTED)
+ //
+ //Key: Error msg (16) Value: 'Session expired. Please relogin'
+ //Key: login status (66) Value: '28'
+ //
+ YAHOO_CALLBACK(ext_yahoo_login_response)(yd->client_id, login_status, NULL);
+ else if (errmsg != NULL)
+ YAHOO_CALLBACK(ext_yahoo_error)(yd->client_id, errmsg, 0, E_CUSTOM);
+ else if (pkt->service == YAHOO_SERVICE_LOGOFF && pkt->status == YAHOO_STATUS_AVAILABLE && pkt->hash == NULL)
+ // Server Acking our Logoff (close connection)
+ yahoo_input_close(yid);
+}
+
+static void yahoo_process_list(struct yahoo_input_data *yid, struct yahoo_packet *pkt)
+{
+ struct yahoo_data *yd = yid->yd;
+ YList *l;
+
+ /* we could be getting multiple packets here */
+ for (l = pkt->hash; l; l = l->next) {
+ struct yahoo_pair *pair = l->data;
+
+ switch(pair->key) {
+ case 87: /* buddies */
+ if(!yd->rawbuddylist)
+ yd->rawbuddylist = strdup(pair->value);
+ else {
+ yd->rawbuddylist = y_string_append(yd->rawbuddylist, pair->value);
+ }
+ break;
+
+ case 88: /* ignore list */
+ if(!yd->ignorelist)
+ yd->ignorelist = strdup("Ignore:");
+ yd->ignorelist = y_string_append(yd->ignorelist, pair->value);
+ break;
+
+ case 89: /* identities */
+ {
+ char **identities = y_strsplit(pair->value, ",", -1);
+ int i;
+ for(i=0; identities[i]; i++)
+ yd->identities = y_list_append(yd->identities,
+ strdup(identities[i]));
+ y_strfreev(identities);
+ }
+ YAHOO_CALLBACK(ext_yahoo_got_identities)(yd->client_id, yd->identities);
+ break;
+ case 59: /* cookies */
+ if(pair->value[0]=='Y') {
+ FREE(yd->cookie_y);
+ FREE(yd->login_cookie);
+
+ yd->cookie_y = getcookie(pair->value);
+ yd->login_cookie = getlcookie(yd->cookie_y);
+
+ } else if(pair->value[0]=='T') {
+ FREE(yd->cookie_t);
+ yd->cookie_t = getcookie(pair->value);
+
+ } else if(pair->value[0]=='C') {
+ FREE(yd->cookie_c);
+ yd->cookie_c = getcookie(pair->value);
+ }
+
+ break;
+ case 3: /* my id */
+ case 90: /* 1 */
+ case 100: /* 0 */
+ case 101: /* NULL */
+ case 102: /* NULL */
+ case 93: /* 86400/1440 */
+ break;
+ case 185: /* stealth list */
+ if(!yd->rawstealthlist)
+ yd->rawstealthlist = strdup(pair->value);
+ else {
+ yd->rawstealthlist = y_string_append(yd->rawstealthlist, pair->value);
+ }
+
+ WARNING(("Got stealth list: %s", yd->rawstealthlist));
+ YAHOO_CALLBACK(ext_yahoo_got_stealthlist)(yd->client_id, yd->rawstealthlist);
+ break;
+ case 213: /* my current avatar setting */
+ {
+ int buddy_icon = strtol(pair->value, NULL, 10);
+
+ YAHOO_CALLBACK(ext_yahoo_got_avatar_share)(yd->client_id, buddy_icon);
+ }
+ break;
+ case 217: /*??? Seems like last key */
+
+ break;
+ }
+ }
+
+ /* we could be getting multiple packets here */
+ if (pkt->status != 0) /* Thanks for the fix GAIM */
+ return;
+
+ if (!yd->rawstealthlist)
+ YAHOO_CALLBACK(ext_yahoo_got_stealthlist)(yd->client_id, yd->rawstealthlist);
+
+ if(yd->ignorelist) {
+ yd->ignore = bud_str2list(yd->ignorelist);
+ FREE(yd->ignorelist);
+ YAHOO_CALLBACK(ext_yahoo_got_ignore)(yd->client_id, yd->ignore);
+ }
+
+ if(yd->rawbuddylist) {
+ yd->buddies = bud_str2list(yd->rawbuddylist);
+ FREE(yd->rawbuddylist);
+
+ YAHOO_CALLBACK(ext_yahoo_got_buddies)(yd->client_id, yd->buddies);
+ }
+
+
+ if(yd->cookie_y && yd->cookie_t && yd->cookie_c)
+ YAHOO_CALLBACK(ext_yahoo_got_cookies)(yd->client_id);
+
+ /*** We login at the very end of the packet communication */
+ if (!yd->logged_in) {
+ yd->logged_in = TRUE;
+ if(yd->current_status < 0)
+ yd->current_status = yd->initial_status;
+ YAHOO_CALLBACK(ext_yahoo_login_response)(yd->client_id, YAHOO_LOGIN_OK, NULL);
+ }
+}
+
+static void yahoo_process_verify(struct yahoo_input_data *yid, struct yahoo_packet *pkt)
+{
+ struct yahoo_data *yd = yid->yd;
+
+ if(pkt->status != 0x01) {
+ DEBUG_MSG(("expected status: 0x01, got: %d", pkt->status));
+ YAHOO_CALLBACK(ext_yahoo_login_response)(yd->client_id, YAHOO_LOGIN_LOCK, "");
+ return;
+ }
+
+ pkt = yahoo_packet_new(YAHOO_SERVICE_AUTH, YAHOO_STATUS_AVAILABLE, yd->session_id);
+
+ yahoo_packet_hash(pkt, 1, yd->user);
+ yahoo_send_packet(yid, pkt, 0);
+
+ yahoo_packet_free(pkt);
+
+}
+
+static void yahoo_process_auth_pre_0x0b(struct yahoo_input_data *yid,
+ const char *seed, const char *sn)
+{
+ struct yahoo_data *yd = yid->yd;
+
+ /* So, Yahoo has stopped supporting its older clients in India, and
+ * undoubtedly will soon do so in the rest of the world.
+ *
+ * The new clients use this authentication method. I warn you in
+ * advance, it's bizzare, convoluted, inordinately complicated.
+ * It's also no more secure than crypt() was. The only purpose this
+ * scheme could serve is to prevent third part clients from connecting
+ * to their servers.
+ *
+ * Sorry, Yahoo.
+ */
+
+ struct yahoo_packet *pack;
+
+ md5_byte_t result[16];
+ md5_state_t ctx;
+ char *crypt_result;
+ unsigned char *password_hash = malloc(25);
+ unsigned char *crypt_hash = malloc(25);
+ unsigned char *hash_string_p = malloc(50 + strlen(sn));
+ unsigned char *hash_string_c = malloc(50 + strlen(sn));
+
+ char checksum;
+
+ int sv;
+
+ unsigned char *result6 = malloc(25);
+ unsigned char *result96 = malloc(25);
+
+ sv = seed[15];
+ sv = (sv % 8) % 5;
+
+ md5_init(&ctx);
+ md5_append(&ctx, (md5_byte_t *)yd->password, strlen(yd->password));
+ md5_finish(&ctx, result);
+ to_y64(password_hash, result, 16);
+
+ md5_init(&ctx);
+ crypt_result = yahoo_crypt(yd->password, "$1$_2S43d5f$");
+ md5_append(&ctx, (md5_byte_t *)crypt_result, strlen(crypt_result));
+ md5_finish(&ctx, result);
+ to_y64(crypt_hash, result, 16);
+ free(crypt_result);
+
+ switch (sv) {
+ case 0:
+ checksum = seed[seed[7] % 16];
+ snprintf((char *)hash_string_p, strlen(sn) + 50,
+ "%c%s%s%s", checksum, password_hash, yd->user, seed);
+ snprintf((char *)hash_string_c, strlen(sn) + 50,
+ "%c%s%s%s", checksum, crypt_hash, yd->user, seed);
+ break;
+ case 1:
+ checksum = seed[seed[9] % 16];
+ snprintf((char *)hash_string_p, strlen(sn) + 50,
+ "%c%s%s%s", checksum, yd->user, seed, password_hash);
+ snprintf((char *)hash_string_c, strlen(sn) + 50,
+ "%c%s%s%s", checksum, yd->user, seed, crypt_hash);
+ break;
+ case 2:
+ checksum = seed[seed[15] % 16];
+ snprintf((char *)hash_string_p, strlen(sn) + 50,
+ "%c%s%s%s", checksum, seed, password_hash, yd->user);
+ snprintf((char *)hash_string_c, strlen(sn) + 50,
+ "%c%s%s%s", checksum, seed, crypt_hash, yd->user);
+ break;
+ case 3:
+ checksum = seed[seed[1] % 16];
+ snprintf((char *)hash_string_p, strlen(sn) + 50,
+ "%c%s%s%s", checksum, yd->user, password_hash, seed);
+ snprintf((char *)hash_string_c, strlen(sn) + 50,
+ "%c%s%s%s", checksum, yd->user, crypt_hash, seed);
+ break;
+ case 4:
+ checksum = seed[seed[3] % 16];
+ snprintf((char *)hash_string_p, strlen(sn) + 50,
+ "%c%s%s%s", checksum, password_hash, seed, yd->user);
+ snprintf((char *)hash_string_c, strlen(sn) + 50,
+ "%c%s%s%s", checksum, crypt_hash, seed, yd->user);
+ break;
+ }
+
+ md5_init(&ctx);
+ md5_append(&ctx, (md5_byte_t *)hash_string_p, strlen((char *)hash_string_p));
+ md5_finish(&ctx, result);
+ to_y64(result6, result, 16);
+
+ md5_init(&ctx);
+ md5_append(&ctx, (md5_byte_t *)hash_string_c, strlen((char *)hash_string_c));
+ md5_finish(&ctx, result);
+ to_y64(result96, result, 16);
+
+ pack = yahoo_packet_new(YAHOO_SERVICE_AUTHRESP, yd->initial_status, yd->session_id);
+ yahoo_packet_hash(pack, 0, yd->user);
+ yahoo_packet_hash(pack, 6, (char *)result6);
+ yahoo_packet_hash(pack, 96, (char *)result96);
+ yahoo_packet_hash(pack, 1, yd->user);
+
+ yahoo_send_packet(yid, pack, 0);
+
+ FREE(result6);
+ FREE(result96);
+ FREE(password_hash);
+ FREE(crypt_hash);
+ FREE(hash_string_p);
+ FREE(hash_string_c);
+
+ yahoo_packet_free(pack);
+
+}
+
+/*
+ * New auth protocol cracked by Cerulean Studios and sent in to Gaim
+ */
+static void yahoo_process_auth_0x0b(struct yahoo_input_data *yid, const char *seed, const char *sn)
+{
+ struct yahoo_packet *pack = NULL;
+ struct yahoo_data *yd = yid->yd;
+ struct yahoo_server_settings *yss;
+
+ md5_byte_t result[16];
+ md5_state_t ctx;
+
+ SHA_CTX ctx1;
+ SHA_CTX ctx2;
+
+ char *alphabet1 = "FBZDWAGHrJTLMNOPpRSKUVEXYChImkwQ";
+ char *alphabet2 = "F0E1D2C3B4A59687abcdefghijklmnop";
+
+ char *challenge_lookup = "qzec2tb3um1olpar8whx4dfgijknsvy5";
+ char *operand_lookup = "+|&%/*^-";
+ char *delimit_lookup = ",;";
+
+ unsigned char *password_hash = malloc(25);
+ unsigned char *crypt_hash = malloc(25);
+ char *crypt_result = NULL;
+ unsigned char pass_hash_xor1[64];
+ unsigned char pass_hash_xor2[64];
+ unsigned char crypt_hash_xor1[64];
+ unsigned char crypt_hash_xor2[64];
+ unsigned char chal[7];
+ char resp_6[100];
+ char resp_96[100];
+
+ unsigned char digest1[20];
+ unsigned char digest2[20];
+ unsigned char magic_key_char[4];
+ const unsigned char *magic_ptr;
+
+ unsigned int magic[64];
+ unsigned int magic_work=0;
+
+ char comparison_src[20];
+ char z[22];
+
+ int x, j, i;
+ int cnt = 0;
+ int magic_cnt = 0;
+ int magic_len;
+ int depth =0, table =0;
+
+ memset(&pass_hash_xor1, 0, 64);
+ memset(&pass_hash_xor2, 0, 64);
+ memset(&crypt_hash_xor1, 0, 64);
+ memset(&crypt_hash_xor2, 0, 64);
+ memset(&digest1, 0, 20);
+ memset(&digest2, 0, 20);
+ memset(&magic, 0, 64);
+ memset(&resp_6, 0, 100);
+ memset(&resp_96, 0, 100);
+ memset(&magic_key_char, 0, 4);
+
+ /*
+ * Magic: Phase 1. Generate what seems to be a 30
+ * byte value (could change if base64
+ * ends up differently? I don't remember and I'm
+ * tired, so use a 64 byte buffer.
+ */
+
+ magic_ptr = (unsigned char *)seed;
+
+ while (*magic_ptr != (int)NULL) {
+ char *loc;
+
+ /* Ignore parentheses. */
+
+ if (*magic_ptr == '(' || *magic_ptr == ')') {
+ magic_ptr++;
+ continue;
+ }
+
+ /* Characters and digits verify against
+ the challenge lookup.
+ */
+
+ if (isalpha(*magic_ptr) || isdigit(*magic_ptr)) {
+ loc = strchr(challenge_lookup, *magic_ptr);
+ if (!loc) {
+ /* This isn't good */
+ continue;
+ }
+
+ /* Get offset into lookup table and lsh 3. */
+
+ magic_work = loc - challenge_lookup;
+ magic_work <<= 3;
+
+ magic_ptr++;
+ continue;
+ } else {
+ unsigned int local_store;
+
+ loc = strchr(operand_lookup, *magic_ptr);
+ if (!loc) {
+ /* Also not good. */
+ continue;
+ }
+
+ local_store = loc - operand_lookup;
+
+ /* Oops; how did this happen? */
+ if (magic_cnt >= 64)
+ break;
+
+ magic[magic_cnt++] = magic_work | local_store;
+ magic_ptr++;
+ continue;
+ }
+ }
+
+ magic_len = magic_cnt;
+ magic_cnt = 0;
+
+ /* Magic: Phase 2. Take generated magic value and
+ * sprinkle fairy dust on the values. */
+
+ for (magic_cnt = magic_len-2; magic_cnt >= 0; magic_cnt--) {
+ unsigned char byte1;
+ unsigned char byte2;
+
+ /* Bad. Abort.
+ */
+ if (magic_cnt >= magic_len) {
+ WARNING(("magic_cnt(%d) magic_len(%d)", magic_cnt, magic_len))
+ break;
+ }
+
+ byte1 = magic[magic_cnt];
+ byte2 = magic[magic_cnt+1];
+
+ byte1 *= 0xcd;
+ byte1 ^= byte2;
+
+ magic[magic_cnt+1] = byte1;
+ }
+
+ /* Magic: Phase 3. This computes 20 bytes. The first 4 bytes are used as our magic
+ * key (and may be changed later); the next 16 bytes are an MD5 sum of the magic key
+ * plus 3 bytes. The 3 bytes are found by looping, and they represent the offsets
+ * into particular functions we'll later call to potentially alter the magic key.
+ *
+ * %-)
+ */
+
+ magic_cnt = 1;
+ x = 0;
+
+ do {
+ unsigned int bl = 0;
+ unsigned int cl = magic[magic_cnt++];
+
+ if (magic_cnt >= magic_len)
+ break;
+
+ if (cl > 0x7F) {
+ if (cl < 0xe0)
+ bl = cl = (cl & 0x1f) << 6;
+ else {
+ bl = magic[magic_cnt++];
+ cl = (cl & 0x0f) << 6;
+ bl = ((bl & 0x3f) + cl) << 6;
+ }
+
+ cl = magic[magic_cnt++];
+ bl = (cl & 0x3f) + bl;
+ } else
+ bl = cl;
+
+ comparison_src[x++] = (bl & 0xff00) >> 8;
+ comparison_src[x++] = bl & 0xff;
+ } while (x < 20);
+
+ /* Dump magic key into a char for SHA1 action. */
+
+
+ for(x = 0; x < 4; x++)
+ magic_key_char[x] = comparison_src[x];
+
+ /* Compute values for recursive function table! */
+ memcpy( chal, magic_key_char, 4 );
+ x = 1;
+ for( i = 0; i < 0xFFFF && x; i++ )
+ {
+ for( j = 0; j < 5 && x; j++ )
+ {
+ chal[4] = i;
+ chal[5] = i >> 8;
+ chal[6] = j;
+ md5_init( &ctx );
+ md5_append( &ctx, chal, 7 );
+ md5_finish( &ctx, result );
+ if( memcmp( comparison_src + 4, result, 16 ) == 0 )
+ {
+ depth = i;
+ table = j;
+ x = 0;
+ }
+ }
+ }
+
+ /* Transform magic_key_char using transform table */
+ x = magic_key_char[3] << 24 | magic_key_char[2] << 16
+ | magic_key_char[1] << 8 | magic_key_char[0];
+ x = yahoo_xfrm( table, depth, x );
+ x = yahoo_xfrm( table, depth, x );
+ magic_key_char[0] = x & 0xFF;
+ magic_key_char[1] = x >> 8 & 0xFF;
+ magic_key_char[2] = x >> 16 & 0xFF;
+ magic_key_char[3] = x >> 24 & 0xFF;
+
+ /* Get password and crypt hashes as per usual. */
+ md5_init(&ctx);
+ md5_append(&ctx, (md5_byte_t *)yd->password, strlen(yd->password));
+ md5_finish(&ctx, result);
+ to_y64(password_hash, result, 16);
+
+ md5_init(&ctx);
+ crypt_result = yahoo_crypt(yd->password, "$1$_2S43d5f$");
+ md5_append(&ctx, (md5_byte_t *)crypt_result, strlen(crypt_result));
+ md5_finish(&ctx, result);
+ to_y64(crypt_hash, result, 16);
+ free(crypt_result);
+
+ /* Our first authentication response is based off
+ * of the password hash. */
+
+ for (x = 0; x < (int)strlen((char *)password_hash); x++)
+ pass_hash_xor1[cnt++] = password_hash[x] ^ 0x36;
+
+ if (cnt < 64)
+ memset(&(pass_hash_xor1[cnt]), 0x36, 64-cnt);
+
+ cnt = 0;
+
+ for (x = 0; x < (int)strlen((char *)password_hash); x++)
+ pass_hash_xor2[cnt++] = password_hash[x] ^ 0x5c;
+
+ if (cnt < 64)
+ memset(&(pass_hash_xor2[cnt]), 0x5c, 64-cnt);
+
+ shaInit(&ctx1);
+ shaInit(&ctx2);
+
+ /* The first context gets the password hash XORed
+ * with 0x36 plus a magic value
+ * which we previously extrapolated from our
+ * challenge. */
+
+ shaUpdate(&ctx1, pass_hash_xor1, 64);
+ if (j >= 3)
+ ctx1.sizeLo = 0x1ff;
+ shaUpdate(&ctx1, magic_key_char, 4);
+ shaFinal(&ctx1, digest1);
+
+ /* The second context gets the password hash XORed
+ * with 0x5c plus the SHA-1 digest
+ * of the first context. */
+
+ shaUpdate(&ctx2, pass_hash_xor2, 64);
+ shaUpdate(&ctx2, digest1, 20);
+ shaFinal(&ctx2, digest2);
+
+ /* Now that we have digest2, use it to fetch
+ * characters from an alphabet to construct
+ * our first authentication response. */
+
+ for (x = 0; x < 20; x += 2) {
+ unsigned int val = 0;
+ unsigned int lookup = 0;
+ char byte[6];
+
+ memset(&byte, 0, 6);
+
+ /* First two bytes of digest stuffed
+ * together.
+ */
+
+ val = digest2[x];
+ val <<= 8;
+ val += digest2[x+1];
+
+ lookup = (val >> 0x0b);
+ lookup &= 0x1f;
+ if (lookup >= strlen(alphabet1))
+ break;
+ sprintf(byte, "%c", alphabet1[lookup]);
+ strcat(resp_6, byte);
+ strcat(resp_6, "=");
+
+ lookup = (val >> 0x06);
+ lookup &= 0x1f;
+ if (lookup >= strlen(alphabet2))
+ break;
+ sprintf(byte, "%c", alphabet2[lookup]);
+ strcat(resp_6, byte);
+
+ lookup = (val >> 0x01);
+ lookup &= 0x1f;
+ if (lookup >= strlen(alphabet2))
+ break;
+ sprintf(byte, "%c", alphabet2[lookup]);
+ strcat(resp_6, byte);
+
+ lookup = (val & 0x01);
+ if (lookup >= strlen(delimit_lookup))
+ break;
+ sprintf(byte, "%c", delimit_lookup[lookup]);
+ strcat(resp_6, byte);
+ }
+
+ /* Our second authentication response is based off
+ * of the crypto hash. */
+
+ cnt = 0;
+ memset(&digest1, 0, 20);
+ memset(&digest2, 0, 20);
+
+ for (x = 0; x < (int)strlen((char *)crypt_hash); x++)
+ crypt_hash_xor1[cnt++] = crypt_hash[x] ^ 0x36;
+
+ if (cnt < 64)
+ memset(&(crypt_hash_xor1[cnt]), 0x36, 64-cnt);
+
+ cnt = 0;
+
+ for (x = 0; x < (int)strlen((char *)crypt_hash); x++)
+ crypt_hash_xor2[cnt++] = crypt_hash[x] ^ 0x5c;
+
+ if (cnt < 64)
+ memset(&(crypt_hash_xor2[cnt]), 0x5c, 64-cnt);
+
+ shaInit(&ctx1);
+ shaInit(&ctx2);
+
+ /* The first context gets the password hash XORed
+ * with 0x36 plus a magic value
+ * which we previously extrapolated from our
+ * challenge. */
+
+ shaUpdate(&ctx1, crypt_hash_xor1, 64);
+ if (j >= 3)
+ ctx1.sizeLo = 0x1ff;
+ shaUpdate(&ctx1, magic_key_char, 4);
+ shaFinal(&ctx1, digest1);
+
+ /* The second context gets the password hash XORed
+ * with 0x5c plus the SHA-1 digest
+ * of the first context. */
+
+ shaUpdate(&ctx2, crypt_hash_xor2, 64);
+ shaUpdate(&ctx2, digest1, 20);
+ shaFinal(&ctx2, digest2);
+
+ /* Now that we have digest2, use it to fetch
+ * characters from an alphabet to construct
+ * our first authentication response. */
+
+ for (x = 0; x < 20; x += 2) {
+ unsigned int val = 0;
+ unsigned int lookup = 0;
+
+ char byte[6];
+
+ memset(&byte, 0, 6);
+
+ /* First two bytes of digest stuffed
+ * together. */
+
+ val = digest2[x];
+ val <<= 8;
+ val += digest2[x+1];
+
+ lookup = (val >> 0x0b);
+ lookup &= 0x1f;
+ if (lookup >= strlen(alphabet1))
+ break;
+ sprintf(byte, "%c", alphabet1[lookup]);
+ strcat(resp_96, byte);
+ strcat(resp_96, "=");
+
+ lookup = (val >> 0x06);
+ lookup &= 0x1f;
+ if (lookup >= strlen(alphabet2))
+ break;
+ sprintf(byte, "%c", alphabet2[lookup]);
+ strcat(resp_96, byte);
+
+ lookup = (val >> 0x01);
+ lookup &= 0x1f;
+ if (lookup >= strlen(alphabet2))
+ break;
+ sprintf(byte, "%c", alphabet2[lookup]);
+ strcat(resp_96, byte);
+
+ lookup = (val & 0x01);
+ if (lookup >= strlen(delimit_lookup))
+ break;
+ sprintf(byte, "%c", delimit_lookup[lookup]);
+ strcat(resp_96, byte);
+ }
+
+ yss = yd->server_settings;
+
+ pack = yahoo_packet_new(YAHOO_SERVICE_AUTHRESP, (yd->initial_status == YAHOO_STATUS_INVISIBLE) ?YAHOO_STATUS_INVISIBLE:YAHOO_STATUS_WEBLOGIN, yd->session_id);
+ yahoo_packet_hash(pack, 6, resp_6);
+ yahoo_packet_hash(pack, 96, resp_96);
+ yahoo_packet_hash(pack, 0, sn);
+ yahoo_packet_hash(pack, 2, sn);
+
+
+ snprintf(z, sizeof(z), "%d", yss->pic_cksum);
+ yahoo_packet_hash(pack, 192, z);// avatar support yet (EXPERIMENTAL)
+ //yahoo_packet_hash(pack, 192, "-1");// no avatar support yet
+ yahoo_packet_hash(pack, 2, "1");
+ yahoo_packet_hash(pack, 1, sn);
+ // A little experiment ;) HEHEHE
+ yahoo_packet_hash(pack, 244, "524223"); // Features??? I wonder...
+ /////////////
+ //yahoo_packet_hash(pack, 135, "6,0,0,1922");
+ yahoo_packet_hash(pack, 135, "7,0,2,120");
+ yahoo_packet_hash(pack, 148, "300"); // ???
+ /* mmmm GAIM does it differently???
+ yahoo_packet_hash(pack, 0, sn);
+ yahoo_packet_hash(pack, 6, resp_6);
+ yahoo_packet_hash(pack, 96, resp_96);
+ yahoo_packet_hash(pack, 1, sn);
+ yahoo_packet_hash(pack, 135, "6,0,0,1710");
+ yahoo_packet_hash(pack, 192, "-1");// no avatar support yet
+
+ */
+ yahoo_send_packet(yid, pack, 0);
+ yahoo_packet_free(pack);
+
+ free(password_hash);
+ free(crypt_hash);
+}
+
+static void yahoo_process_auth(struct yahoo_input_data *yid, struct yahoo_packet *pkt)
+{
+ char *seed = NULL;
+ char *sn = NULL;
+ YList *l = pkt->hash;
+ int m = 0;
+
+ while (l) {
+ struct yahoo_pair *pair = l->data;
+ if (pair->key == 94)
+ seed = pair->value;
+ if (pair->key == 1)
+ sn = pair->value;
+ if (pair->key == 13)
+ m = atoi(pair->value);
+ l = l->next;
+ }
+
+ if (!seed)
+ return;
+
+ switch (m) {
+ case 0:
+ yahoo_process_auth_pre_0x0b(yid, seed, sn);
+ break;
+ case 1:
+ yahoo_process_auth_0x0b(yid, seed, sn);
+ break;
+ default:
+ /* call error */
+ WARNING(("unknown auth type %d", m));
+ yahoo_process_auth_0x0b(yid, seed, sn);
+ break;
+ }
+}
+
+static void yahoo_process_auth_resp(struct yahoo_input_data *yid, struct yahoo_packet *pkt)
+{
+ struct yahoo_data *yd = yid->yd;
+ char *login_id;
+ char *handle;
+ char *url=NULL;
+ int login_status=0;
+
+ YList *l;
+
+ for (l = pkt->hash; l; l = l->next) {
+ struct yahoo_pair *pair = l->data;
+ if (pair->key == 0)
+ login_id = pair->value;
+ else if (pair->key == 1)
+ handle = pair->value;
+ else if (pair->key == 20)
+ url = pair->value;
+ else if (pair->key == 66)
+ login_status = atoi(pair->value);
+ }
+
+ if(pkt->status == 0xffffffff) {
+ YAHOO_CALLBACK(ext_yahoo_login_response)(yd->client_id, login_status, url);
+ /* yahoo_logoff(yd->client_id);*/
+ }
+}
+
+static void yahoo_process_mail(struct yahoo_input_data *yid, struct yahoo_packet *pkt)
+{
+ struct yahoo_data *yd = yid->yd;
+ char *who = NULL;
+ char *email = NULL;
+ char *subj = NULL;
+ int count = 0;
+ YList *l;
+
+ for (l = pkt->hash; l; l = l->next) {
+ struct yahoo_pair *pair = l->data;
+ if (pair->key == 9)
+ count = strtol(pair->value, NULL, 10);
+ else if (pair->key == 43)
+ who = pair->value;
+ else if (pair->key == 42)
+ email = pair->value;
+ else if (pair->key == 18)
+ subj = pair->value;
+ else
+ LOG(("key: %d => value: '%s'", pair->key, pair->value));
+ }
+
+ if (who && email && subj) {
+ char from[1024];
+ snprintf(from, sizeof(from), "%s (%s)", who, email);
+ YAHOO_CALLBACK(ext_yahoo_mail_notify)(yd->client_id, from, subj, count);
+ } else
+ YAHOO_CALLBACK(ext_yahoo_mail_notify)(yd->client_id, NULL, NULL, count);
+}
+
+static void yahoo_buddy_added_us(struct yahoo_input_data *yid, struct yahoo_packet *pkt)
+{
+ struct yahoo_data *yd = yid->yd;
+ char *id = NULL;
+ char *who = NULL;
+ char *msg = NULL;
+ long tm = 0L;
+ YList *l;
+
+ for (l = pkt->hash; l; l = l->next) {
+ struct yahoo_pair *pair = l->data;
+ switch (pair->key) {
+ case 1:
+ id = pair->value;
+ break;
+ case 3:
+ who = pair->value;
+ break;
+ case 14:
+ msg = pair->value;
+ break;
+ case 15:
+ tm = strtol(pair->value, NULL, 10);
+ break;
+ default:
+ LOG(("key: %d => value: '%s'", pair->key, pair->value));
+ }
+ }
+
+ YAHOO_CALLBACK(ext_yahoo_contact_added)(yd->client_id, id, who, NULL, NULL, msg);
+}
+
+static void yahoo_buddy_denied_our_add(struct yahoo_input_data *yid, struct yahoo_packet *pkt)
+{
+ struct yahoo_data *yd = yid->yd;
+ char *who = NULL;
+ char *msg = NULL;
+ YList *l;
+
+ for (l = pkt->hash; l; l = l->next) {
+ struct yahoo_pair *pair = l->data;
+ switch (pair->key) {
+ case 3:
+ who = pair->value;
+ break;
+ case 14:
+ msg = pair->value;
+ break;
+ default:
+ LOG(("key: %d => value: '%s'", pair->key, pair->value));
+ }
+ }
+
+ YAHOO_CALLBACK(ext_yahoo_rejected)(yd->client_id, who, msg);
+}
+
+static void yahoo_process_contact(struct yahoo_input_data *yid, struct yahoo_packet *pkt)
+{
+ switch (pkt->status) {
+ case 1:
+ yahoo_process_status(yid, pkt);
+ return;
+ case 3:
+ yahoo_buddy_added_us(yid, pkt);
+ break;
+ case 7:
+ yahoo_buddy_denied_our_add(yid, pkt);
+ break;
+ default:
+ LOG(("Unknown status value: '%s'", pkt->status));
+ }
+
+}
+
+static void yahoo_process_authorization(struct yahoo_input_data *yid, struct yahoo_packet *pkt)
+{
+ struct yahoo_data *yd = yid->yd;
+ char *who = NULL,
+ *msg = NULL,
+ *fname = NULL,
+ *lname = NULL,
+ *id = NULL;
+ int state = 0, utf8 = 0;
+ YList *l;
+
+ for (l = pkt->hash; l; l = l->next) {
+ struct yahoo_pair *pair = l->data;
+ switch (pair->key) {
+ case 4: /* who added us */
+ who = pair->value;
+ break;
+
+ case 5: /* our identity */
+ id = pair->value;
+ break;
+
+ case 13: /* which type of request this is */
+ state = strtol(pair->value, NULL, 10);
+ break;
+
+ case 14: /* was there a message ? */
+ msg = pair->value;
+ break;
+
+ case 97: /* Unicode flag? */
+ utf8 = strtol(pair->value, NULL, 10);
+ break;
+
+ case 216: /* first name */
+ fname = pair->value;
+ break;
+
+ case 254: /* last name */
+ lname = pair->value;
+ break;
+
+ default:
+ LOG(("key: %d => value: '%s'", pair->key, pair->value));
+ }
+ }
+
+ switch (state) {
+ case 1: /* Authorization Accepted */
+
+ break;
+ case 2: /* Authorization Denied */
+ YAHOO_CALLBACK(ext_yahoo_rejected)(yd->client_id, who, msg);
+ break;
+ default: /* Authorization Request? */
+ YAHOO_CALLBACK(ext_yahoo_contact_added)(yd->client_id, id, who, fname, lname, msg);
+
+ }
+
+}
+
+static void yahoo_process_buddyadd(struct yahoo_input_data *yid, struct yahoo_packet *pkt)
+{
+ struct yahoo_data *yd = yid->yd;
+ char *who = NULL;
+ char *where = NULL;
+ int status = 0, auth = 0;
+ char *me = NULL;
+
+ struct yahoo_buddy *bud=NULL;
+
+ YList *l;
+ for (l = pkt->hash; l; l = l->next) {
+ struct yahoo_pair *pair = l->data;
+
+ switch (pair->key){
+ case 1:
+ me = pair->value;
+ break;
+ case 7:
+ who = pair->value;
+ break;
+ case 65:
+ where = pair->value;
+ break;
+ case 66:
+ status = strtol(pair->value, NULL, 10);
+ break;
+ case 223:
+ auth = strtol(pair->value, NULL, 10);
+ break;
+ }
+ }
+
+ //yahoo_dump_unhandled(pkt);
+
+ if(!who)
+ return;
+ if(!where)
+ where = "Unknown";
+
+ bud = y_new0(struct yahoo_buddy, 1);
+ bud->id = strdup(who);
+ bud->group = strdup(where);
+ bud->real_name = NULL;
+
+ yd->buddies = y_list_append(yd->buddies, bud);
+
+ YAHOO_CALLBACK(ext_yahoo_buddy_added)(yd->client_id, me, who, where, status, auth);
+/* YAHOO_CALLBACK(ext_yahoo_status_changed)(yd->client_id, who, status, NULL, (status==YAHOO_STATUS_AVAILABLE?0:1)); */
+}
+
+static void yahoo_process_buddydel(struct yahoo_input_data *yid, struct yahoo_packet *pkt)
+{
+ struct yahoo_data *yd = yid->yd;
+ char *who = NULL;
+ char *where = NULL;
+ int unk_66 = 0;
+ char *me = NULL;
+ struct yahoo_buddy *bud;
+
+ YList *buddy;
+
+ YList *l;
+ for (l = pkt->hash; l; l = l->next) {
+ struct yahoo_pair *pair = l->data;
+ if (pair->key == 1)
+ me = pair->value;
+ else if (pair->key == 7)
+ who = pair->value;
+ else if (pair->key == 65)
+ where = pair->value;
+ else if (pair->key == 66)
+ unk_66 = strtol(pair->value, NULL, 10);
+ else
+ DEBUG_MSG(("unknown key: %d = %s", pair->key, pair->value));
+ }
+
+ if(!who || !where)
+ return;
+
+ bud = y_new0(struct yahoo_buddy, 1);
+ bud->id = strdup(who);
+ bud->group = strdup(where);
+
+ buddy = y_list_find_custom(yd->buddies, bud, is_same_bud);
+
+ FREE(bud->id);
+ FREE(bud->group);
+ FREE(bud);
+
+ if(buddy) {
+ bud = buddy->data;
+ yd->buddies = y_list_remove_link(yd->buddies, buddy);
+ y_list_free_1(buddy);
+
+ FREE(bud->id);
+ FREE(bud->group);
+ FREE(bud->real_name);
+ FREE(bud);
+
+ bud=NULL;
+ }
+}
+static void yahoo_process_yahoo7_change_group(struct yahoo_input_data *yid, struct yahoo_packet *pkt)
+{
+ struct yahoo_data *yd = yid->yd;
+ char *who = NULL;
+ char *me = NULL;
+ char *old_group = NULL;
+ char *new_group = NULL;
+
+ YList *l;
+ for (l = pkt->hash; l; l = l->next) {
+ struct yahoo_pair *pair = l->data;
+
+ switch (pair->key){
+ case 1:
+ me = pair->value;
+ break;
+ case 7:
+ who = pair->value;
+ break;
+ case 224:
+ old_group = pair->value;
+ break;
+ case 264:
+ new_group = pair->value;
+ break;
+ }
+ }
+
+ YAHOO_CALLBACK(ext_yahoo_buddy_group_changed)(yd->client_id, me, who, old_group, new_group);
+}
+
+static void yahoo_process_ignore(struct yahoo_input_data *yid, struct yahoo_packet *pkt)
+{
+ struct yahoo_data *yd = yid->yd;
+ char *who = NULL;
+ int status = 0;
+ char *me = NULL;
+ int un_ignore = 0;
+
+ YList *l;
+ for (l = pkt->hash; l; l = l->next) {
+ struct yahoo_pair *pair = l->data;
+ if (pair->key == 0)
+ who = pair->value;
+ if (pair->key == 1)
+ me = pair->value;
+ if (pair->key == 13) /* 1 == ignore, 2 == unignore */
+ un_ignore = strtol(pair->value, NULL, 10);
+ if (pair->key == 66)
+ status = strtol(pair->value, NULL, 10);
+ }
+
+
+ /*
+ * status
+ * 0 - ok
+ * 2 - already in ignore list, could not add
+ * 3 - not in ignore list, could not delete
+ * 12 - is a buddy, could not add
+ */
+
+ if(status) {
+ YAHOO_CALLBACK(ext_yahoo_error)(yd->client_id, who, 0, status);
+ } else {
+ /* we adding or removing to the ignore list */
+ if (un_ignore == 1) { /* ignore */
+ struct yahoo_buddy *bud = y_new0(struct yahoo_buddy, 1);
+
+ bud->id = strdup(who);
+ bud->group = NULL;
+ bud->real_name = NULL;
+
+ yd->ignore = y_list_append(yd->ignore, bud);
+
+ } else { /* unignore */
+ YList *buddy;
+
+ buddy = yd->ignore;
+
+ while (buddy) {
+ struct yahoo_buddy *b = (struct yahoo_buddy *) buddy->data;
+
+ if (lstrcmpi(b->id, who) == 0)
+ break;
+
+ buddy = buddy->next;
+ }
+
+ if(buddy) {
+ struct yahoo_buddy *bud = buddy->data;
+ yd->ignore = y_list_remove_link(yd->ignore, buddy);
+ y_list_free_1(buddy);
+
+ FREE(bud->id);
+ FREE(bud->group);
+ FREE(bud->real_name);
+ FREE(bud);
+
+ bud=NULL;
+ }
+ }
+ }
+}
+
+static void yahoo_process_stealth(struct yahoo_input_data *yid, struct yahoo_packet *pkt)
+{
+ //struct yahoo_data *yd = yid->yd;
+ char *who = NULL;
+ int status = 0;
+
+ YList *l;
+ for (l = pkt->hash; l; l = l->next) {
+ struct yahoo_pair *pair = l->data;
+ if (pair->key == 7)
+ who = pair->value;
+
+ if (pair->key == 31)
+ status = strtol(pair->value, NULL, 10);
+ }
+
+ NOTICE(("got %s stealth info for %s with value: %d", pkt->service == YAHOO_SERVICE_STEALTH_PERM ? "permanent": "session" , who, status == 1));
+}
+
+static void yahoo_process_voicechat(struct yahoo_input_data *yid, struct yahoo_packet *pkt)
+{
+ char *who = NULL;
+ char *me = NULL;
+ char *room = NULL;
+ char *voice_room = NULL;
+
+ YList *l;
+ for (l = pkt->hash; l; l = l->next) {
+ struct yahoo_pair *pair = l->data;
+ if (pair->key == 4)
+ who = pair->value;
+ if (pair->key == 5)
+ me = pair->value;
+ if (pair->key == 13)
+ voice_room=pair->value;
+ if (pair->key == 57)
+ room=pair->value;
+ }
+
+ NOTICE(("got voice chat invite from %s in %s to identity %s", who, room, me));
+ /*
+ * send: s:0 1:me 5:who 57:room 13:1
+ * ???? s:4 5:who 10:99 19:-1615114531
+ * gotr: s:4 5:who 10:99 19:-1615114615
+ * ???? s:1 5:me 4:who 57:room 13:3room
+ * got: s:1 5:me 4:who 57:room 13:1room
+ * rej: s:0 1:me 5:who 57:room 13:3
+ * rejr: s:4 5:who 10:99 19:-1617114599
+ */
+}
+
+static void yahoo_process_picture(struct yahoo_input_data *yid, struct yahoo_packet *pkt)
+{
+ char *who = NULL;
+ char *me = NULL;
+ char *pic_url = NULL;
+ int cksum = 0;
+ int type = 0;
+
+ YList *l;
+ for (l = pkt->hash; l; l = l->next) {
+ struct yahoo_pair *pair = l->data;
+
+ /* based on GAIM code */
+ switch (pair->key) {
+ case 1:
+ case 4:
+ who = pair->value;
+ break;
+ case 5:
+ me = pair->value;
+ break;
+ case 13:
+ type = strtol(pair->value, NULL, 10);
+ break;
+ case 20:
+ pic_url=pair->value;
+ break;
+ case 192:
+ cksum = strtol(pair->value, NULL, 10);
+ break;
+ } /*switch */
+
+ }
+ NOTICE(("got picture packet"));
+ YAHOO_CALLBACK(ext_yahoo_got_picture)(yid->yd->client_id, me, who, pic_url, cksum, type);
+}
+
+void yahoo_send_picture_info(int id, const char *who, int type, const char *pic_url, int cksum)
+{
+ struct yahoo_input_data *yid = find_input_by_id_and_type(id, YAHOO_CONNECTION_PAGER);
+ struct yahoo_data *yd;
+ struct yahoo_packet *pkt = NULL;
+ struct yahoo_server_settings *yss;
+ char buf[15];
+
+ if(!yid)
+ return;
+
+ yd = yid->yd;
+ yss = yd->server_settings;
+ pkt = yahoo_packet_new(YAHOO_SERVICE_PICTURE, YAHOO_STATUS_AVAILABLE, yd->session_id);
+
+ yahoo_packet_hash(pkt, 1, yd->user);
+ //yahoo_packet_hash(pkt, 4, yd->user);
+ yahoo_packet_hash(pkt, 5, who);
+
+ snprintf(buf, sizeof(buf), "%d", type); // 2 info, 3 invalidate
+ yahoo_packet_hash(pkt, 13, buf);
+
+ yahoo_packet_hash(pkt, 20, pic_url);
+
+ snprintf(buf, sizeof(buf), "%d", cksum);
+ yahoo_packet_hash(pkt, 192, buf);
+ yahoo_send_packet(yid, pkt, 0);
+
+ if (yss->web_messenger) {
+ char z[128];
+
+ yahoo_packet_hash(pkt, 0, yd->user);
+ wsprintf(z, "%d", yd->session_timestamp);
+ yahoo_packet_hash(pkt, 24, z);
+ }
+
+ yahoo_packet_free(pkt);
+}
+
+void yahoo_send_picture_update(int id, const char *who, int type)
+{
+ struct yahoo_input_data *yid = find_input_by_id_and_type(id, YAHOO_CONNECTION_PAGER);
+ struct yahoo_data *yd;
+ struct yahoo_packet *pkt = NULL;
+ struct yahoo_server_settings *yss;
+ char buf[2];
+
+ if(!yid)
+ return;
+
+ yd = yid->yd;
+ yss = yd->server_settings;
+ pkt = yahoo_packet_new(YAHOO_SERVICE_PICTURE_UPDATE, YAHOO_STATUS_AVAILABLE, yd->session_id);
+ yahoo_packet_hash(pkt, 1, yd->user);
+ yahoo_packet_hash(pkt, 5, who);
+
+ snprintf(buf, sizeof(buf), "%d", type);
+ yahoo_packet_hash(pkt, 206, buf);
+ yahoo_send_packet(yid, pkt, 0);
+
+ if (yss->web_messenger) {
+ char z[128];
+
+ yahoo_packet_hash(pkt, 0, yd->user);
+ wsprintf(z, "%d", yd->session_timestamp);
+ yahoo_packet_hash(pkt, 24, z);
+ }
+
+ yahoo_packet_free(pkt);
+}
+
+
+void yahoo_send_picture_checksum(int id, const char *who, int cksum)
+{
+ struct yahoo_input_data *yid = find_input_by_id_and_type(id, YAHOO_CONNECTION_PAGER);
+ struct yahoo_data *yd;
+ struct yahoo_packet *pkt = NULL;
+ struct yahoo_server_settings *yss;
+ char buf[22];
+
+ if(!yid)
+ return;
+
+ yd = yid->yd;
+ yss = yd->server_settings;
+ pkt = yahoo_packet_new(YAHOO_SERVICE_PICTURE_CHECKSUM, YAHOO_STATUS_AVAILABLE, yd->session_id);
+ yahoo_packet_hash(pkt, 1, yd->user);
+
+ if (who)
+ yahoo_packet_hash(pkt, 5, who); // ?
+
+ yahoo_packet_hash(pkt, 212, "1"); // ?
+
+ snprintf(buf, sizeof(buf), "%d", cksum);
+ yahoo_packet_hash(pkt, 192, buf); // checksum
+ yahoo_send_packet(yid, pkt, 0);
+
+ if (yss->web_messenger) {
+ char z[128];
+
+ yahoo_packet_hash(pkt, 0, yd->user);
+ wsprintf(z, "%d", yd->session_timestamp);
+ yahoo_packet_hash(pkt, 24, z);
+ }
+
+ yahoo_packet_free(pkt);
+
+ /* weird YIM7 sends another packet! See avatar_update below*/
+}
+
+void yahoo_send_avatar_update(int id, int buddy_icon)
+{
+ struct yahoo_input_data *yid = find_input_by_id_and_type(id, YAHOO_CONNECTION_PAGER);
+ struct yahoo_data *yd;
+ struct yahoo_packet *pkt = NULL;
+ struct yahoo_server_settings *yss;
+ char buf[2];
+
+ if(!yid)
+ return;
+
+ yd = yid->yd;
+ yss = yd->server_settings;
+ pkt = yahoo_packet_new(YAHOO_SERVICE_AVATAR_UPDATE, YAHOO_STATUS_AVAILABLE, yd->session_id);
+ yahoo_packet_hash(pkt, 3, yd->user);
+ snprintf(buf, sizeof(buf), "%d", buddy_icon);
+ yahoo_packet_hash(pkt, 213, buf);
+
+ if (yss->web_messenger) {
+ char z[128];
+
+ yahoo_packet_hash(pkt, 0, yd->user);
+ wsprintf(z, "%d", yd->session_timestamp);
+ yahoo_packet_hash(pkt, 24, z);
+ }
+
+ yahoo_send_packet(yid, pkt, 0);
+
+ yahoo_packet_free(pkt);
+}
+
+static void yahoo_process_picture_checksum(struct yahoo_input_data *yid, struct yahoo_packet *pkt)
+{
+ char *who = NULL;
+ char *me = NULL;
+ int cksum = 0;
+
+ YList *l;
+ for (l = pkt->hash; l; l = l->next) {
+ struct yahoo_pair *pair = l->data;
+ if (pair->key == 4)
+ who = pair->value;
+ if (pair->key == 5)
+ me = pair->value;
+ if (pair->key == 192)
+ cksum = strtol(pair->value, NULL, 10);
+
+ }
+ NOTICE(("got picture_checksum packet"));
+ YAHOO_CALLBACK(ext_yahoo_got_picture_checksum)(yid->yd->client_id, me, who, cksum);
+}
+
+static void yahoo_process_picture_update(struct yahoo_input_data *yid, struct yahoo_packet *pkt)
+{
+ char *who = NULL;
+ char *me = NULL;
+ int buddy_icon = -1;
+
+ YList *l;
+ for (l = pkt->hash; l; l = l->next) {
+ struct yahoo_pair *pair = l->data;
+ if (pair->key == 4)
+ who = pair->value;
+ if (pair->key == 5)
+ me = pair->value;
+ if (pair->key == 206)
+ buddy_icon = strtol(pair->value, NULL, 10);
+
+ }
+ NOTICE(("got picture_update packet"));
+ YAHOO_CALLBACK(ext_yahoo_got_picture_update)(yid->yd->client_id, me, who, buddy_icon);
+}
+
+static void yahoo_process_picture_upload(struct yahoo_input_data *yid, struct yahoo_packet *pkt)
+{
+ char *url = NULL;
+ char *me = NULL;
+ unsigned int ts = 0;
+
+ YList *l;
+ for (l = pkt->hash; l; l = l->next) {
+ struct yahoo_pair *pair = l->data;
+ switch (pair->key){
+ case 5: /* our id */
+ me = pair->value;
+ break;
+ case 27: /* filename on our computer */
+ break;
+ case 20: /* url at yahoo */
+ url = pair->value;
+ break;
+ case 38: /* timestamp */
+ ts = strtol(pair->value, NULL, 10);
+ break;
+ }
+ }
+ NOTICE(("got picture_upload packet"));
+ YAHOO_CALLBACK(ext_yahoo_got_picture_upload)(yid->yd->client_id, me, url, ts);
+}
+
+static void yahoo_process_avatar_update(struct yahoo_input_data *yid, struct yahoo_packet *pkt)
+{
+ char *who = NULL;
+ char *me = NULL;
+ int buddy_icon = -1;
+
+ YList *l;
+ for (l = pkt->hash; l; l = l->next) {
+ struct yahoo_pair *pair = l->data;
+ switch (pair->key){
+ case 5: /* our id */
+ me = pair->value;
+ break;
+ case 4: /* who is notifying all */
+ who = pair->value;
+ break;
+ case 213: /* picture = 0-none, 1-?, 2=picture */
+ buddy_icon = strtol(pair->value, NULL, 10);
+ break;
+ }
+ }
+ NOTICE(("got picture_upload packet"));
+ if (who) // sometimes we just get a confirmation without the WHO.(ack on our avt update)
+ YAHOO_CALLBACK(ext_yahoo_got_avatar_update)(yid->yd->client_id, me, who, buddy_icon);
+}
+
+static void yahoo_process_audible(struct yahoo_input_data *yid, struct yahoo_packet *pkt)
+{
+ char *who = NULL;
+ char *me = NULL;
+ char *aud_hash=NULL;
+ char *msg = NULL;
+ char *aud = NULL;
+
+ YList *l;
+ for (l = pkt->hash; l; l = l->next) {
+ struct yahoo_pair *pair = l->data;
+ switch (pair->key){
+ case 5: /* our id */
+ me = pair->value;
+ break;
+ case 4: /* who is notifying all */
+ who = pair->value;
+ break;
+ case 230: /* file class name
+ GAIM: the audible, in foo.bar.baz format
+
+ Actually this is the filename.
+ Full URL:
+
+ http://us.dl1.yimg.com/download.yahoo.com/dl/aud/us/aud.swf
+
+ where aud in foo.bar.baz format
+ */
+ aud = pair->value;
+ break;
+ case 231: /*audible text*/
+ msg = pair->value;
+ break;
+ case 232: /* weird number (md5 hash?) */
+ aud_hash = pair->value;
+ break;
+ }
+ }
+ NOTICE(("got picture_upload packet"));
+ if (who) // sometimes we just get a confirmation without the WHO.(ack on our send/update)
+ YAHOO_CALLBACK(ext_yahoo_got_audible)(yid->yd->client_id, me, who, aud, msg, aud_hash);
+}
+
+static void yahoo_process_calendar(struct yahoo_input_data *yid, struct yahoo_packet *pkt)
+{
+ char *msg = NULL;
+ char *url = NULL;
+ int svc = -1, type = -1;
+
+ YList *l;
+
+ for (l = pkt->hash; l; l = l->next) {
+ struct yahoo_pair *pair = l->data;
+ switch (pair->key){
+ case 20: /* url to calendar reminder/event */
+ if (pair->value[0] != '\0')
+ url = pair->value;
+ break;
+ case 21: /* type? number seems to be 0? */
+ type = atol(pair->value);
+ break;
+ case 14: /* index msg/title ? */
+ if (pair->value[0] != '\0')
+ msg = pair->value;
+ break;
+ case 13: /* service # ? */
+ svc = atol(pair->value);
+ break;
+ }
+ }
+
+ if (url) // sometimes we just get a reminder w/o the URL
+ YAHOO_CALLBACK(ext_yahoo_got_calendar)(yid->yd->client_id, url, type, msg, svc);
+}
+
+
+static void yahoo_process_ping(struct yahoo_input_data *yid, struct yahoo_packet *pkt)
+{
+ char *errormsg = NULL;
+
+ YList *l;
+ for (l = pkt->hash; l; l = l->next) {
+ struct yahoo_pair *pair = l->data;
+ if (pair->key == 16)
+ errormsg = pair->value;
+ }
+
+ NOTICE(("got ping packet"));
+ YAHOO_CALLBACK(ext_yahoo_got_ping)(yid->yd->client_id, errormsg);
+}
+
+static void yahoo_process_yab_update(struct yahoo_input_data *yid, struct yahoo_packet *pkt)
+{
+ char *who=NULL,*yentry=NULL;
+ int svc=0;
+ YList *l;
+
+ /*
+ [15:42:00 YAHOO] Yahoo Service: (null) (0xc4) Status: YAHOO_STATUS_AVAILABLE (0)
+[15:42:00 YAHOO]
+[15:42:00 YAHOO] libyahoo2/libyahoo2.c:900: debug:
+[15:42:00 YAHOO] [Reading packet] len: 309
+[15:42:00 YAHOO]
+[15:42:00 YAHOO] Key: To (5) Value: 'xxxxxxx'
+[15:42:00 YAHOO]
+[15:42:00 YAHOO] Key: (null) (203) Value: '<?xml version="1.0" encoding="ISO-8859-1"?>
+ <ab k="aaaaaaa" cc="1" ec="1" rs="OK"><ct e="1" id="1" mt="1147894756" cr="1090811437" fn="ZZZ" ln="XXX"
+ e0="aaaa@yahoo.com" nn="AAAA" ca="Unfiled" yi="xxxxxxx" pr="0" cm="Some personal notes here."
+ imm="xxxxxx@hotmail.com"/></ab>'
+[15:42:00 YAHOO]
+[15:42:00 YAHOO] Key: stat/location (13) Value: '1'
+
+ */
+ for (l = pkt->hash; l; l = l->next) {
+ struct yahoo_pair *pair = l->data;
+ switch (pair->key) {
+ case 5: /* who */
+ who = pair->value;
+ break;
+ case 203: /* yab entry */
+ yentry = pair->value;
+ break;
+ case 13: /* type of update */
+ svc = atoi(pair->value);
+ }
+ }
+
+ NOTICE(("got YAB Update packet"));
+ //YAHOO_CALLBACK(ext_yahoo_got_ping)(yid->yd->client_id, errormsg);
+}
+
+static void _yahoo_webcam_get_server_connected(int fd, int error, void *d)
+{
+ struct yahoo_input_data *yid = d;
+ char *who = yid->wcm->user;
+ char *data = NULL;
+ char *packet = NULL;
+ unsigned char magic_nr[] = {0, 1, 0};
+ unsigned char header_len = 8;
+ unsigned int len = 0;
+ unsigned int pos = 0;
+
+ if(error || fd <= 0) {
+ FREE(who);
+ FREE(yid);
+ return;
+ }
+
+ yid->fd = fd;
+ inputs = y_list_prepend(inputs, yid);
+
+ /* send initial packet */
+ if (who)
+ data = strdup("<RVWCFG>");
+ else
+ data = strdup("<RUPCFG>");
+ yahoo_add_to_send_queue(yid, data, strlen(data));
+ FREE(data);
+
+ /* send data */
+ if (who)
+ {
+ data = strdup("g=");
+ data = y_string_append(data, who);
+ data = y_string_append(data, "\r\n");
+ } else {
+ data = strdup("f=1\r\n");
+ }
+ len = strlen(data);
+ packet = y_new0(char, header_len + len);
+ packet[pos++] = header_len;
+ memcpy(packet + pos, magic_nr, sizeof(magic_nr));
+ pos += sizeof(magic_nr);
+ pos += yahoo_put32(packet + pos, len);
+ memcpy(packet + pos, data, len);
+ pos += len;
+ yahoo_add_to_send_queue(yid, packet, pos);
+ FREE(packet);
+ FREE(data);
+
+ yid->read_tag=YAHOO_CALLBACK(ext_yahoo_add_handler)(yid->yd->client_id, fd, YAHOO_INPUT_READ, yid);
+}
+
+static void yahoo_webcam_get_server(struct yahoo_input_data *y, char *who, char *key)
+{
+ struct yahoo_input_data *yid = y_new0(struct yahoo_input_data, 1);
+ struct yahoo_server_settings *yss = y->yd->server_settings;
+
+ yid->type = YAHOO_CONNECTION_WEBCAM_MASTER;
+ yid->yd = y->yd;
+ yid->wcm = y_new0(struct yahoo_webcam, 1);
+ yid->wcm->user = who?strdup(who):NULL;
+ yid->wcm->direction = who?YAHOO_WEBCAM_DOWNLOAD:YAHOO_WEBCAM_UPLOAD;
+ yid->wcm->key = strdup(key);
+
+ YAHOO_CALLBACK(ext_yahoo_connect_async)(yid->yd->client_id, yss->webcam_host, yss->webcam_port, yid->type,
+ _yahoo_webcam_get_server_connected, yid);
+
+}
+
+static YList *webcam_queue=NULL;
+static void yahoo_process_webcam_key(struct yahoo_input_data *yid, struct yahoo_packet *pkt)
+{
+ char *me = NULL;
+ char *key = NULL;
+ char *who = NULL;
+
+ YList *l;
+ yahoo_dump_unhandled(pkt);
+ for (l = pkt->hash; l; l = l->next) {
+ struct yahoo_pair *pair = l->data;
+ if (pair->key == 5)
+ me = pair->value;
+ if (pair->key == 61)
+ key=pair->value;
+ }
+
+ l = webcam_queue;
+ if(!l)
+ return;
+ who = l->data;
+ webcam_queue = y_list_remove_link(webcam_queue, webcam_queue);
+ y_list_free_1(l);
+ yahoo_webcam_get_server(yid, who, key);
+ FREE(who);
+}
+
+static void yahoo_packet_process(struct yahoo_input_data *yid, struct yahoo_packet *pkt)
+{
+ DEBUG_MSG(("yahoo_packet_process: 0x%02x", pkt->service));
+ switch (pkt->service)
+ {
+ case YAHOO_SERVICE_LOGON:
+ yahoo_process_logon(yid, pkt);
+ break;
+ case YAHOO_SERVICE_USERSTAT:
+ case YAHOO_SERVICE_LOGOFF:
+ case YAHOO_SERVICE_ISAWAY:
+ case YAHOO_SERVICE_ISBACK:
+ case YAHOO_SERVICE_GAMELOGON:
+ case YAHOO_SERVICE_GAMELOGOFF:
+ case YAHOO_SERVICE_IDACT:
+ case YAHOO_SERVICE_IDDEACT:
+ case YAHOO_SERVICE_Y6_STATUS_UPDATE:
+ yahoo_process_status(yid, pkt);
+ break;
+ case YAHOO_SERVICE_NOTIFY:
+ yahoo_process_notify(yid, pkt);
+ break;
+ case YAHOO_SERVICE_MESSAGE:
+ case YAHOO_SERVICE_GAMEMSG:
+ case YAHOO_SERVICE_SYSMESSAGE:
+ yahoo_process_message(yid, pkt);
+ break;
+ case YAHOO_SERVICE_NEWMAIL:
+ yahoo_process_mail(yid, pkt);
+ break;
+ case YAHOO_SERVICE_NEWCONTACT:
+ yahoo_process_contact(yid, pkt);
+ break;
+ case YAHOO_SERVICE_LIST:
+ yahoo_process_list(yid, pkt);
+ break;
+ case YAHOO_SERVICE_VERIFY:
+ yahoo_process_verify(yid, pkt);
+ break;
+ case YAHOO_SERVICE_AUTH:
+ yahoo_process_auth(yid, pkt);
+ break;
+ case YAHOO_SERVICE_AUTHRESP:
+ yahoo_process_auth_resp(yid, pkt);
+ break;
+ case YAHOO_SERVICE_CONFINVITE:
+ case YAHOO_SERVICE_CONFADDINVITE:
+ case YAHOO_SERVICE_CONFDECLINE:
+ case YAHOO_SERVICE_CONFLOGON:
+ case YAHOO_SERVICE_CONFLOGOFF:
+ case YAHOO_SERVICE_CONFMSG:
+ yahoo_process_conference(yid, pkt);
+ break;
+ case YAHOO_SERVICE_CHATONLINE:
+ case YAHOO_SERVICE_CHATGOTO:
+ case YAHOO_SERVICE_CHATJOIN:
+ case YAHOO_SERVICE_CHATLEAVE:
+ case YAHOO_SERVICE_CHATEXIT:
+ case YAHOO_SERVICE_CHATLOGOUT:
+ case YAHOO_SERVICE_CHATPING:
+ case YAHOO_SERVICE_COMMENT:
+ yahoo_process_chat(yid, pkt);
+ break;
+ case YAHOO_SERVICE_P2PFILEXFER:
+ case YAHOO_SERVICE_FILETRANSFER:
+ yahoo_process_filetransfer(yid, pkt);
+ break;
+ case YAHOO_SERVICE_ADDBUDDY:
+ yahoo_process_buddyadd(yid, pkt);
+ break;
+ case YAHOO_SERVICE_REMBUDDY:
+ yahoo_process_buddydel(yid, pkt);
+ break;
+ case YAHOO_SERVICE_IGNORECONTACT:
+ yahoo_process_ignore(yid, pkt);
+ break;
+ case YAHOO_SERVICE_STEALTH_PERM:
+ case YAHOO_SERVICE_STEALTH_SESSION:
+ yahoo_process_stealth(yid, pkt);
+ break;
+ case YAHOO_SERVICE_VOICECHAT:
+ yahoo_process_voicechat(yid, pkt);
+ break;
+ case YAHOO_SERVICE_WEBCAM:
+ yahoo_process_webcam_key(yid, pkt);
+ break;
+ case YAHOO_SERVICE_PING:
+ yahoo_process_ping(yid, pkt);
+ break;
+ case YAHOO_SERVICE_PICTURE:
+ yahoo_process_picture(yid, pkt);
+ break;
+ case YAHOO_SERVICE_PICTURE_CHECKSUM:
+ yahoo_process_picture_checksum(yid, pkt);
+ break;
+ case YAHOO_SERVICE_PICTURE_UPDATE:
+ yahoo_process_picture_update(yid, pkt);
+ break;
+ case YAHOO_SERVICE_PICTURE_UPLOAD:
+ yahoo_process_picture_upload(yid, pkt);
+ break;
+ case YAHOO_SERVICE_YAB_UPDATE:
+ yahoo_process_yab_update(yid, pkt);
+ break;
+ case YAHOO_SERVICE_AVATAR_UPDATE:
+ yahoo_process_avatar_update(yid, pkt);
+ break;
+ case YAHOO_SERVICE_AUDIBLE:
+ yahoo_process_audible(yid, pkt);
+ break;
+ case YAHOO_SERVICE_CALENDAR:
+ yahoo_process_calendar(yid, pkt);
+ break;
+ case YAHOO_SERVICE_Y7_AUTHORIZATION:
+ yahoo_process_authorization(yid, pkt);
+ break;
+ case YAHOO_SERVICE_Y7_FILETRANSFER:
+ yahoo_process_filetransfer7(yid, pkt);
+ break;
+ case YAHOO_SERVICE_Y7_FILETRANSFERINFO:
+ yahoo_process_filetransfer7info(yid, pkt);
+ break;
+ case YAHOO_SERVICE_Y7_CHANGE_GROUP:
+ yahoo_process_yahoo7_change_group(yid, pkt);
+ break;
+ case YAHOO_SERVICE_IDLE:
+ case YAHOO_SERVICE_MAILSTAT:
+ case YAHOO_SERVICE_CHATINVITE:
+ case YAHOO_SERVICE_NEWPERSONALMAIL:
+ case YAHOO_SERVICE_ADDIDENT:
+ case YAHOO_SERVICE_ADDIGNORE:
+ case YAHOO_SERVICE_GOTGROUPRENAME:
+ case YAHOO_SERVICE_GROUPRENAME:
+ case YAHOO_SERVICE_PASSTHROUGH2:
+ case YAHOO_SERVICE_CHATLOGON:
+ case YAHOO_SERVICE_CHATLOGOFF:
+ case YAHOO_SERVICE_CHATMSG:
+ case YAHOO_SERVICE_REJECTCONTACT:
+ case YAHOO_SERVICE_PEERTOPEER:
+ WARNING(("unhandled service 0x%02x", pkt->service));
+ yahoo_dump_unhandled(pkt);
+ break;
+ default:
+ WARNING(("unknown service 0x%02x", pkt->service));
+ yahoo_dump_unhandled(pkt);
+ break;
+ }
+}
+
+static struct yahoo_packet * yahoo_getdata(struct yahoo_input_data * yid)
+{
+ struct yahoo_packet *pkt;
+ struct yahoo_data *yd = yid->yd;
+ int pos = 0;
+ int pktlen;
+
+ if(!yd)
+ return NULL;
+
+ DEBUG_MSG(("rxlen is %d", yid->rxlen));
+ if (yid->rxlen < YAHOO_PACKET_HDRLEN) {
+ DEBUG_MSG(("len < YAHOO_PACKET_HDRLEN"));
+ return NULL;
+ }
+
+ /*DEBUG_MSG(("Dumping Packet Header:"));
+ yahoo_packet_dump(yid->rxqueue + pos, YAHOO_PACKET_HDRLEN);
+ DEBUG_MSG(("--- Done Dumping Packet Header ---"));*/
+ {
+ char *buf = yid->rxqueue + pos;
+
+ if (buf[0] != 'Y' || buf[1] != 'M' || buf[2] != 'S' || buf[3] != 'G') {
+ DEBUG_MSG(("Not a YMSG packet?"));
+ return NULL;
+ }
+ }
+ pos += 4; /* YMSG */
+ pos += 2;
+ pos += 2;
+
+ pktlen = yahoo_get16(yid->rxqueue + pos); pos += 2;
+ DEBUG_MSG(("%d bytes to read, rxlen is %d",
+ pktlen, yid->rxlen));
+
+ if (yid->rxlen < (YAHOO_PACKET_HDRLEN + pktlen)) {
+ DEBUG_MSG(("len < YAHOO_PACKET_HDRLEN + pktlen"));
+ return NULL;
+ }
+
+ LOG(("reading packet"));
+ //yahoo_packet_dump(yid->rxqueue, YAHOO_PACKET_HDRLEN + pktlen);
+
+ pkt = yahoo_packet_new(0, 0, 0);
+
+ pkt->service = yahoo_get16(yid->rxqueue + pos); pos += 2;
+ pkt->status = yahoo_get32(yid->rxqueue + pos); pos += 4;
+ DEBUG_MSG(("Yahoo Service: %s (0x%02x) Status: %s (%d)", dbg_service(pkt->service), pkt->service,
+ dbg_status(pkt->status),pkt->status));
+ pkt->id = yahoo_get32(yid->rxqueue + pos); pos += 4;
+
+ yd->session_id = pkt->id;
+
+ yahoo_packet_read(pkt, yid->rxqueue + pos, pktlen);
+
+ yid->rxlen -= YAHOO_PACKET_HDRLEN + pktlen;
+ //DEBUG_MSG(("rxlen == %d, rxqueue == %p", yid->rxlen, yid->rxqueue));
+ if (yid->rxlen>0) {
+ unsigned char *tmp = y_memdup(yid->rxqueue + YAHOO_PACKET_HDRLEN
+ + pktlen, yid->rxlen);
+ FREE(yid->rxqueue);
+ yid->rxqueue = tmp;
+ //DEBUG_MSG(("new rxlen == %d, rxqueue == %p", yid->rxlen, yid->rxqueue));
+ } else {
+ //DEBUG_MSG(("freed rxqueue == %p", yid->rxqueue));
+ FREE(yid->rxqueue);
+ }
+
+ return pkt;
+}
+
+static void yahoo_yab_read(struct yab *yab, unsigned char *d, int len)
+{
+ char *st, *en;
+ char *data = (char *)d;
+ data[len]='\0';
+
+ DEBUG_MSG(("Got yab: %s", data));
+ st = en = strstr(data, "userid=\"");
+ if(st) {
+ st += strlen("userid=\"");
+ en = strchr(st, '"'); *en++ = '\0';
+ yab->id = yahoo_xmldecode(st);
+ }
+
+ st = strstr(en, "fname=\"");
+ if(st) {
+ st += strlen("fname=\"");
+ en = strchr(st, '"'); *en++ = '\0';
+ yab->fname = yahoo_xmldecode(st);
+ }
+
+ st = strstr(en, "lname=\"");
+ if(st) {
+ st += strlen("lname=\"");
+ en = strchr(st, '"'); *en++ = '\0';
+ yab->lname = yahoo_xmldecode(st);
+ }
+
+ st = strstr(en, "nname=\"");
+ if(st) {
+ st += strlen("nname=\"");
+ en = strchr(st, '"'); *en++ = '\0';
+ yab->nname = yahoo_xmldecode(st);
+ }
+
+ st = strstr(en, "email=\"");
+ if(st) {
+ st += strlen("email=\"");
+ en = strchr(st, '"'); *en++ = '\0';
+ yab->email = yahoo_xmldecode(st);
+ }
+
+ st = strstr(en, "hphone=\"");
+ if(st) {
+ st += strlen("hphone=\"");
+ en = strchr(st, '"'); *en++ = '\0';
+ yab->hphone = yahoo_xmldecode(st);
+ }
+
+ st = strstr(en, "wphone=\"");
+ if(st) {
+ st += strlen("wphone=\"");
+ en = strchr(st, '"'); *en++ = '\0';
+ yab->wphone = yahoo_xmldecode(st);
+ }
+
+ st = strstr(en, "mphone=\"");
+ if(st) {
+ st += strlen("mphone=\"");
+ en = strchr(st, '"'); *en++ = '\0';
+ yab->mphone = yahoo_xmldecode(st);
+ }
+
+ st = strstr(en, "dbid=\"");
+ if(st) {
+ st += strlen("dbid=\"");
+ en = strchr(st, '"'); *en++ = '\0';
+ yab->dbid = atoi(st);
+ }
+}
+
+static struct yab * yahoo_getyab(struct yahoo_input_data *yid)
+{
+ struct yab *yab = NULL;
+ int pos = 0, end=0;
+ struct yahoo_data *yd = yid->yd;
+
+ if(!yd)
+ return NULL;
+
+ DEBUG_MSG(("rxlen is %d", yid->rxlen));
+
+ if(yid->rxlen <= strlen("<record"))
+ return NULL;
+
+ /* start with <record */
+ while(pos < yid->rxlen-strlen("<record")+1
+ && memcmp(yid->rxqueue + pos, "<record", strlen("<record")))
+ pos++;
+
+ if(pos >= yid->rxlen-1)
+ return NULL;
+
+ end = pos+2;
+ /* end with /> */
+ while(end < yid->rxlen-strlen("/>")+1 && memcmp(yid->rxqueue + end, "/>", strlen("/>")))
+ end++;
+
+ if(end >= yid->rxlen-1)
+ return NULL;
+
+ yab = y_new0(struct yab, 1);
+ yahoo_yab_read(yab, yid->rxqueue + pos, end+2-pos);
+
+
+ yid->rxlen -= end+1;
+ //DEBUG_MSG(("rxlen == %d, rxqueue == %p", yid->rxlen, yid->rxqueue));
+ if (yid->rxlen>0) {
+ unsigned char *tmp = y_memdup(yid->rxqueue + end + 1, yid->rxlen);
+ FREE(yid->rxqueue);
+ yid->rxqueue = tmp;
+ //DEBUG_MSG(("new rxlen == %d, rxqueue == %p", yid->rxlen, yid->rxqueue));
+ } else {
+ //DEBUG_MSG(("freed rxqueue == %p", yid->rxqueue));
+ FREE(yid->rxqueue);
+ }
+
+
+ return yab;
+}
+
+static char * yahoo_getwebcam_master(struct yahoo_input_data *yid)
+{
+ unsigned int pos=0;
+ unsigned int len=0;
+ unsigned int status=0;
+ char *server=NULL;
+ struct yahoo_data *yd = yid->yd;
+
+ if(!yid || !yd)
+ return NULL;
+
+ DEBUG_MSG(("rxlen is %d", yid->rxlen));
+
+ len = yid->rxqueue[pos++];
+ if (yid->rxlen < len)
+ return NULL;
+
+ /* extract status (0 = ok, 6 = webcam not online) */
+ status = yid->rxqueue[pos++];
+
+ if (status == 0)
+ {
+ pos += 2; /* skip next 2 bytes */
+ server = y_memdup(yid->rxqueue+pos, 16);
+ pos += 16;
+ }
+ else if (status == 6)
+ {
+ YAHOO_CALLBACK(ext_yahoo_webcam_closed)
+ (yd->client_id, yid->wcm->user, 4);
+ }
+
+ /* skip rest of the data */
+
+ yid->rxlen -= len;
+ DEBUG_MSG(("rxlen == %d, rxqueue == %p", yid->rxlen, yid->rxqueue));
+ if (yid->rxlen>0) {
+ unsigned char *tmp = y_memdup(yid->rxqueue + pos, yid->rxlen);
+ FREE(yid->rxqueue);
+ yid->rxqueue = tmp;
+ DEBUG_MSG(("new rxlen == %d, rxqueue == %p", yid->rxlen, yid->rxqueue));
+ } else {
+ DEBUG_MSG(("freed rxqueue == %p", yid->rxqueue));
+ FREE(yid->rxqueue);
+ }
+
+ return server;
+}
+
+static int yahoo_get_webcam_data(struct yahoo_input_data *yid)
+{
+ unsigned char reason=0;
+ unsigned int pos=0;
+ unsigned int begin=0;
+ unsigned int end=0;
+ unsigned int closed=0;
+ unsigned char header_len=0;
+ char *who;
+ int connect=0;
+ struct yahoo_data *yd = yid->yd;
+
+ if(!yd)
+ return -1;
+
+ if(!yid->wcm || !yid->wcd || !yid->rxlen)
+ return -1;
+
+ DEBUG_MSG(("rxlen is %d", yid->rxlen));
+
+ /* if we are not reading part of image then read header */
+ if (!yid->wcd->to_read)
+ {
+ header_len=yid->rxqueue[pos++];
+ yid->wcd->packet_type=0;
+
+ if (yid->rxlen < header_len)
+ return 0;
+
+ if (header_len >= 8)
+ {
+ reason = yid->rxqueue[pos++];
+ /* next 2 bytes should always be 05 00 */
+ pos += 2;
+ yid->wcd->data_size = yahoo_get32(yid->rxqueue + pos);
+ pos += 4;
+ yid->wcd->to_read = yid->wcd->data_size;
+ }
+ if (header_len >= 13)
+ {
+ yid->wcd->packet_type = yid->rxqueue[pos++];
+ yid->wcd->timestamp = yahoo_get32(yid->rxqueue + pos);
+ pos += 4;
+ }
+
+ /* skip rest of header */
+ pos = header_len;
+ }
+
+ begin = pos;
+ pos += yid->wcd->to_read;
+ if (pos > yid->rxlen) pos = yid->rxlen;
+
+ /* if it is not an image then make sure we have the whole packet */
+ if (yid->wcd->packet_type != 0x02) {
+ if ((pos - begin) != yid->wcd->data_size) {
+ yid->wcd->to_read = 0;
+ return 0;
+ } else {
+ yahoo_packet_dump(yid->rxqueue + begin, pos - begin);
+ }
+ }
+
+ DEBUG_MSG(("packet type %.2X, data length %d", yid->wcd->packet_type,
+ yid->wcd->data_size));
+
+ /* find out what kind of packet we got */
+ switch (yid->wcd->packet_type)
+ {
+ case 0x00:
+ /* user requests to view webcam (uploading) */
+ if (yid->wcd->data_size &&
+ yid->wcm->direction == YAHOO_WEBCAM_UPLOAD) {
+ end = begin;
+ while (end <= yid->rxlen &&
+ yid->rxqueue[end++] != 13);
+ if (end > begin)
+ {
+ who = y_memdup(yid->rxqueue + begin, end - begin);
+ who[end - begin - 1] = 0;
+ YAHOO_CALLBACK(ext_yahoo_webcam_viewer)(yd->client_id, who + 2, 2);
+ FREE(who);
+ }
+ }
+
+ if (yid->wcm->direction == YAHOO_WEBCAM_DOWNLOAD) {
+ /* timestamp/status field */
+ /* 0 = declined viewing permission */
+ /* 1 = accepted viewing permission */
+ if (yid->wcd->timestamp == 0) {
+ YAHOO_CALLBACK(ext_yahoo_webcam_closed)(yd->client_id, yid->wcm->user, 3);
+ }
+ }
+ break;
+ case 0x01: /* status packets?? */
+ /* timestamp contains status info */
+ /* 00 00 00 01 = we have data?? */
+ break;
+ case 0x02: /* image data */
+ YAHOO_CALLBACK(ext_yahoo_got_webcam_image)(yd->client_id,
+ yid->wcm->user, yid->rxqueue + begin,
+ yid->wcd->data_size, pos - begin,
+ yid->wcd->timestamp);
+ break;
+ case 0x05: /* response packets when uploading */
+ if (!yid->wcd->data_size) {
+ YAHOO_CALLBACK(ext_yahoo_webcam_data_request)(yd->client_id, yid->wcd->timestamp);
+ }
+ break;
+ case 0x07: /* connection is closing */
+ switch(reason)
+ {
+ case 0x01: /* user closed connection */
+ closed = 1;
+ break;
+ case 0x0F: /* user cancelled permission */
+ closed = 2;
+ break;
+ }
+ YAHOO_CALLBACK(ext_yahoo_webcam_closed)(yd->client_id, yid->wcm->user, closed);
+ break;
+ case 0x0C: /* user connected */
+ case 0x0D: /* user disconnected */
+ if (yid->wcd->data_size) {
+ who = y_memdup(yid->rxqueue + begin, pos - begin + 1);
+ who[pos - begin] = 0;
+ if (yid->wcd->packet_type == 0x0C)
+ connect=1;
+ else
+ connect=0;
+ YAHOO_CALLBACK(ext_yahoo_webcam_viewer)(yd->client_id, who, connect);
+ FREE(who);
+ }
+ break;
+ case 0x13: /* user data */
+ /* i=user_ip (ip of the user we are viewing) */
+ /* j=user_ext_ip (external ip of the user we */
+ /* are viewing) */
+ break;
+ case 0x17: /* ?? */
+ break;
+ }
+ yid->wcd->to_read -= pos - begin;
+
+ yid->rxlen -= pos;
+ DEBUG_MSG(("rxlen == %d, rxqueue == %p", yid->rxlen, yid->rxqueue));
+ if (yid->rxlen>0) {
+ unsigned char *tmp = y_memdup(yid->rxqueue + pos, yid->rxlen);
+ FREE(yid->rxqueue);
+ yid->rxqueue = tmp;
+ DEBUG_MSG(("new rxlen == %d, rxqueue == %p", yid->rxlen, yid->rxqueue));
+ } else {
+ DEBUG_MSG(("freed rxqueue == %p", yid->rxqueue));
+ FREE(yid->rxqueue);
+ }
+
+ /* If we read a complete packet return success */
+ if (!yid->wcd->to_read)
+ return 1;
+
+ return 0;
+}
+
+int yahoo_write_ready(int id, int fd, void *data)
+{
+ struct yahoo_input_data *yid = data;
+ int len;
+ struct data_queue *tx;
+
+ LOG(("write callback: id=%d fd=%d data=%p", id, fd, data));
+ if(!yid || !yid->txqueues)
+ return -2;
+
+ tx = yid->txqueues->data;
+ LOG(("writing %d bytes", tx->len));
+ len = yahoo_send_data(fd, tx->queue, MIN(1024, tx->len));
+
+ if(len == -1 && errno == EAGAIN)
+ return 1;
+
+ if(len <= 0) {
+ int e = errno;
+ DEBUG_MSG(("len == %d (<= 0)", len));
+ while(yid->txqueues) {
+ YList *l=yid->txqueues;
+ tx = l->data;
+ free(tx->queue);
+ free(tx);
+ yid->txqueues = y_list_remove_link(yid->txqueues, yid->txqueues);
+ y_list_free_1(l);
+ }
+ LOG(("yahoo_write_ready(%d, %d) len < 0", id, fd));
+ YAHOO_CALLBACK(ext_yahoo_remove_handler)(id, yid->write_tag);
+ yid->write_tag = 0;
+ errno=e;
+ return 0;
+ }
+
+
+ tx->len -= len;
+ LOG(("yahoo_write_ready(%d, %d) tx->len: %d, len: %d", id, fd, tx->len, len));
+ if(tx->len > 0) {
+ unsigned char *tmp = y_memdup(tx->queue + len, tx->len);
+ FREE(tx->queue);
+ tx->queue = tmp;
+ } else {
+ YList *l=yid->txqueues;
+ free(tx->queue);
+ free(tx);
+ yid->txqueues = y_list_remove_link(yid->txqueues, yid->txqueues);
+ y_list_free_1(l);
+ if(!yid->txqueues) {
+ LOG(("yahoo_write_ready(%d, %d) !txqueues", id, fd));
+ YAHOO_CALLBACK(ext_yahoo_remove_handler)(id, yid->write_tag);
+ yid->write_tag = 0;
+ }
+ }
+
+ return 1;
+}
+
+static void yahoo_process_pager_connection(struct yahoo_input_data *yid, int over)
+{
+ struct yahoo_packet *pkt;
+ struct yahoo_data *yd = yid->yd;
+ int id = yd->client_id;
+
+ if(over)
+ return;
+
+ while (find_input_by_id_and_type(id, YAHOO_CONNECTION_PAGER)
+ && (pkt = yahoo_getdata(yid)) != NULL) {
+
+ yahoo_packet_process(yid, pkt);
+
+ yahoo_packet_free(pkt);
+ }
+}
+
+static void yahoo_process_ft_connection(struct yahoo_input_data *yid, int over)
+{
+}
+
+static void yahoo_process_chatcat_connection(struct yahoo_input_data *yid, int over)
+{
+ if(over)
+ return;
+
+ if (strstr((char*)yid->rxqueue+(yid->rxlen-20), "</content>")) {
+ YAHOO_CALLBACK(ext_yahoo_chat_cat_xml)(yid->yd->client_id, (char*)yid->rxqueue);
+ }
+}
+
+static void yahoo_process_yab_connection(struct yahoo_input_data *yid, int over)
+{
+ struct yahoo_data *yd = yid->yd;
+ struct yab *yab;
+ YList *buds;
+ int changed=0;
+ int id = yd->client_id;
+
+ if(over)
+ return;
+
+ while(find_input_by_id_and_type(id, YAHOO_CONNECTION_YAB)
+ && (yab = yahoo_getyab(yid)) != NULL) {
+ if(!yab->id)
+ continue;
+ changed=1;
+ for(buds = yd->buddies; buds; buds=buds->next) {
+ struct yahoo_buddy * bud = buds->data;
+ if(!strcmp(bud->id, yab->id)) {
+ bud->yab_entry = yab;
+ if(yab->nname) {
+ bud->real_name = strdup(yab->nname);
+ } else if(yab->fname && yab->lname) {
+ bud->real_name = y_new0(char,
+ strlen(yab->fname)+
+ strlen(yab->lname)+2
+ );
+ sprintf(bud->real_name, "%s %s",
+ yab->fname, yab->lname);
+ } else if(yab->fname) {
+ bud->real_name = strdup(yab->fname);
+ }
+ break; /* for */
+ }
+ }
+ }
+
+ if(changed)
+ YAHOO_CALLBACK(ext_yahoo_got_buddies)(yd->client_id, yd->buddies);
+}
+
+static void yahoo_process_search_connection(struct yahoo_input_data *yid, int over)
+{
+ struct yahoo_found_contact *yct=NULL;
+ char *p = (char *)yid->rxqueue, *np, *cp;
+ int k, n;
+ int start=0, found=0, total=0;
+ YList *contacts=NULL;
+ struct yahoo_input_data *pyid;
+
+ LOG(("[yahoo_process_search_connection] over:%d", over));
+
+ pyid = find_input_by_id_and_type(yid->yd->client_id, YAHOO_CONNECTION_PAGER);
+
+ if(!over || !pyid) {
+ LOG(("yahoo_process_search_connection] ?? Not Done yet? Waiting for more packets!"));
+ return;
+ }
+
+ if(p && (p=strstr(p, "\r\n\r\n"))) {
+ p += 4;
+
+ for(k = 0; (p = strchr(p, 4)) && (k < 4); k++) {
+ p++;
+ n = atoi(p);
+ switch(k) {
+ case 0: found = pyid->ys->lsearch_nfound = n; break;
+ case 2: start = pyid->ys->lsearch_nstart = n; break;
+ case 3: total = pyid->ys->lsearch_ntotal = n; break;
+ }
+ }
+
+ if(p)
+ p++;
+
+ k=0;
+ while(p && *p) {
+ cp = p;
+ np = strchr(p, 4);
+
+ if(!np)
+ break;
+ *np = 0;
+ p = np+1;
+
+ switch(k++) {
+ case 1:
+ if(strlen(cp) > 2 && y_list_length(contacts) < total) {
+ yct = y_new0(struct yahoo_found_contact, 1);
+ contacts = y_list_append(contacts, yct);
+ yct->id = cp+2;
+ } else {
+ *p = 0;
+ }
+ break;
+ case 2:
+ yct->online = !strcmp(cp, "2") ? 1 : 0;
+ break;
+ case 3:
+ yct->gender = cp;
+ break;
+ case 4:
+ yct->age = atoi(cp);
+ break;
+ case 5:
+ if(cp != "\005")
+ yct->location = cp;
+ k = 0;
+ break;
+ }
+ }
+ }
+
+ YAHOO_CALLBACK(ext_yahoo_got_search_result)(yid->yd->client_id, found, start, total, contacts);
+
+ while(contacts) {
+ YList *node = contacts;
+ contacts = y_list_remove_link(contacts, node);
+ free(node->data);
+ y_list_free_1(node);
+ }
+}
+
+static void _yahoo_webcam_connected(int fd, int error, void *d)
+{
+ struct yahoo_input_data *yid = d;
+ struct yahoo_webcam *wcm = yid->wcm;
+ struct yahoo_data *yd = yid->yd;
+ char conn_type[100];
+ char *data=NULL;
+ char *packet=NULL;
+ unsigned char magic_nr[] = {1, 0, 0, 0, 1};
+ unsigned header_len=0;
+ unsigned int len=0;
+ unsigned int pos=0;
+
+ if(error || fd <= 0) {
+ FREE(yid);
+ return;
+ }
+
+ yid->fd = fd;
+ inputs = y_list_prepend(inputs, yid);
+
+ LOG(("Connected"));
+ /* send initial packet */
+ switch (wcm->direction)
+ {
+ case YAHOO_WEBCAM_DOWNLOAD:
+ data = strdup("<REQIMG>");
+ break;
+ case YAHOO_WEBCAM_UPLOAD:
+ data = strdup("<SNDIMG>");
+ break;
+ default:
+ return;
+ }
+ yahoo_add_to_send_queue(yid, data, strlen(data));
+ FREE(data);
+
+ /* send data */
+ switch (wcm->direction)
+ {
+ case YAHOO_WEBCAM_DOWNLOAD:
+ header_len = 8;
+ data = strdup("a=2\r\nc=us\r\ne=21\r\nu=");
+ data = y_string_append(data, yd->user);
+ data = y_string_append(data, "\r\nt=");
+ data = y_string_append(data, wcm->key);
+ data = y_string_append(data, "\r\ni=");
+ data = y_string_append(data, wcm->my_ip);
+ data = y_string_append(data, "\r\ng=");
+ data = y_string_append(data, wcm->user);
+ data = y_string_append(data, "\r\no=w-2-5-1\r\np=");
+ snprintf(conn_type, sizeof(conn_type), "%d", wcm->conn_type);
+ data = y_string_append(data, conn_type);
+ data = y_string_append(data, "\r\n");
+ break;
+ case YAHOO_WEBCAM_UPLOAD:
+ header_len = 13;
+ data = strdup("a=2\r\nc=us\r\nu=");
+ data = y_string_append(data, yd->user);
+ data = y_string_append(data, "\r\nt=");
+ data = y_string_append(data, wcm->key);
+ data = y_string_append(data, "\r\ni=");
+ data = y_string_append(data, wcm->my_ip);
+ data = y_string_append(data, "\r\no=w-2-5-1\r\np=");
+ snprintf(conn_type, sizeof(conn_type), "%d", wcm->conn_type);
+ data = y_string_append(data, conn_type);
+ data = y_string_append(data, "\r\nb=");
+ data = y_string_append(data, wcm->description);
+ data = y_string_append(data, "\r\n");
+ break;
+ }
+
+ len = strlen(data);
+ packet = y_new0(char, header_len + len);
+ packet[pos++] = header_len;
+ packet[pos++] = 0;
+ switch (wcm->direction)
+ {
+ case YAHOO_WEBCAM_DOWNLOAD:
+ packet[pos++] = 1;
+ packet[pos++] = 0;
+ break;
+ case YAHOO_WEBCAM_UPLOAD:
+ packet[pos++] = 5;
+ packet[pos++] = 0;
+ break;
+ }
+
+ pos += yahoo_put32(packet + pos, len);
+ if (wcm->direction == YAHOO_WEBCAM_UPLOAD)
+ {
+ memcpy(packet + pos, magic_nr, sizeof(magic_nr));
+ pos += sizeof(magic_nr);
+ }
+ memcpy(packet + pos, data, len);
+ yahoo_add_to_send_queue(yid, packet, header_len + len);
+ FREE(packet);
+ FREE(data);
+
+ yid->read_tag=YAHOO_CALLBACK(ext_yahoo_add_handler)(yid->yd->client_id, yid->fd, YAHOO_INPUT_READ, yid);
+}
+
+static void yahoo_webcam_connect(struct yahoo_input_data *y)
+{
+ struct yahoo_webcam *wcm = y->wcm;
+ struct yahoo_input_data *yid;
+ struct yahoo_server_settings *yss;
+
+ if (!wcm || !wcm->server || !wcm->key)
+ return;
+
+ yid = y_new0(struct yahoo_input_data, 1);
+ yid->type = YAHOO_CONNECTION_WEBCAM;
+ yid->yd = y->yd;
+
+ /* copy webcam data to new connection */
+ yid->wcm = y->wcm;
+ y->wcm = NULL;
+
+ yss = y->yd->server_settings;
+
+ yid->wcd = y_new0(struct yahoo_webcam_data, 1);
+
+ LOG(("Connecting to: %s:%d", wcm->server, wcm->port));
+ YAHOO_CALLBACK(ext_yahoo_connect_async)(y->yd->client_id, wcm->server, wcm->port, yid->type,
+ _yahoo_webcam_connected, yid);
+
+}
+
+static void yahoo_process_webcam_master_connection(struct yahoo_input_data *yid, int over)
+{
+ char* server;
+ struct yahoo_server_settings *yss;
+
+ if(over)
+ return;
+
+ server = yahoo_getwebcam_master(yid);
+
+ if (server)
+ {
+ yss = yid->yd->server_settings;
+ yid->wcm->server = strdup(server);
+ yid->wcm->port = yss->webcam_port;
+ yid->wcm->conn_type = yss->conn_type;
+ yid->wcm->my_ip = strdup(yss->local_host);
+ if (yid->wcm->direction == YAHOO_WEBCAM_UPLOAD)
+ yid->wcm->description = strdup(yss->webcam_description);
+ yahoo_webcam_connect(yid);
+ FREE(server);
+ }
+}
+
+static void yahoo_process_webcam_connection(struct yahoo_input_data *yid, int over)
+{
+ int id = yid->yd->client_id;
+ int fd = yid->fd;
+
+ if(over)
+ return;
+
+ /* as long as we still have packets available keep processing them */
+ while (find_input_by_id_and_fd(id, fd)
+ && yahoo_get_webcam_data(yid) == 1);
+}
+
+static void (*yahoo_process_connection[])(struct yahoo_input_data *, int over) = {
+ yahoo_process_pager_connection,
+ yahoo_process_ft_connection,
+ yahoo_process_yab_connection,
+ yahoo_process_webcam_master_connection,
+ yahoo_process_webcam_connection,
+ yahoo_process_chatcat_connection,
+ yahoo_process_search_connection
+};
+
+int yahoo_read_ready(int id, int fd, void *data)
+{
+ struct yahoo_input_data *yid = data;
+ struct yahoo_server_settings *yss;
+ char buf[1024];
+ int len;
+
+ LOG(("read callback: id=%d fd=%d data=%p", id, fd, data));
+ if(!yid)
+ return -2;
+
+
+ do {
+ len = read(fd, buf, sizeof(buf));
+
+ LOG(("read callback: id=%d fd=%d len=%d", id, fd, len));
+
+ } while(len == -1 && errno == EINTR);
+
+ if(len == -1 && errno == EAGAIN) /* we'll try again later */
+ return 1;
+
+ if (len <= 0) {
+ int e = errno;
+ DEBUG_MSG(("len == %d (<= 0)", len));
+
+ if(yid->type == YAHOO_CONNECTION_PAGER) {
+ yss = yid->yd->server_settings;
+
+ if (yss->web_messenger && len == 0)
+ return 1; // try again later.. just nothing here yet
+
+ YAHOO_CALLBACK(ext_yahoo_error)(yid->yd->client_id, "Connection closed by server", 1, E_CONNECTION);
+ }
+
+ yahoo_process_connection[yid->type](yid, 1);
+ yahoo_input_close(yid);
+
+ /* no need to return an error, because we've already fixed it */
+ if(len == 0)
+ return 1;
+
+ errno=e;
+ LOG(("read error: %s", strerror(errno)));
+ return -1;
+ }
+
+ yid->rxqueue = y_renew(unsigned char, yid->rxqueue, len + yid->rxlen + 1);
+ memcpy(yid->rxqueue + yid->rxlen, buf, len);
+ yid->rxlen += len;
+ yid->rxqueue[yid->rxlen] = 0; // zero terminate
+
+ yahoo_process_connection[yid->type](yid, 0);
+
+ return len;
+}
+
+int yahoo_init_with_attributes(const char *username, const char *password, ...)
+{
+ va_list ap;
+ struct yahoo_data *yd;
+
+ yd = y_new0(struct yahoo_data, 1);
+
+ if(!yd)
+ return 0;
+
+ yd->user = strdup(username);
+ yd->password = strdup(password);
+
+ yd->initial_status = -1;
+ yd->current_status = -1;
+
+ yd->client_id = ++last_id;
+
+ add_to_list(yd);
+
+ va_start(ap, password);
+ yd->server_settings = _yahoo_assign_server_settings(ap);
+ va_end(ap);
+
+ return yd->client_id;
+}
+
+int yahoo_init(const char *username, const char *password)
+{
+ return yahoo_init_with_attributes(username, password, NULL);
+}
+
+struct connect_callback_data {
+ struct yahoo_data *yd;
+ int tag;
+ int i;
+};
+
+static void yahoo_connected(int fd, int error, void *data)
+{
+ struct connect_callback_data *ccd = data;
+ struct yahoo_data *yd = ccd->yd;
+ struct yahoo_packet *pkt;
+ struct yahoo_input_data *yid;
+ struct yahoo_server_settings *yss = yd->server_settings;
+
+ if(error) {
+ if(fallback_ports[ccd->i]) {
+ int tag;
+ yss->pager_port = fallback_ports[ccd->i++];
+ tag = YAHOO_CALLBACK(ext_yahoo_connect_async)(yd->client_id, yss->pager_host, YAHOO_CONNECTION_PAGER,
+ yss->pager_port, yahoo_connected, ccd);
+
+ if(tag > 0)
+ ccd->tag=tag;
+ } else {
+ FREE(ccd);
+ YAHOO_CALLBACK(ext_yahoo_login_response)(yd->client_id, YAHOO_LOGIN_SOCK, NULL);
+ }
+ return;
+ }
+
+ FREE(ccd);
+
+ /* fd < 0 && error == 0 means connect was cancelled */
+ if(fd < 0)
+ return;
+
+ NOTICE(("web messenger: %d", yss->web_messenger));
+ if (yss->web_messenger) {
+ pkt = yahoo_packet_new(YAHOO_SERVICE_AUTH, YAHOO_STATUS_AVAILABLE, yd->session_id);
+ yahoo_packet_hash(pkt, 1, yd->user);
+ yahoo_packet_hash(pkt, 0, yd->user);
+ yahoo_packet_hash(pkt, 24, "0");
+
+ } else {
+ pkt = yahoo_packet_new(YAHOO_SERVICE_VERIFY, YAHOO_STATUS_AVAILABLE, yd->session_id);
+ }
+ NOTICE(("Sending initial packet"));
+
+ yid = y_new0(struct yahoo_input_data, 1);
+ yid->yd = yd;
+ yid->fd = fd;
+ inputs = y_list_prepend(inputs, yid);
+
+ yahoo_send_packet(yid, pkt, 0);
+
+ yahoo_packet_free(pkt);
+
+ yid->read_tag=YAHOO_CALLBACK(ext_yahoo_add_handler)(yid->yd->client_id, yid->fd, YAHOO_INPUT_READ, yid);
+}
+
+void yahoo_login(int id, int initial)
+{
+ struct yahoo_data *yd = find_conn_by_id(id);
+ struct connect_callback_data *ccd;
+ struct yahoo_server_settings *yss;
+ int tag;
+
+ if(!yd)
+ return;
+
+ yss = yd->server_settings;
+
+ yd->initial_status = initial;
+
+ ccd = y_new0(struct connect_callback_data, 1);
+ ccd->yd = yd;
+ tag = YAHOO_CALLBACK(ext_yahoo_connect_async)(yd->client_id, yss->pager_host, yss->pager_port, YAHOO_CONNECTION_PAGER,
+ yahoo_connected, ccd);
+
+ /*
+ * if tag <= 0, then callback has already been called
+ * so ccd will have been freed
+ */
+ if(tag > 0)
+ ccd->tag = tag;
+ else if(tag < 0)
+ YAHOO_CALLBACK(ext_yahoo_login_response)(yd->client_id, YAHOO_LOGIN_SOCK, NULL);
+}
+
+
+int yahoo_get_fd(int id)
+{
+ struct yahoo_input_data *yid = find_input_by_id_and_type(id, YAHOO_CONNECTION_PAGER);
+ if(!yid)
+ return 0;
+ else
+ return yid->fd;
+}
+
+void yahoo_send_im(int id, const char *from, const char *who, const char *what, int utf8, int buddy_icon)
+{
+ struct yahoo_input_data *yid = find_input_by_id_and_type(id, YAHOO_CONNECTION_PAGER);
+ struct yahoo_packet *pkt = NULL;
+ struct yahoo_data *yd;
+ struct yahoo_server_settings *yss;
+ char buf[2];
+
+ if(!yid)
+ return;
+
+ yd = yid->yd;
+ yss = yd->server_settings;
+ pkt = yahoo_packet_new(YAHOO_SERVICE_MESSAGE, YAHOO_STATUS_OFFLINE, yd->session_id);
+
+ if(from && strcmp(from, yd->user))
+ yahoo_packet_hash(pkt, 0, yd->user);
+ yahoo_packet_hash(pkt, 1, from?from:yd->user);
+ yahoo_packet_hash(pkt, 5, who);
+ yahoo_packet_hash(pkt, 14, what);
+
+ if(utf8)
+ yahoo_packet_hash(pkt, 97, "1");
+
+ /* GAIM does doodle so they allow/enable imvironments (that get rejected?)
+ 63 - imvironment string;11
+ 64 - imvironment enabled/allowed
+ 0 - enabled imwironment ;0 - no imvironment
+ 2 - disabled '' - empty cause we don;t do these
+ */
+ yahoo_packet_hash(pkt, 63, ""); /* imvironment name; or ;0 (doodle;11)*/
+ yahoo_packet_hash(pkt, 64, "2");
+
+ if (!yss->web_messenger) {
+ //yahoo_packet_hash(pkt, 1002, "1"); /* YIM6+ */
+ yahoo_packet_hash(pkt, 10093, "4"); /* YIM7? */
+ }
+ snprintf(buf, sizeof(buf), "%d", buddy_icon);
+ yahoo_packet_hash(pkt, 206, buf); /* buddy_icon, 0 = none, 1=avatar?, 2=picture */
+
+ if (yss->web_messenger) {
+ char z[128];
+
+ yahoo_packet_hash(pkt, 0, yd->user);
+ wsprintf(z, "%d", yd->session_timestamp);
+ yahoo_packet_hash(pkt, 24, z);
+ }
+ yahoo_send_packet(yid, pkt, 0);
+
+ yahoo_packet_free(pkt);
+}
+
+void yahoo_send_typing(int id, const char *from, const char *who, int typ)
+{
+ struct yahoo_input_data *yid = find_input_by_id_and_type(id, YAHOO_CONNECTION_PAGER);
+ struct yahoo_data *yd;
+ struct yahoo_packet *pkt = NULL;
+ struct yahoo_server_settings *yss;
+
+ if(!yid)
+ return;
+
+ yd = yid->yd;
+ yss = yd->server_settings;
+
+ pkt = yahoo_packet_new(YAHOO_SERVICE_NOTIFY, YAHOO_STATUS_NOTIFY, yd->session_id);
+
+ yahoo_packet_hash(pkt, 49, "TYPING");
+ yahoo_packet_hash(pkt, 1, from?from:yd->user);
+ yahoo_packet_hash(pkt, 14, " ");
+ yahoo_packet_hash(pkt, 13, typ ? "1" : "0");
+ yahoo_packet_hash(pkt, 5, who);
+
+ if (yss->web_messenger) {
+ char z[128];
+
+ yahoo_packet_hash(pkt, 0, yd->user);
+ wsprintf(z, "%d", yd->session_timestamp);
+ yahoo_packet_hash(pkt, 24, z);
+ } else {
+ //yahoo_packet_hash(pkt, 1002, "1"); /* YIM6+ */
+ yahoo_packet_hash(pkt, 10093, "4"); /* YIM7+ */
+ }
+
+ yahoo_send_packet(yid, pkt, 0);
+
+ yahoo_packet_free(pkt);
+}
+
+void yahoo_set_away(int id, enum yahoo_status state, const char *msg, int away)
+{
+ struct yahoo_input_data *yid = find_input_by_id_and_type(id, YAHOO_CONNECTION_PAGER);
+ struct yahoo_data *yd;
+ struct yahoo_packet *pkt = NULL;
+ struct yahoo_server_settings *yss;
+ //int service;
+ char s[4];
+ enum yahoo_status cs;
+
+ if(!yid)
+ return;
+
+ yd = yid->yd;
+
+ //if (yd->current_status == state && state != YAHOO_STATUS_CUSTOM)
+ // return;
+
+ cs = yd->current_status;
+ yss = yd->server_settings;
+
+ if (state == YAHOO_STATUS_INVISIBLE) {
+ pkt = yahoo_packet_new(YAHOO_SERVICE_Y6_VISIBLE_TOGGLE, YAHOO_STATUS_AVAILABLE, yd->session_id);
+ yahoo_packet_hash(pkt, 13, "2");
+ yd->current_status = state;
+ } else {
+ LOG(("yahoo_set_away: state: %d, msg: %s, away: %d", state, msg, away));
+
+ if (msg) {
+ yd->current_status = YAHOO_STATUS_CUSTOM;
+ } else {
+ yd->current_status = state;
+ }
+
+ //if (yd->current_status == YAHOO_STATUS_AVAILABLE)
+ // service = YAHOO_SERVICE_ISBACK;
+ //else
+ // service = YAHOO_SERVICE_ISAWAY;
+
+ pkt = yahoo_packet_new(YAHOO_SERVICE_Y6_STATUS_UPDATE, YAHOO_STATUS_AVAILABLE, yd->session_id);
+ if ((away == 2) && (yd->current_status == YAHOO_STATUS_AVAILABLE)) {
+ //pkt = yahoo_packet_new(YAHOO_SERVICE_ISAWAY, YAHOO_STATUS_BRB, yd->session_id);
+ yahoo_packet_hash(pkt, 10, "999");
+ yahoo_packet_hash(pkt, 47, "2");
+ }else {
+ //pkt = yahoo_packet_new(YAHOO_SERVICE_YAHOO6_STATUS_UPDATE, YAHOO_STATUS_AVAILABLE, yd->session_id);
+ snprintf(s, sizeof(s), "%d", yd->current_status);
+ yahoo_packet_hash(pkt, 10, s);
+ if (yd->current_status == YAHOO_STATUS_CUSTOM) {
+ yahoo_packet_hash(pkt, 19, msg);
+ yahoo_packet_hash(pkt, 47, (away == 2)? "2": (away) ?"1":"0");
+ } else {
+ yahoo_packet_hash(pkt, 47, (away == 2)? "2": (away) ?"1":"0");
+ }
+
+ //yahoo_packet_hash(pkt, 187, "0"); // ???
+
+ }
+ }
+ if (yss->web_messenger) {
+ char z[128];
+
+ yahoo_packet_hash(pkt, 0, yd->user);
+ wsprintf(z, "%d", yd->session_timestamp);
+ yahoo_packet_hash(pkt, 24, z);
+ }
+
+ yahoo_send_packet(yid, pkt, 0);
+ yahoo_packet_free(pkt);
+
+ if (cs == YAHOO_STATUS_INVISIBLE && state != YAHOO_STATUS_INVISIBLE){
+ pkt = yahoo_packet_new(YAHOO_SERVICE_Y6_VISIBLE_TOGGLE, YAHOO_STATUS_AVAILABLE, yd->session_id);
+ yahoo_packet_hash(pkt, 13, "1");
+ yd->current_status = state;
+
+ yahoo_send_packet(yid, pkt, 0);
+ yahoo_packet_free(pkt);
+ }
+}
+
+void yahoo_set_stealth(int id, const char *buddy, int add)
+{
+ struct yahoo_input_data *yid = find_input_by_id_and_type(id, YAHOO_CONNECTION_PAGER);
+ struct yahoo_data *yd;
+ struct yahoo_packet *pkt = NULL;
+ //int service;
+ //char s[4];
+
+ if(!yid)
+ return;
+
+ yd = yid->yd;
+
+ pkt = yahoo_packet_new(YAHOO_SERVICE_STEALTH_PERM, YAHOO_STATUS_AVAILABLE, yd->session_id);
+ yahoo_packet_hash(pkt, 1, yd->user);
+ yahoo_packet_hash(pkt, 31, add ? "1" : "2"); /*visibility? */
+ yahoo_packet_hash(pkt, 13, "2"); // function/service
+ yahoo_packet_hash(pkt, 7, buddy);
+ yahoo_send_packet(yid, pkt, 0);
+ yahoo_packet_free(pkt);
+}
+
+void yahoo_logoff(int id)
+{
+ struct yahoo_input_data *yid = find_input_by_id_and_type(id, YAHOO_CONNECTION_PAGER);
+ struct yahoo_data *yd;
+ struct yahoo_packet *pkt = NULL;
+
+ if(!yid)
+ return;
+ yd = yid->yd;
+
+ LOG(("yahoo_logoff: current status: %d", yd->current_status));
+
+ if(yd->current_status != -1) {
+ struct yahoo_server_settings *yss = yd->server_settings;
+
+ pkt = yahoo_packet_new(YAHOO_SERVICE_LOGOFF, YAHOO_STATUS_AVAILABLE, yd->session_id);
+
+ if (yss->web_messenger) {
+ char z[128];
+
+ yahoo_packet_hash(pkt, 0, yd->user);
+ wsprintf(z, "%d", yd->session_timestamp);
+ yahoo_packet_hash(pkt, 24, z);
+ }
+ yd->current_status = -1;
+
+ if (pkt) {
+ yahoo_send_packet(yid, pkt, 0);
+ yahoo_packet_free(pkt);
+ }
+ }
+
+
+/* do {
+ yahoo_input_close(yid);
+ } while((yid = find_input_by_id(id)));*/
+
+}
+
+void yahoo_get_list(int id)
+{
+ struct yahoo_input_data *yid = find_input_by_id_and_type(id, YAHOO_CONNECTION_PAGER);
+ struct yahoo_data *yd;
+ struct yahoo_packet *pkt = NULL;
+
+ if(!yid)
+ return;
+ yd = yid->yd;
+
+ pkt = yahoo_packet_new(YAHOO_SERVICE_LIST, YAHOO_STATUS_AVAILABLE, yd->session_id);
+ yahoo_packet_hash(pkt, 1, yd->user);
+ if (pkt) {
+ yahoo_send_packet(yid, pkt, 0);
+ yahoo_packet_free(pkt);
+ }
+}
+
+static void _yahoo_http_connected(int id, int fd, int error, void *data)
+{
+ struct yahoo_input_data *yid = data;
+ if(fd <= 0) {
+ inputs = y_list_remove(inputs, yid);
+ FREE(yid);
+ return;
+ }
+
+ yid->fd = fd;
+ yid->read_tag=YAHOO_CALLBACK(ext_yahoo_add_handler)(yid->yd->client_id, fd, YAHOO_INPUT_READ, yid);
+}
+
+void yahoo_get_yab(int id)
+{
+ struct yahoo_data *yd = find_conn_by_id(id);
+ struct yahoo_input_data *yid;
+ char url[1024];
+ char buff[1024];
+
+ if(!yd)
+ return;
+
+ yid = y_new0(struct yahoo_input_data, 1);
+ yid->yd = yd;
+ yid->type = YAHOO_CONNECTION_YAB;
+
+ snprintf(url, 1024, "http://insider.msg.yahoo.com/ycontent/?ab2=0");
+
+ snprintf(buff, sizeof(buff), "Y=%s; T=%s",
+ yd->cookie_y, yd->cookie_t);
+
+ inputs = y_list_prepend(inputs, yid);
+
+ yahoo_http_get(yid->yd->client_id, url, buff,
+ _yahoo_http_connected, yid);
+}
+
+void yahoo_set_yab(int id, struct yab * yab)
+{
+ struct yahoo_data *yd = find_conn_by_id(id);
+ struct yahoo_input_data *yid;
+ char url[1024];
+ char buff[1024];
+ char *temp;
+ int size = sizeof(url)-1;
+
+ if(!yd)
+ return;
+
+ yid = y_new0(struct yahoo_input_data, 1);
+ yid->type = YAHOO_CONNECTION_YAB;
+ yid->yd = yd;
+
+ strncpy(url, "http://insider.msg.yahoo.com/ycontent/?addab2=0", size);
+
+ if(yab->dbid) {
+ /* change existing yab */
+ char tmp[32];
+ strncat(url, "&ee=1&ow=1&id=", size - strlen(url));
+ snprintf(tmp, sizeof(tmp), "%d", yab->dbid);
+ strncat(url, tmp, size - strlen(url));
+ }
+
+ if(yab->fname) {
+ strncat(url, "&fn=", size - strlen(url));
+ temp = yahoo_urlencode(yab->fname);
+ strncat(url, temp, size - strlen(url));
+ free(temp);
+ }
+ if(yab->lname) {
+ strncat(url, "&ln=", size - strlen(url));
+ temp = yahoo_urlencode(yab->lname);
+ strncat(url, temp, size - strlen(url));
+ free(temp);
+ }
+ strncat(url, "&yid=", size - strlen(url));
+ temp = yahoo_urlencode(yab->id);
+ strncat(url, temp, size - strlen(url));
+ free(temp);
+ if(yab->nname) {
+ strncat(url, "&nn=", size - strlen(url));
+ temp = yahoo_urlencode(yab->nname);
+ strncat(url, temp, size - strlen(url));
+ free(temp);
+ }
+ if(yab->email) {
+ strncat(url, "&e=", size - strlen(url));
+ temp = yahoo_urlencode(yab->email);
+ strncat(url, temp, size - strlen(url));
+ free(temp);
+ }
+ if(yab->hphone) {
+ strncat(url, "&hp=", size - strlen(url));
+ temp = yahoo_urlencode(yab->hphone);
+ strncat(url, temp, size - strlen(url));
+ free(temp);
+ }
+ if(yab->wphone) {
+ strncat(url, "&wp=", size - strlen(url));
+ temp = yahoo_urlencode(yab->wphone);
+ strncat(url, temp, size - strlen(url));
+ free(temp);
+ }
+ if(yab->mphone) {
+ strncat(url, "&mp=", size - strlen(url));
+ temp = yahoo_urlencode(yab->mphone);
+ strncat(url, temp, size - strlen(url));
+ free(temp);
+ }
+ strncat(url, "&pp=0", size - strlen(url));
+
+ snprintf(buff, sizeof(buff), "Y=%s; T=%s",
+ yd->cookie_y, yd->cookie_t);
+
+ inputs = y_list_prepend(inputs, yid);
+
+ yahoo_http_get(yid->yd->client_id, url, buff,
+ _yahoo_http_connected, yid);
+}
+
+void yahoo_set_identity_status(int id, const char * identity, int active)
+{
+ struct yahoo_input_data *yid = find_input_by_id_and_type(id, YAHOO_CONNECTION_PAGER);
+ struct yahoo_data *yd;
+ struct yahoo_packet *pkt = NULL;
+
+ if(!yid)
+ return;
+ yd = yid->yd;
+
+ pkt = yahoo_packet_new(active?YAHOO_SERVICE_IDACT:YAHOO_SERVICE_IDDEACT,
+ YAHOO_STATUS_AVAILABLE, yd->session_id);
+ yahoo_packet_hash(pkt, 3, identity);
+ if (pkt) {
+ yahoo_send_packet(yid, pkt, 0);
+ yahoo_packet_free(pkt);
+ }
+}
+
+void yahoo_refresh(int id)
+{
+ struct yahoo_input_data *yid = find_input_by_id_and_type(id, YAHOO_CONNECTION_PAGER);
+ struct yahoo_data *yd;
+ struct yahoo_packet *pkt = NULL;
+
+ if(!yid)
+ return;
+ yd = yid->yd;
+
+ pkt = yahoo_packet_new(YAHOO_SERVICE_USERSTAT, YAHOO_STATUS_AVAILABLE, yd->session_id);
+ if (pkt) {
+ yahoo_send_packet(yid, pkt, 0);
+ yahoo_packet_free(pkt);
+ }
+}
+
+void yahoo_keepalive(int id)
+{
+ struct yahoo_input_data *yid = find_input_by_id_and_type(id, YAHOO_CONNECTION_PAGER);
+ struct yahoo_data *yd;
+ struct yahoo_packet *pkt=NULL;
+ if(!yid)
+ return;
+ yd = yid->yd;
+
+ pkt = yahoo_packet_new(YAHOO_SERVICE_PING, YAHOO_STATUS_AVAILABLE, yd->session_id);
+ yahoo_send_packet(yid, pkt, 0);
+ yahoo_packet_free(pkt);
+}
+
+void yahoo_chat_keepalive (int id)
+{
+ struct yahoo_input_data *yid = find_input_by_id_and_type (id, YAHOO_CONNECTION_PAGER);
+ struct yahoo_data *yd;
+ struct yahoo_packet *pkt = NULL;
+
+ if (!yid)
+ return;
+
+ yd = yid->yd;
+
+ pkt = yahoo_packet_new (YAHOO_SERVICE_CHATPING, YAHOO_STATUS_AVAILABLE, yd->session_id);
+ yahoo_send_packet (yid, pkt, 0);
+ yahoo_packet_free (pkt);
+}
+
+void yahoo_add_buddy(int id, const char *who, const char *group, const char *msg)
+{
+ struct yahoo_input_data *yid = find_input_by_id_and_type(id, YAHOO_CONNECTION_PAGER);
+ struct yahoo_data *yd;
+ struct yahoo_packet *pkt;
+
+ if(!yid)
+ return;
+ yd = yid->yd;
+
+ if (!yd->logged_in)
+ return;
+
+ pkt = yahoo_packet_new(YAHOO_SERVICE_ADDBUDDY, YAHOO_STATUS_AVAILABLE, yd->session_id);
+ yahoo_packet_hash(pkt, 1, yd->user);
+ yahoo_packet_hash(pkt, 7, who);
+ yahoo_packet_hash(pkt, 65, group);
+ if (msg != NULL) // add message/request "it's me add me"
+ yahoo_packet_hash(pkt, 14, msg);
+
+ /* YIM7 does something weird here:
+ yahoo_packet_hash(pkt, 1, yd->user);
+ yahoo_packet_hash(pkt, 14, msg != NULL ? msg : "");
+ yahoo_packet_hash(pkt, 65, group);
+ yahoo_packet_hash(pkt, 97, 1); ?????
+ yahoo_packet_hash(pkt, 216, "First Name");???
+ yahoo_packet_hash(pkt, 254, "Last Name");???
+ yahoo_packet_hash(pkt, 7, who);
+
+ Server Replies with:
+ 1: ID
+ 66: 0
+ 7: who
+ 65: group
+ 223: 1 ??
+ */
+ yahoo_send_packet(yid, pkt, 0);
+ yahoo_packet_free(pkt);
+}
+
+void yahoo_remove_buddy(int id, const char *who, const char *group)
+{
+ struct yahoo_input_data *yid = find_input_by_id_and_type(id, YAHOO_CONNECTION_PAGER);
+ struct yahoo_data *yd;
+ struct yahoo_packet *pkt = NULL;
+
+ if(!yid)
+ return;
+ yd = yid->yd;
+
+ pkt = yahoo_packet_new(YAHOO_SERVICE_REMBUDDY, YAHOO_STATUS_AVAILABLE, yd->session_id);
+
+ yahoo_packet_hash(pkt, 1, yd->user);
+ yahoo_packet_hash(pkt, 7, who);
+ yahoo_packet_hash(pkt, 65, group);
+ yahoo_send_packet(yid, pkt, 0);
+ yahoo_packet_free(pkt);
+}
+
+void yahoo_accept_buddy(int id, const char *who)
+{
+ struct yahoo_input_data *yid = find_input_by_id_and_type(id, YAHOO_CONNECTION_PAGER);
+ struct yahoo_data *yd;
+ struct yahoo_packet *pkt;
+
+ if(!yid)
+ return;
+ yd = yid->yd;
+
+ if (!yd->logged_in)
+ return;
+
+ pkt = yahoo_packet_new(YAHOO_SERVICE_Y7_AUTHORIZATION, YAHOO_STATUS_AVAILABLE, yd->session_id);
+ yahoo_packet_hash(pkt, 1, yd->user);
+ yahoo_packet_hash(pkt, 5, who);
+ yahoo_packet_hash(pkt, 13, "1"); // Reject Authorization
+
+ yahoo_send_packet(yid, pkt, 0);
+ yahoo_packet_free(pkt);
+}
+
+void yahoo_reject_buddy(int id, const char *who, const char *msg)
+{
+ struct yahoo_input_data *yid = find_input_by_id_and_type(id, YAHOO_CONNECTION_PAGER);
+ struct yahoo_data *yd;
+ struct yahoo_packet *pkt;
+
+ if(!yid)
+ return;
+ yd = yid->yd;
+
+ if (!yd->logged_in)
+ return;
+
+ pkt = yahoo_packet_new(YAHOO_SERVICE_Y7_AUTHORIZATION, YAHOO_STATUS_AVAILABLE, yd->session_id);
+ yahoo_packet_hash(pkt, 1, yd->user);
+ yahoo_packet_hash(pkt, 5, who);
+ yahoo_packet_hash(pkt, 13, "2"); // Reject Authorization
+
+ if (msg != NULL)
+ yahoo_packet_hash(pkt, 14, msg);
+
+ yahoo_send_packet(yid, pkt, 0);
+ yahoo_packet_free(pkt);
+}
+
+void yahoo_ignore_buddy(int id, const char *who, int unignore)
+{
+ struct yahoo_input_data *yid = find_input_by_id_and_type(id, YAHOO_CONNECTION_PAGER);
+ struct yahoo_data *yd;
+ struct yahoo_packet *pkt;
+
+ if(!yid)
+ return;
+ yd = yid->yd;
+
+ if (!yd->logged_in)
+ return;
+
+ pkt = yahoo_packet_new(YAHOO_SERVICE_IGNORECONTACT, YAHOO_STATUS_AVAILABLE, yd->session_id);
+ yahoo_packet_hash(pkt, 1, yd->user);
+ yahoo_packet_hash(pkt, 7, who);
+ yahoo_packet_hash(pkt, 13, unignore?"2":"1");
+ yahoo_send_packet(yid, pkt, 0);
+ yahoo_packet_free(pkt);
+}
+
+void yahoo_change_buddy_group(int id, const char *who, const char *old_group, const char *new_group)
+{
+ struct yahoo_input_data *yid = find_input_by_id_and_type(id, YAHOO_CONNECTION_PAGER);
+ struct yahoo_data *yd;
+ struct yahoo_packet *pkt = NULL;
+
+ if(!yid)
+ return;
+ yd = yid->yd;
+
+ /*pkt = yahoo_packet_new(YAHOO_SERVICE_ADDBUDDY, YAHOO_STATUS_AVAILABLE, yd->session_id);
+ yahoo_packet_hash(pkt, 1, yd->user);
+ yahoo_packet_hash(pkt, 7, who);
+ yahoo_packet_hash(pkt, 14, "");
+ yahoo_packet_hash(pkt, 65, new_group);
+ yahoo_packet_hash(pkt, 97, "1");
+ yahoo_send_packet(yid, pkt, 0);
+ yahoo_packet_free(pkt);
+
+ pkt = yahoo_packet_new(YAHOO_SERVICE_REMBUDDY, YAHOO_STATUS_AVAILABLE, yd->session_id);
+ yahoo_packet_hash(pkt, 1, yd->user);
+ yahoo_packet_hash(pkt, 7, who);
+ yahoo_packet_hash(pkt, 65, old_group);
+ yahoo_send_packet(yid, pkt, 0);
+ yahoo_packet_free(pkt);*/
+
+ pkt = yahoo_packet_new(YAHOO_SERVICE_Y7_CHANGE_GROUP, YAHOO_STATUS_AVAILABLE, yd->session_id);
+ yahoo_packet_hash(pkt, 1, yd->user);
+ yahoo_packet_hash(pkt, 302, "240"); //???
+ yahoo_packet_hash(pkt, 300, "240"); //???
+ yahoo_packet_hash(pkt, 7, who);
+ yahoo_packet_hash(pkt, 224, old_group);
+ yahoo_packet_hash(pkt, 264, new_group);
+ yahoo_packet_hash(pkt, 301, "240"); //???
+ yahoo_packet_hash(pkt, 303, "240"); //???
+ yahoo_send_packet(yid, pkt, 0);
+ yahoo_packet_free(pkt);
+}
+
+void yahoo_group_rename(int id, const char *old_group, const char *new_group)
+{
+ struct yahoo_input_data *yid = find_input_by_id_and_type(id, YAHOO_CONNECTION_PAGER);
+ struct yahoo_data *yd;
+ struct yahoo_packet *pkt = NULL;
+
+ if(!yid)
+ return;
+ yd = yid->yd;
+
+ pkt = yahoo_packet_new(YAHOO_SERVICE_GROUPRENAME, YAHOO_STATUS_AVAILABLE, yd->session_id);
+ yahoo_packet_hash(pkt, 1, yd->user);
+ yahoo_packet_hash(pkt, 65, old_group);
+ yahoo_packet_hash(pkt, 67, new_group);
+
+ yahoo_send_packet(yid, pkt, 0);
+ yahoo_packet_free(pkt);
+}
+
+void yahoo_conference_addinvite(int id, const char * from, const char *who, const char *room, const YList * members, const char *msg)
+{
+ struct yahoo_input_data *yid = find_input_by_id_and_type(id, YAHOO_CONNECTION_PAGER);
+ struct yahoo_data *yd;
+ struct yahoo_packet *pkt;
+
+ if(!yid)
+ return;
+ yd = yid->yd;
+
+ pkt = yahoo_packet_new(YAHOO_SERVICE_CONFADDINVITE, YAHOO_STATUS_AVAILABLE, yd->session_id);
+
+ yahoo_packet_hash(pkt, 1, (from?from:yd->user));
+ yahoo_packet_hash(pkt, 51, who);
+ yahoo_packet_hash(pkt, 57, room);
+ yahoo_packet_hash(pkt, 58, msg);
+ yahoo_packet_hash(pkt, 13, "0");
+ for(; members; members = members->next) {
+ yahoo_packet_hash(pkt, 52, (char *)members->data);
+ yahoo_packet_hash(pkt, 53, (char *)members->data);
+ }
+ /* 52, 53 -> other members? */
+
+ yahoo_send_packet(yid, pkt, 0);
+
+ yahoo_packet_free(pkt);
+}
+
+void yahoo_conference_invite(int id, const char * from, YList *who, const char *room, const char *msg)
+{
+ struct yahoo_input_data *yid = find_input_by_id_and_type(id, YAHOO_CONNECTION_PAGER);
+ struct yahoo_data *yd;
+ struct yahoo_packet *pkt;
+
+ if(!yid)
+ return;
+ yd = yid->yd;
+
+ pkt = yahoo_packet_new(YAHOO_SERVICE_CONFINVITE, YAHOO_STATUS_AVAILABLE, yd->session_id);
+
+ yahoo_packet_hash(pkt, 1, (from?from:yd->user));
+ yahoo_packet_hash(pkt, 50, yd->user);
+ for(; who; who = who->next) {
+ yahoo_packet_hash(pkt, 52, (char *)who->data);
+ }
+ yahoo_packet_hash(pkt, 57, room);
+ yahoo_packet_hash(pkt, 58, msg);
+ yahoo_packet_hash(pkt, 13, "0");
+
+ yahoo_send_packet(yid, pkt, 0);
+
+ yahoo_packet_free(pkt);
+}
+
+void yahoo_conference_logon(int id, const char *from, YList *who, const char *room)
+{
+ struct yahoo_input_data *yid = find_input_by_id_and_type(id, YAHOO_CONNECTION_PAGER);
+ struct yahoo_data *yd;
+ struct yahoo_packet *pkt;
+
+ if(!yid)
+ return;
+ yd = yid->yd;
+
+ pkt = yahoo_packet_new(YAHOO_SERVICE_CONFLOGON, YAHOO_STATUS_AVAILABLE, yd->session_id);
+
+ yahoo_packet_hash(pkt, 1, (from?from:yd->user));
+ for(; who; who = who->next) {
+ yahoo_packet_hash(pkt, 3, (char *)who->data);
+ }
+ yahoo_packet_hash(pkt, 57, room);
+
+ yahoo_send_packet(yid, pkt, 0);
+
+ yahoo_packet_free(pkt);
+}
+
+void yahoo_conference_decline(int id, const char * from, YList *who, const char *room, const char *msg)
+{
+ struct yahoo_input_data *yid = find_input_by_id_and_type(id, YAHOO_CONNECTION_PAGER);
+ struct yahoo_data *yd;
+ struct yahoo_packet *pkt;
+
+ if(!yid)
+ return;
+ yd = yid->yd;
+
+ pkt = yahoo_packet_new(YAHOO_SERVICE_CONFDECLINE, YAHOO_STATUS_AVAILABLE, yd->session_id);
+
+ yahoo_packet_hash(pkt, 1, (from?from:yd->user));
+ for(; who; who = who->next) {
+ yahoo_packet_hash(pkt, 3, (char *)who->data);
+ }
+ yahoo_packet_hash(pkt, 57, room);
+ yahoo_packet_hash(pkt, 14, msg);
+
+ yahoo_send_packet(yid, pkt, 0);
+
+ yahoo_packet_free(pkt);
+}
+
+void yahoo_conference_logoff(int id, const char * from, YList *who, const char *room)
+{
+ struct yahoo_input_data *yid = find_input_by_id_and_type(id, YAHOO_CONNECTION_PAGER);
+ struct yahoo_data *yd;
+ struct yahoo_packet *pkt;
+
+ if(!yid)
+ return;
+ yd = yid->yd;
+
+ pkt = yahoo_packet_new(YAHOO_SERVICE_CONFLOGOFF, YAHOO_STATUS_AVAILABLE, yd->session_id);
+
+ yahoo_packet_hash(pkt, 1, (from?from:yd->user));
+ for(; who; who = who->next) {
+ yahoo_packet_hash(pkt, 3, (char *)who->data);
+ }
+ yahoo_packet_hash(pkt, 57, room);
+
+ yahoo_send_packet(yid, pkt, 0);
+
+ yahoo_packet_free(pkt);
+}
+
+void yahoo_conference_message(int id, const char * from, YList *who, const char *room, const char *msg, int utf8)
+{
+ struct yahoo_input_data *yid = find_input_by_id_and_type(id, YAHOO_CONNECTION_PAGER);
+ struct yahoo_data *yd;
+ struct yahoo_packet *pkt;
+
+ if(!yid)
+ return;
+ yd = yid->yd;
+
+ pkt = yahoo_packet_new(YAHOO_SERVICE_CONFMSG, YAHOO_STATUS_AVAILABLE, yd->session_id);
+
+ yahoo_packet_hash(pkt, 1, (from?from:yd->user));
+ for(; who; who = who->next) {
+ yahoo_packet_hash(pkt, 53, (char *)who->data);
+ }
+ yahoo_packet_hash(pkt, 57, room);
+ yahoo_packet_hash(pkt, 14, msg);
+
+ if(utf8)
+ yahoo_packet_hash(pkt, 97, "1");
+
+ yahoo_send_packet(yid, pkt, 0);
+
+ yahoo_packet_free(pkt);
+}
+
+void yahoo_get_chatrooms(int id, int chatroomid)
+{
+ struct yahoo_data *yd = find_conn_by_id(id);
+ struct yahoo_input_data *yid;
+ char url[1024];
+ char buff[1024];
+
+ if(!yd)
+ return;
+
+ yid = y_new0(struct yahoo_input_data, 1);
+ yid->yd = yd;
+ yid->type = YAHOO_CONNECTION_CHATCAT;
+
+ if (chatroomid == 0) {
+ snprintf(url, 1024, "http://insider.msg.yahoo.com/ycontent/?chatcat=0");
+ } else {
+ snprintf(url, 1024, "http://insider.msg.yahoo.com/ycontent/?chatroom_%d=0",chatroomid);
+ }
+
+ snprintf(buff, sizeof(buff), "Y=%s; T=%s", yd->cookie_y, yd->cookie_t);
+
+ inputs = y_list_prepend(inputs, yid);
+
+ yahoo_http_get(yid->yd->client_id, url, buff, _yahoo_http_connected, yid);
+}
+
+void yahoo_chat_logon(int id, const char *from, const char *room, const char *roomid)
+{
+ struct yahoo_input_data *yid = find_input_by_id_and_type(id, YAHOO_CONNECTION_PAGER);
+ struct yahoo_data *yd;
+ struct yahoo_packet *pkt;
+
+ if(!yid)
+ return;
+
+ yd = yid->yd;
+
+ pkt = yahoo_packet_new(YAHOO_SERVICE_CHATONLINE, YAHOO_STATUS_AVAILABLE, yd->session_id);
+
+ yahoo_packet_hash(pkt, 1, (from?from:yd->user));
+ yahoo_packet_hash(pkt, 109, yd->user);
+ yahoo_packet_hash(pkt, 6, "abcde");
+
+ yahoo_send_packet(yid, pkt, 0);
+
+ yahoo_packet_free(pkt);
+
+ pkt = yahoo_packet_new(YAHOO_SERVICE_CHATJOIN, YAHOO_STATUS_AVAILABLE, yd->session_id);
+
+ yahoo_packet_hash(pkt, 1, (from?from:yd->user));
+ yahoo_packet_hash(pkt, 104, room);
+ yahoo_packet_hash(pkt, 129, roomid);
+ yahoo_packet_hash(pkt, 62, "2"); /* ??? */
+
+ yahoo_send_packet(yid, pkt, 0);
+
+ yahoo_packet_free(pkt);
+}
+
+
+void yahoo_chat_message(int id, const char *from, const char *room, const char *msg, const int msgtype, const int utf8)
+{
+ struct yahoo_input_data *yid = find_input_by_id_and_type(id, YAHOO_CONNECTION_PAGER);
+ struct yahoo_data *yd;
+ struct yahoo_packet *pkt;
+ char buf[2];
+
+ if(!yid)
+ return;
+
+ yd = yid->yd;
+
+ pkt = yahoo_packet_new(YAHOO_SERVICE_COMMENT, YAHOO_STATUS_AVAILABLE, yd->session_id);
+
+ yahoo_packet_hash(pkt, 1, (from?from:yd->user));
+ yahoo_packet_hash(pkt, 104, room);
+ yahoo_packet_hash(pkt, 117, msg);
+
+ snprintf(buf, sizeof(buf), "%d", msgtype);
+ yahoo_packet_hash(pkt, 124, buf);
+
+ if(utf8)
+ yahoo_packet_hash(pkt, 97, "1");
+
+ yahoo_send_packet(yid, pkt, 0);
+
+ yahoo_packet_free(pkt);
+}
+
+
+void yahoo_chat_logoff(int id, const char *from)
+{
+ struct yahoo_input_data *yid = find_input_by_id_and_type(id, YAHOO_CONNECTION_PAGER);
+ struct yahoo_data *yd;
+ struct yahoo_packet *pkt;
+
+ if(!yid)
+ return;
+
+ yd = yid->yd;
+
+ pkt = yahoo_packet_new(YAHOO_SERVICE_CHATLOGOUT, YAHOO_STATUS_AVAILABLE, yd->session_id);
+
+ yahoo_packet_hash(pkt, 1, (from?from:yd->user));
+
+ yahoo_send_packet(yid, pkt, 0);
+
+ yahoo_packet_free(pkt);
+}
+
+void yahoo_webcam_close_feed(int id, const char *who)
+{
+ struct yahoo_input_data *yid = find_input_by_id_and_webcam_user(id, who);
+
+ if(yid)
+ yahoo_input_close(yid);
+}
+
+void yahoo_webcam_get_feed(int id, const char *who)
+{
+ struct yahoo_input_data *yid = find_input_by_id_and_type(id, YAHOO_CONNECTION_PAGER);
+ struct yahoo_data *yd;
+ struct yahoo_packet *pkt;
+
+ if(!yid)
+ return;
+
+ /*
+ * add the user to the queue. this is a dirty hack, since
+ * the yahoo server doesn't tell us who's key it's returning,
+ * we have to just hope that it sends back keys in the same
+ * order that we request them.
+ * The queue is popped in yahoo_process_webcam_key
+ */
+ webcam_queue = y_list_append(webcam_queue, who?strdup(who):NULL);
+
+ yd = yid->yd;
+
+ pkt = yahoo_packet_new(YAHOO_SERVICE_WEBCAM, YAHOO_STATUS_AVAILABLE, yd->session_id);
+
+ yahoo_packet_hash(pkt, 1, yd->user);
+ if (who != NULL)
+ yahoo_packet_hash(pkt, 5, who);
+ yahoo_send_packet(yid, pkt, 0);
+
+ yahoo_packet_free(pkt);
+}
+
+void yahoo_webcam_send_image(int id, unsigned char *image, unsigned int length, unsigned int timestamp)
+{
+ struct yahoo_input_data *yid = find_input_by_id_and_type(id, YAHOO_CONNECTION_WEBCAM);
+ unsigned char *packet;
+ unsigned char header_len = 13;
+ unsigned int pos = 0;
+
+ if (!yid)
+ return;
+
+ packet = y_new0(unsigned char, header_len);
+
+ packet[pos++] = header_len;
+ packet[pos++] = 0;
+ packet[pos++] = 5; /* version byte?? */
+ packet[pos++] = 0;
+ pos += yahoo_put32(packet + pos, length);
+ packet[pos++] = 2; /* packet type, image */
+ pos += yahoo_put32(packet + pos, timestamp);
+ yahoo_add_to_send_queue(yid, packet, header_len);
+ FREE(packet);
+
+ if (length)
+ yahoo_add_to_send_queue(yid, image, length);
+}
+
+void yahoo_webcam_accept_viewer(int id, const char* who, int accept)
+{
+ struct yahoo_input_data *yid = find_input_by_id_and_type(id, YAHOO_CONNECTION_WEBCAM);
+ char *packet = NULL;
+ char *data = NULL;
+ unsigned char header_len = 13;
+ unsigned int pos = 0;
+ unsigned int len = 0;
+
+ if (!yid)
+ return;
+
+ data = strdup("u=");
+ data = y_string_append(data, (char*)who);
+ data = y_string_append(data, "\r\n");
+ len = strlen(data);
+
+ packet = y_new0(char, header_len + len);
+ packet[pos++] = header_len;
+ packet[pos++] = 0;
+ packet[pos++] = 5; /* version byte?? */
+ packet[pos++] = 0;
+ pos += yahoo_put32(packet + pos, len);
+ packet[pos++] = 0; /* packet type */
+ pos += yahoo_put32(packet + pos, accept);
+ memcpy(packet + pos, data, len);
+ FREE(data);
+ yahoo_add_to_send_queue(yid, packet, header_len + len);
+ FREE(packet);
+}
+
+void yahoo_webcam_invite(int id, const char *who)
+{
+ struct yahoo_input_data *yid = find_input_by_id_and_type(id, YAHOO_CONNECTION_PAGER);
+ struct yahoo_packet *pkt;
+
+ if(!yid)
+ return;
+
+ pkt = yahoo_packet_new(YAHOO_SERVICE_NOTIFY, YAHOO_STATUS_NOTIFY, yid->yd->session_id);
+
+ yahoo_packet_hash(pkt, 49, "WEBCAMINVITE");
+ yahoo_packet_hash(pkt, 14, " ");
+ yahoo_packet_hash(pkt, 13, "0");
+ yahoo_packet_hash(pkt, 1, yid->yd->user);
+ yahoo_packet_hash(pkt, 5, who);
+ yahoo_send_packet(yid, pkt, 0);
+
+ yahoo_packet_free(pkt);
+}
+
+static void yahoo_search_internal(int id, int t, const char *text, int g, int ar, int photo, int yahoo_only, int startpos, int total)
+{
+ struct yahoo_data *yd = find_conn_by_id(id);
+ struct yahoo_input_data *yid;
+ char url[1024];
+ char buff[1024];
+ char *ctext, *p;
+
+ if(!yd)
+ return;
+
+ yid = y_new0(struct yahoo_input_data, 1);
+ yid->yd = yd;
+ yid->type = YAHOO_CONNECTION_SEARCH;
+
+ /*
+ age range
+ .ar=1 - 13-18, 2 - 18-25, 3 - 25-35, 4 - 35-50, 5 - 50-70, 6 - 70+
+ */
+
+ snprintf(buff, sizeof(buff), "&.sq=%%20&.tt=%d&.ss=%d", total, startpos);
+
+ ctext = strdup(text);
+ while((p = strchr(ctext, ' ')))
+ *p = '+';
+
+ snprintf(url, 1024, "http://members.yahoo.com/interests?.oc=m&.kw=%s&.sb=%d&.g=%d&.ar=0%s%s%s",
+ ctext, t, g, photo ? "&.p=y" : "", yahoo_only ? "&.pg=y" : "",
+ startpos ? buff : "");
+
+ FREE(ctext);
+
+ snprintf(buff, sizeof(buff), "Y=%s; T=%s", yd->cookie_y, yd->cookie_t);
+ //snprintf(buff, sizeof(buff), "Y=%s; T=%s; C=%s", yd->cookie_y, yd->cookie_t, yd->cookie_c);
+
+ inputs = y_list_prepend(inputs, yid);
+ yahoo_http_get(yid->yd->client_id, url, buff, _yahoo_http_connected, yid);
+}
+
+void yahoo_search(int id, enum yahoo_search_type t, const char *text, enum yahoo_search_gender g, enum yahoo_search_agerange ar,
+ int photo, int yahoo_only)
+{
+ struct yahoo_input_data *yid = find_input_by_id_and_type(id, YAHOO_CONNECTION_PAGER);
+ struct yahoo_search_state *yss;
+
+ if(!yid)
+ return;
+
+ if(!yid->ys)
+ yid->ys = y_new0(struct yahoo_search_state, 1);
+
+ yss = yid->ys;
+
+ FREE(yss->lsearch_text);
+ yss->lsearch_type = t;
+ yss->lsearch_text = strdup(text);
+ yss->lsearch_gender = g;
+ yss->lsearch_agerange = ar;
+ yss->lsearch_photo = photo;
+ yss->lsearch_yahoo_only = yahoo_only;
+
+ yahoo_search_internal(id, t, text, g, ar, photo, yahoo_only, 0, 0);
+}
+
+void yahoo_search_again(int id, int start)
+{
+ struct yahoo_input_data *yid = find_input_by_id_and_type(id, YAHOO_CONNECTION_PAGER);
+ struct yahoo_search_state *yss;
+
+ if(!yid || !yid->ys)
+ return;
+
+ yss = yid->ys;
+
+ if(start == -1)
+ start = yss->lsearch_nstart + yss->lsearch_nfound;
+
+ yahoo_search_internal(id, yss->lsearch_type, yss->lsearch_text,
+ yss->lsearch_gender, yss->lsearch_agerange,
+ yss->lsearch_photo, yss->lsearch_yahoo_only,
+ start, yss->lsearch_ntotal);
+}
+
+struct send_file_data {
+ struct yahoo_packet *pkt;
+ yahoo_get_fd_callback callback;
+ void *user_data;
+};
+
+static void _yahoo_send_file_connected(int id, int fd, int error, void *data)
+{
+ struct yahoo_input_data *yid = find_input_by_id_and_type(id, YAHOO_CONNECTION_FT);
+ struct send_file_data *sfd = data;
+ struct yahoo_packet *pkt = sfd->pkt;
+ unsigned char buff[1024];
+
+ if(fd <= 0) {
+ sfd->callback(id, fd, error, sfd->user_data);
+ FREE(sfd);
+ yahoo_packet_free(pkt);
+ inputs = y_list_remove(inputs, yid);
+ FREE(yid);
+ return;
+ }
+
+ yid->fd = fd;
+ yahoo_send_packet(yid, pkt, 8);
+ yahoo_packet_free(pkt);
+
+ snprintf((char *)buff, sizeof(buff), "29");
+ buff[2] = 0xc0;
+ buff[3] = 0x80;
+
+ write(yid->fd, buff, 4);
+
+/* YAHOO_CALLBACK(ext_yahoo_add_handler)(nyd->fd, YAHOO_INPUT_READ); */
+
+ sfd->callback(id, fd, error, sfd->user_data);
+ FREE(sfd);
+ inputs = y_list_remove(inputs, yid);
+ /*
+ while(yahoo_tcp_readline(buff, sizeof(buff), nyd->fd) > 0) {
+ if(!strcmp(buff, ""))
+ break;
+ }
+
+ */
+ yahoo_input_close(yid);
+}
+
+void yahoo_send_file(int id, const char *who, const char *msg,
+ const char *name, unsigned long size,
+ yahoo_get_fd_callback callback, void *data)
+{
+ struct yahoo_data *yd = find_conn_by_id(id);
+ struct yahoo_input_data *yid;
+ struct yahoo_server_settings *yss;
+ struct yahoo_packet *pkt = NULL;
+ char size_str[10];
+ long content_length=0;
+ unsigned char buff[1024];
+ char url[255];
+ struct send_file_data *sfd;
+ const char *s;
+
+ if(!yd)
+ return;
+
+ yss = yd->server_settings;
+
+ yid = y_new0(struct yahoo_input_data, 1);
+ yid->yd = yd;
+ yid->type = YAHOO_CONNECTION_FT;
+
+ pkt = yahoo_packet_new(YAHOO_SERVICE_FILETRANSFER, YAHOO_STATUS_AVAILABLE, yd->session_id);
+
+ snprintf(size_str, sizeof(size_str), "%lu", size);
+
+ yahoo_packet_hash(pkt, 0, yd->user);
+ yahoo_packet_hash(pkt, 5, who);
+ yahoo_packet_hash(pkt, 14, msg);
+
+ s = strrchr(name, '\\');
+ if (s == NULL)
+ s = name;
+ else
+ s++;
+
+ yahoo_packet_hash(pkt, 27, s);
+ yahoo_packet_hash(pkt, 28, size_str);
+
+ content_length = YAHOO_PACKET_HDRLEN + yahoo_packet_length(pkt);
+
+ snprintf(url, sizeof(url), "http://%s:%d/notifyft",
+ yss->filetransfer_host, yss->filetransfer_port);
+ snprintf((char *)buff, sizeof(buff), "Y=%s; T=%s; C=%s;",
+ yd->cookie_y, yd->cookie_t, yd->cookie_c);
+ inputs = y_list_prepend(inputs, yid);
+
+ sfd = y_new0(struct send_file_data, 1);
+ sfd->pkt = pkt;
+ sfd->callback = callback;
+ sfd->user_data = data;
+ yahoo_http_post(yid->yd->client_id, url, (char *)buff, content_length+4+size,
+ _yahoo_send_file_connected, sfd);
+}
+
+void yahoo_send_avatar(int id, const char *name, unsigned long size,
+ yahoo_get_fd_callback callback, void *data)
+{
+ struct yahoo_data *yd = find_conn_by_id(id);
+ struct yahoo_input_data *yid;
+ struct yahoo_server_settings *yss;
+ struct yahoo_packet *pkt = NULL;
+ char size_str[10];
+ long content_length=0;
+ unsigned char buff[1024];
+ char url[255];
+ struct send_file_data *sfd;
+ const char *s;
+
+ if(!yd)
+ return;
+
+ yss = yd->server_settings;
+
+ yid = y_new0(struct yahoo_input_data, 1);
+ yid->yd = yd;
+ yid->type = YAHOO_CONNECTION_FT;
+
+ pkt = yahoo_packet_new(YAHOO_SERVICE_PICTURE_UPLOAD, YAHOO_STATUS_AVAILABLE, yd->session_id);
+ /* 1 = me, 38 = expire time(?), 0 = me, 28 = size, 27 = filename, 14 = NULL, 29 = data */
+ snprintf(size_str, sizeof(size_str), "%lu", size);
+
+ yahoo_packet_hash(pkt, 1, yd->user);
+ yahoo_packet_hash(pkt, 38, "604800"); /* time to expire */
+ yahoo_packet_hash(pkt, 0, yd->user);
+
+ s = strrchr(name, '\\');
+ if (s == NULL)
+ s = name;
+ else
+ s++;
+ yahoo_packet_hash(pkt, 28, size_str);
+ yahoo_packet_hash(pkt, 27, s);
+ yahoo_packet_hash(pkt, 14, "");
+
+ content_length = YAHOO_PACKET_HDRLEN + yahoo_packet_length(pkt);
+
+ snprintf(url, sizeof(url), "http://%s:%d/notifyft",
+ yss->filetransfer_host, yss->filetransfer_port);
+ snprintf((char *)buff, sizeof(buff), "Y=%s; T=%s; C=%s;",
+ yd->cookie_y, yd->cookie_t, yd->cookie_c);
+ inputs = y_list_prepend(inputs, yid);
+
+ sfd = y_new0(struct send_file_data, 1);
+ sfd->pkt = pkt;
+ sfd->callback = callback;
+ sfd->user_data = data;
+ yahoo_http_post(yid->yd->client_id, url, (char *)buff, content_length+4+size,
+ _yahoo_send_file_connected, sfd);
+}
+
+enum yahoo_status yahoo_current_status(int id)
+{
+ struct yahoo_data *yd = find_conn_by_id(id);
+ if(!yd)
+ return YAHOO_STATUS_OFFLINE;
+ return yd->current_status;
+}
+
+const YList * yahoo_get_buddylist(int id)
+{
+ struct yahoo_data *yd = find_conn_by_id(id);
+ if(!yd)
+ return NULL;
+ return yd->buddies;
+}
+
+const YList * yahoo_get_ignorelist(int id)
+{
+ struct yahoo_data *yd = find_conn_by_id(id);
+ if(!yd)
+ return NULL;
+ return yd->ignore;
+}
+
+const YList * yahoo_get_identities(int id)
+{
+ struct yahoo_data *yd = find_conn_by_id(id);
+ if(!yd)
+ return NULL;
+ return yd->identities;
+}
+
+const char * yahoo_get_cookie(int id, const char *which)
+{
+ struct yahoo_data *yd = find_conn_by_id(id);
+ if(!yd)
+ return NULL;
+ if(!strncasecmp(which, "y", 1))
+ return yd->cookie_y;
+ if(!strncasecmp(which, "t", 1))
+ return yd->cookie_t;
+ if(!strncasecmp(which, "c", 1))
+ return yd->cookie_c;
+ if(!strncasecmp(which, "login", 5))
+ return yd->login_cookie;
+ if(!strncasecmp(which, "b", 1))
+ return yd->cookie_b;
+ return NULL;
+}
+
+void yahoo_get_url_handle(int id, const char *url,
+ yahoo_get_url_handle_callback callback, void *data)
+{
+ struct yahoo_data *yd = find_conn_by_id(id);
+ if(!yd)
+ return;
+
+ yahoo_get_url_fd(id, url, yd, callback, data);
+}
+
+const char * yahoo_get_profile_url( void )
+{
+ return profile_url;
+}
+
+void yahoo_request_buddy_avatar(int id, const char *buddy)
+{
+ struct yahoo_input_data *yid = find_input_by_id_and_type(id, YAHOO_CONNECTION_PAGER);
+ struct yahoo_data *yd;
+ struct yahoo_packet *pkt = NULL;
+ struct yahoo_server_settings *yss;
+
+ if(!yid)
+ return;
+
+ yd = yid->yd;
+ yss = yd->server_settings;
+
+ pkt = yahoo_packet_new(YAHOO_SERVICE_PICTURE, YAHOO_STATUS_AVAILABLE, yd->session_id);
+ yahoo_packet_hash(pkt, 1, yd->user);
+ yahoo_packet_hash(pkt, 5, buddy);
+ yahoo_packet_hash(pkt, 13, "1");
+
+ if (yss->web_messenger) {
+ char z[128];
+
+ yahoo_packet_hash(pkt, 0, yd->user);
+ wsprintf(z, "%d", yd->session_timestamp);
+ yahoo_packet_hash(pkt, 24, z);
+ }
+
+ yahoo_send_packet(yid, pkt, 0);
+ yahoo_packet_free(pkt);
+}
+
+void yahoo_ftdc_cancel(int id, const char *buddy, const char *filename, const char *ft_token, int command)
+{
+ struct yahoo_input_data *yid = find_input_by_id_and_type(id, YAHOO_CONNECTION_PAGER);
+ struct yahoo_data *yd;
+ struct yahoo_packet *pkt = NULL;
+
+ if(!yid)
+ return;
+
+ yd = yid->yd;
+
+ pkt = yahoo_packet_new(YAHOO_SERVICE_P2PFILEXFER, YAHOO_STATUS_AVAILABLE, yd->session_id);
+ yahoo_packet_hash(pkt, 5, buddy);
+ yahoo_packet_hash(pkt, 49, "FILEXFER");
+ yahoo_packet_hash(pkt, 1, yd->user);
+ yahoo_packet_hash(pkt, 13, (command == 2) ? "2" : "3");
+ yahoo_packet_hash(pkt, 27, filename);
+ yahoo_packet_hash(pkt, 53, ft_token);
+
+ yahoo_send_packet(yid, pkt, 0);
+ yahoo_packet_free(pkt);
+
+}
+
+void yahoo_ft7dc_accept(int id, const char *buddy, const char *ft_token)
+{
+ struct yahoo_input_data *yid = find_input_by_id_and_type(id, YAHOO_CONNECTION_PAGER);
+ struct yahoo_data *yd;
+ struct yahoo_packet *pkt = NULL;
+
+ if(!yid)
+ return;
+
+ yd = yid->yd;
+
+ pkt = yahoo_packet_new(YAHOO_SERVICE_Y7_FILETRANSFER, YAHOO_STATUS_AVAILABLE, yd->session_id);
+ yahoo_packet_hash(pkt, 1, yd->user);
+ yahoo_packet_hash(pkt, 5, buddy);
+ yahoo_packet_hash(pkt,265, ft_token);
+ yahoo_packet_hash(pkt,222, "3");
+
+ yahoo_send_packet(yid, pkt, 0);
+ yahoo_packet_free(pkt);
+
+}
+
+void yahoo_ft7dc_cancel(int id, const char *buddy, const char *ft_token)
+{
+ struct yahoo_input_data *yid = find_input_by_id_and_type(id, YAHOO_CONNECTION_PAGER);
+ struct yahoo_data *yd;
+ struct yahoo_packet *pkt = NULL;
+
+ if(!yid)
+ return;
+
+ yd = yid->yd;
+
+ pkt = yahoo_packet_new(YAHOO_SERVICE_Y7_FILETRANSFER, YAHOO_STATUS_AVAILABLE, yd->session_id);
+ yahoo_packet_hash(pkt, 1, yd->user);
+ yahoo_packet_hash(pkt, 5, buddy);
+ yahoo_packet_hash(pkt,265, ft_token);
+ yahoo_packet_hash(pkt,222, "4");
+
+ yahoo_send_packet(yid, pkt, 0);
+ yahoo_packet_free(pkt);
+
+}
+
+char *yahoo_webmessenger_idle_packet(int id, int *len)
+{
+ struct yahoo_input_data *yid = find_input_by_id_and_type(id, YAHOO_CONNECTION_PAGER);
+ struct yahoo_data *yd;
+ struct yahoo_packet *pkt = NULL;
+ char z[128];
+ int pktlen;
+ unsigned char *data;
+ int pos = 0;
+ int web_messenger = 1;
+
+ if(!yid) {
+ DEBUG_MSG(("NO Yahoo Input Data???"));
+ return NULL;
+ }
+
+ yd = yid->yd;
+
+ DEBUG_MSG(("[yahoo_webmessenger_idle_packet] Session: %d", yd->session_timestamp));
+
+ pkt = yahoo_packet_new(YAHOO_SERVICE_IDLE, YAHOO_STATUS_AVAILABLE, yd->session_id);
+ yahoo_packet_hash(pkt, 0, yd->user);
+
+ wsprintf(z, "%d", yd->session_timestamp);
+ yahoo_packet_hash(pkt, 24, z);
+
+ pktlen = yahoo_packet_length(pkt);
+ (*len) = YAHOO_PACKET_HDRLEN + pktlen;
+ data = y_new0(unsigned char, (*len) + 1);
+
+ memcpy(data + pos, "YMSG", 4); pos += 4;
+ pos += yahoo_put16(data + pos, web_messenger ? YAHOO_WEBMESSENGER_PROTO_VER : YAHOO_PROTO_VER); /* version [latest 12 0x000c */
+ pos += yahoo_put16(data + pos, 0x0000); /* HIWORD pkt length??? */
+ pos += yahoo_put16(data + pos, pktlen); /* LOWORD pkt length? */
+ pos += yahoo_put16(data + pos, pkt->service); /* service */
+ pos += yahoo_put32(data + pos, pkt->status); /* status [4bytes] */
+ pos += yahoo_put32(data + pos, pkt->id); /* session [4bytes] */
+
+ yahoo_packet_write(pkt, data + pos);
+
+ //yahoo_packet_dump(data, len);
+ DEBUG_MSG(("Sending Idle Packet:"));
+ DEBUG_MSG(("Yahoo Service: %s (0x%02x) Status: %s (%d)", dbg_service(pkt->service), pkt->service,
+ dbg_status(pkt->status),pkt->status));
+
+ yahoo_packet_read(pkt, data + pos, (*len) - pos);
+
+
+ return data;
+}
+
+void yahoo_send_idle_packet(int id)
+{
+ struct yahoo_input_data *yid = find_input_by_id_and_type(id, YAHOO_CONNECTION_PAGER);
+ struct yahoo_data *yd;
+ struct yahoo_packet *pkt = NULL;
+ char z[128];
+
+ if(!yid) {
+ DEBUG_MSG(("NO Yahoo Input Data???"));
+ return;
+ }
+
+ yd = yid->yd;
+
+ DEBUG_MSG(("[yahoo_send_idle_packet] Session: %d", yd->session_timestamp));
+
+ pkt = yahoo_packet_new(YAHOO_SERVICE_IDLE, YAHOO_STATUS_AVAILABLE, yd->session_id);
+ yahoo_packet_hash(pkt, 0, yd->user);
+
+ wsprintf(z, "%d", yd->session_timestamp);
+ yahoo_packet_hash(pkt, 24, z);
+
+ yahoo_send_packet(yid, pkt, 0);
+ yahoo_packet_free(pkt);
+}
diff --git a/miranda-wine/protocols/Yahoo/libyahoo2/md5.c b/miranda-wine/protocols/Yahoo/libyahoo2/md5.c
new file mode 100644
index 0000000..88a0ed1
--- /dev/null
+++ b/miranda-wine/protocols/Yahoo/libyahoo2/md5.c
@@ -0,0 +1,408 @@
+/*
+ Copyright (C) 1999 Aladdin Enterprises. All rights reserved.
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+
+ L. Peter Deutsch
+ ghost@aladdin.com
+
+ */
+/*
+ Independent implementation of MD5 (RFC 1321).
+
+ This code implements the MD5 Algorithm defined in RFC 1321.
+ It is derived directly from the text of the RFC and not from the
+ reference implementation.
+
+ The original and principal author of md5.c is L. Peter Deutsch
+ <ghost@aladdin.com>. Other authors are noted in the change history
+ that follows (in reverse chronological order):
+
+ 1999-11-04 lpd Edited comments slightly for automatic TOC extraction.
+ 1999-10-18 lpd Fixed typo in header comment (ansi2knr rather than md5).
+ 1999-05-03 lpd Original version.
+ */
+
+#if HAVE_CONFIG_H
+# include "config.h"
+#endif
+
+#include "md5.h"
+
+#if STDC_HEADERS
+# include <string.h>
+#else
+# if !HAVE_STRCHR
+# define strchr index
+# define strrchr rindex
+# endif
+char *strchr (), *strrchr ();
+# if !HAVE_MEMCPY
+# define memcpy(d, s, n) bcopy ((s), (d), (n))
+# define memmove(d, s, n) bcopy ((s), (d), (n))
+# endif
+#endif
+
+#ifdef TEST
+/*
+ * Compile with -DTEST to create a self-contained executable test program.
+ * The test program should print out the same values as given in section
+ * A.5 of RFC 1321, reproduced below.
+ */
+main()
+{
+ static const char *const test[7] = {
+ "", /*d41d8cd98f00b204e9800998ecf8427e*/
+ "945399884.61923487334tuvga", /*0cc175b9c0f1b6a831c399e269772661*/
+ "abc", /*900150983cd24fb0d6963f7d28e17f72*/
+ "message digest", /*f96b697d7cb7938d525a2f31aaf161d0*/
+ "abcdefghijklmnopqrstuvwxyz", /*c3fcd3d76192e4007dfb496cca67e13b*/
+ "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",
+ /*d174ab98d277d9f5a5611c2c9f419d9f*/
+ "12345678901234567890123456789012345678901234567890123456789012345678901234567890" /*57edf4a22be3c955ac49da2e2107b67a*/
+ };
+ int i;
+
+ for (i = 0; i < 7; ++i) {
+ md5_state_t state;
+ md5_byte_t digest[16];
+ int di;
+
+ md5_init(&state);
+ md5_append(&state, (const md5_byte_t *)test[i], strlen(test[i]));
+ md5_finish(&state, digest);
+ printf("MD5 (\"%s\") = ", test[i]);
+ for (di = 0; di < 16; ++di)
+ printf("%02x", digest[di]);
+ printf("\n");
+ }
+ return 0;
+}
+#endif /* TEST */
+
+
+/*
+ * For reference, here is the program that computed the T values.
+ */
+#if 0
+#include <math.h>
+main()
+{
+ int i;
+ for (i = 1; i <= 64; ++i) {
+ unsigned long v = (unsigned long)(4294967296.0 * fabs(sin((double)i)));
+ printf("#define T%d 0x%08lx\n", i, v);
+ }
+ return 0;
+}
+#endif
+/*
+ * End of T computation program.
+ */
+#define T1 0xd76aa478
+#define T2 0xe8c7b756
+#define T3 0x242070db
+#define T4 0xc1bdceee
+#define T5 0xf57c0faf
+#define T6 0x4787c62a
+#define T7 0xa8304613
+#define T8 0xfd469501
+#define T9 0x698098d8
+#define T10 0x8b44f7af
+#define T11 0xffff5bb1
+#define T12 0x895cd7be
+#define T13 0x6b901122
+#define T14 0xfd987193
+#define T15 0xa679438e
+#define T16 0x49b40821
+#define T17 0xf61e2562
+#define T18 0xc040b340
+#define T19 0x265e5a51
+#define T20 0xe9b6c7aa
+#define T21 0xd62f105d
+#define T22 0x02441453
+#define T23 0xd8a1e681
+#define T24 0xe7d3fbc8
+#define T25 0x21e1cde6
+#define T26 0xc33707d6
+#define T27 0xf4d50d87
+#define T28 0x455a14ed
+#define T29 0xa9e3e905
+#define T30 0xfcefa3f8
+#define T31 0x676f02d9
+#define T32 0x8d2a4c8a
+#define T33 0xfffa3942
+#define T34 0x8771f681
+#define T35 0x6d9d6122
+#define T36 0xfde5380c
+#define T37 0xa4beea44
+#define T38 0x4bdecfa9
+#define T39 0xf6bb4b60
+#define T40 0xbebfbc70
+#define T41 0x289b7ec6
+#define T42 0xeaa127fa
+#define T43 0xd4ef3085
+#define T44 0x04881d05
+#define T45 0xd9d4d039
+#define T46 0xe6db99e5
+#define T47 0x1fa27cf8
+#define T48 0xc4ac5665
+#define T49 0xf4292244
+#define T50 0x432aff97
+#define T51 0xab9423a7
+#define T52 0xfc93a039
+#define T53 0x655b59c3
+#define T54 0x8f0ccc92
+#define T55 0xffeff47d
+#define T56 0x85845dd1
+#define T57 0x6fa87e4f
+#define T58 0xfe2ce6e0
+#define T59 0xa3014314
+#define T60 0x4e0811a1
+#define T61 0xf7537e82
+#define T62 0xbd3af235
+#define T63 0x2ad7d2bb
+#define T64 0xeb86d391
+
+static void
+md5_process(md5_state_t *pms, const md5_byte_t *data /*[64]*/)
+{
+ md5_word_t
+ a = pms->abcd[0], b = pms->abcd[1],
+ c = pms->abcd[2], d = pms->abcd[3];
+ md5_word_t t;
+
+#ifndef ARCH_IS_BIG_ENDIAN
+# define ARCH_IS_BIG_ENDIAN 1 /* slower, default implementation */
+#endif
+#if ARCH_IS_BIG_ENDIAN
+
+ /*
+ * On big-endian machines, we must arrange the bytes in the right
+ * order. (This also works on machines of unknown byte order.)
+ */
+ md5_word_t X[16];
+ const md5_byte_t *xp = data;
+ int i;
+
+ for (i = 0; i < 16; ++i, xp += 4)
+ X[i] = xp[0] + (xp[1] << 8) + (xp[2] << 16) + (xp[3] << 24);
+
+#else /* !ARCH_IS_BIG_ENDIAN */
+
+ /*
+ * On little-endian machines, we can process properly aligned data
+ * without copying it.
+ */
+ md5_word_t xbuf[16];
+ const md5_word_t *X;
+
+ if (!((data - (const md5_byte_t *)0) & 3)) {
+ /* data are properly aligned */
+ X = (const md5_word_t *)data;
+ } else {
+ /* not aligned */
+ memcpy(xbuf, data, 64);
+ X = xbuf;
+ }
+#endif
+
+#define ROTATE_LEFT(x, n) (((x) << (n)) | ((x) >> (32 - (n))))
+
+ /* Round 1. */
+ /* Let [abcd k s i] denote the operation
+ a = b + ((a + F(b,c,d) + X[k] + T[i]) <<< s). */
+#define F(x, y, z) (((x) & (y)) | (~(x) & (z)))
+#define SET(a, b, c, d, k, s, Ti)\
+ t = a + F(b,c,d) + X[k] + Ti;\
+ a = ROTATE_LEFT(t, s) + b
+ /* Do the following 16 operations. */
+ SET(a, b, c, d, 0, 7, T1);
+ SET(d, a, b, c, 1, 12, T2);
+ SET(c, d, a, b, 2, 17, T3);
+ SET(b, c, d, a, 3, 22, T4);
+ SET(a, b, c, d, 4, 7, T5);
+ SET(d, a, b, c, 5, 12, T6);
+ SET(c, d, a, b, 6, 17, T7);
+ SET(b, c, d, a, 7, 22, T8);
+ SET(a, b, c, d, 8, 7, T9);
+ SET(d, a, b, c, 9, 12, T10);
+ SET(c, d, a, b, 10, 17, T11);
+ SET(b, c, d, a, 11, 22, T12);
+ SET(a, b, c, d, 12, 7, T13);
+ SET(d, a, b, c, 13, 12, T14);
+ SET(c, d, a, b, 14, 17, T15);
+ SET(b, c, d, a, 15, 22, T16);
+#undef SET
+
+ /* Round 2. */
+ /* Let [abcd k s i] denote the operation
+ a = b + ((a + G(b,c,d) + X[k] + T[i]) <<< s). */
+#define G(x, y, z) (((x) & (z)) | ((y) & ~(z)))
+#define SET(a, b, c, d, k, s, Ti)\
+ t = a + G(b,c,d) + X[k] + Ti;\
+ a = ROTATE_LEFT(t, s) + b
+ /* Do the following 16 operations. */
+ SET(a, b, c, d, 1, 5, T17);
+ SET(d, a, b, c, 6, 9, T18);
+ SET(c, d, a, b, 11, 14, T19);
+ SET(b, c, d, a, 0, 20, T20);
+ SET(a, b, c, d, 5, 5, T21);
+ SET(d, a, b, c, 10, 9, T22);
+ SET(c, d, a, b, 15, 14, T23);
+ SET(b, c, d, a, 4, 20, T24);
+ SET(a, b, c, d, 9, 5, T25);
+ SET(d, a, b, c, 14, 9, T26);
+ SET(c, d, a, b, 3, 14, T27);
+ SET(b, c, d, a, 8, 20, T28);
+ SET(a, b, c, d, 13, 5, T29);
+ SET(d, a, b, c, 2, 9, T30);
+ SET(c, d, a, b, 7, 14, T31);
+ SET(b, c, d, a, 12, 20, T32);
+#undef SET
+
+ /* Round 3. */
+ /* Let [abcd k s t] denote the operation
+ a = b + ((a + H(b,c,d) + X[k] + T[i]) <<< s). */
+#define H(x, y, z) ((x) ^ (y) ^ (z))
+#define SET(a, b, c, d, k, s, Ti)\
+ t = a + H(b,c,d) + X[k] + Ti;\
+ a = ROTATE_LEFT(t, s) + b
+ /* Do the following 16 operations. */
+ SET(a, b, c, d, 5, 4, T33);
+ SET(d, a, b, c, 8, 11, T34);
+ SET(c, d, a, b, 11, 16, T35);
+ SET(b, c, d, a, 14, 23, T36);
+ SET(a, b, c, d, 1, 4, T37);
+ SET(d, a, b, c, 4, 11, T38);
+ SET(c, d, a, b, 7, 16, T39);
+ SET(b, c, d, a, 10, 23, T40);
+ SET(a, b, c, d, 13, 4, T41);
+ SET(d, a, b, c, 0, 11, T42);
+ SET(c, d, a, b, 3, 16, T43);
+ SET(b, c, d, a, 6, 23, T44);
+ SET(a, b, c, d, 9, 4, T45);
+ SET(d, a, b, c, 12, 11, T46);
+ SET(c, d, a, b, 15, 16, T47);
+ SET(b, c, d, a, 2, 23, T48);
+#undef SET
+
+ /* Round 4. */
+ /* Let [abcd k s t] denote the operation
+ a = b + ((a + I(b,c,d) + X[k] + T[i]) <<< s). */
+#define I(x, y, z) ((y) ^ ((x) | ~(z)))
+#define SET(a, b, c, d, k, s, Ti)\
+ t = a + I(b,c,d) + X[k] + Ti;\
+ a = ROTATE_LEFT(t, s) + b
+ /* Do the following 16 operations. */
+ SET(a, b, c, d, 0, 6, T49);
+ SET(d, a, b, c, 7, 10, T50);
+ SET(c, d, a, b, 14, 15, T51);
+ SET(b, c, d, a, 5, 21, T52);
+ SET(a, b, c, d, 12, 6, T53);
+ SET(d, a, b, c, 3, 10, T54);
+ SET(c, d, a, b, 10, 15, T55);
+ SET(b, c, d, a, 1, 21, T56);
+ SET(a, b, c, d, 8, 6, T57);
+ SET(d, a, b, c, 15, 10, T58);
+ SET(c, d, a, b, 6, 15, T59);
+ SET(b, c, d, a, 13, 21, T60);
+ SET(a, b, c, d, 4, 6, T61);
+ SET(d, a, b, c, 11, 10, T62);
+ SET(c, d, a, b, 2, 15, T63);
+ SET(b, c, d, a, 9, 21, T64);
+#undef SET
+
+ /* Then perform the following additions. (That is increment each
+ of the four registers by the value it had before this block
+ was started.) */
+ pms->abcd[0] += a;
+ pms->abcd[1] += b;
+ pms->abcd[2] += c;
+ pms->abcd[3] += d;
+}
+
+void
+md5_init(md5_state_t *pms)
+{
+ pms->count[0] = pms->count[1] = 0;
+ pms->abcd[0] = 0x67452301;
+ pms->abcd[1] = 0xefcdab89;
+ pms->abcd[2] = 0x98badcfe;
+ pms->abcd[3] = 0x10325476;
+}
+
+void
+md5_append(md5_state_t *pms, const md5_byte_t *data, int nbytes)
+{
+ const md5_byte_t *p = data;
+ int left = nbytes;
+ int offset = (pms->count[0] >> 3) & 63;
+ md5_word_t nbits = (md5_word_t)(nbytes << 3);
+
+ if (nbytes <= 0)
+ return;
+
+ /* Update the message length. */
+ pms->count[1] += nbytes >> 29;
+ pms->count[0] += nbits;
+ if (pms->count[0] < nbits)
+ pms->count[1]++;
+
+ /* Process an initial partial block. */
+ if (offset) {
+ int copy = (offset + nbytes > 64 ? 64 - offset : nbytes);
+
+ memcpy(pms->buf + offset, p, copy);
+ if (offset + copy < 64)
+ return;
+ p += copy;
+ left -= copy;
+ md5_process(pms, pms->buf);
+ }
+
+ /* Process full blocks. */
+ for (; left >= 64; p += 64, left -= 64)
+ md5_process(pms, p);
+
+ /* Process a final partial block. */
+ if (left)
+ memcpy(pms->buf, p, left);
+}
+
+void
+md5_finish(md5_state_t *pms, md5_byte_t digest[16])
+{
+ static const md5_byte_t pad[64] = {
+ 0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
+ };
+ md5_byte_t data[8];
+ int i;
+
+ /* Save the length before padding. */
+ for (i = 0; i < 8; ++i)
+ data[i] = (md5_byte_t)(pms->count[i >> 2] >> ((i & 3) << 3));
+ /* Pad to 56 bytes mod 64. */
+ md5_append(pms, pad, ((55 - (pms->count[0] >> 3)) & 63) + 1);
+ /* Append the length. */
+ md5_append(pms, data, 8);
+ for (i = 0; i < 16; ++i)
+ digest[i] = (md5_byte_t)(pms->abcd[i >> 2] >> ((i & 3) << 3));
+}
diff --git a/miranda-wine/protocols/Yahoo/libyahoo2/md5.h b/miranda-wine/protocols/Yahoo/libyahoo2/md5.h
new file mode 100644
index 0000000..04ea494
--- /dev/null
+++ b/miranda-wine/protocols/Yahoo/libyahoo2/md5.h
@@ -0,0 +1,93 @@
+/*
+ Copyright (C) 1999 Aladdin Enterprises. All rights reserved.
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+
+ L. Peter Deutsch
+ ghost@aladdin.com
+
+ */
+/*
+ Independent implementation of MD5 (RFC 1321).
+
+ This code implements the MD5 Algorithm defined in RFC 1321.
+ It is derived directly from the text of the RFC and not from the
+ reference implementation.
+
+ The original and principal author of md5.h is L. Peter Deutsch
+ <ghost@aladdin.com>. Other authors are noted in the change history
+ that follows (in reverse chronological order):
+
+ 1999-11-04 lpd Edited comments slightly for automatic TOC extraction.
+ 1999-10-18 lpd Fixed typo in header comment (ansi2knr rather than md5);
+ added conditionalization for C++ compilation from Martin
+ Purschke <purschke@bnl.gov>.
+ 1999-05-03 lpd Original version.
+ */
+
+#ifndef md5_INCLUDED
+# define md5_INCLUDED
+
+/*
+ * This code has some adaptations for the Ghostscript environment, but it
+ * will compile and run correctly in any environment with 8-bit chars and
+ * 32-bit ints. Specifically, it assumes that if the following are
+ * defined, they have the same meaning as in Ghostscript: P1, P2, P3,
+ * ARCH_IS_BIG_ENDIAN.
+ */
+
+typedef unsigned char md5_byte_t; /* 8-bit byte */
+typedef unsigned int md5_word_t; /* 32-bit word */
+
+/* Define the state of the MD5 Algorithm. */
+typedef struct md5_state_s {
+ md5_word_t count[2]; /* message length in bits, lsw first */
+ md5_word_t abcd[4]; /* digest buffer */
+ md5_byte_t buf[64]; /* accumulate block */
+} md5_state_t;
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+/* Initialize the algorithm. */
+#ifdef P1
+void md5_init(P1(md5_state_t *pms));
+#else
+void md5_init(md5_state_t *pms);
+#endif
+
+/* Append a string to the message. */
+#ifdef P3
+void md5_append(P3(md5_state_t *pms, const md5_byte_t *data, int nbytes));
+#else
+void md5_append(md5_state_t *pms, const md5_byte_t *data, int nbytes);
+#endif
+
+/* Finish the message and return the digest. */
+#ifdef P2
+void md5_finish(P2(md5_state_t *pms, md5_byte_t digest[16]));
+#else
+void md5_finish(md5_state_t *pms, md5_byte_t digest[16]);
+#endif
+
+#ifdef __cplusplus
+} /* end extern "C" */
+#endif
+
+#endif /* md5_INCLUDED */
diff --git a/miranda-wine/protocols/Yahoo/libyahoo2/sha.c b/miranda-wine/protocols/Yahoo/libyahoo2/sha.c
new file mode 100644
index 0000000..0c579db
--- /dev/null
+++ b/miranda-wine/protocols/Yahoo/libyahoo2/sha.c
@@ -0,0 +1,161 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is SHA 180-1 Reference Implementation (Compact version).
+ *
+ * The Initial Developer of the Original Code is
+ * Paul Kocher of Cryptography Research.
+ * Portions created by the Initial Developer are Copyright (C) 1995-9
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+#include "sha.h"
+
+static void shaHashBlock(SHA_CTX *ctx);
+
+void shaInit(SHA_CTX *ctx) {
+ int i;
+
+ ctx->lenW = 0;
+ ctx->sizeHi = ctx->sizeLo = 0;
+
+ /* Initialize H with the magic constants (see FIPS180 for constants)
+ */
+ ctx->H[0] = 0x67452301L;
+ ctx->H[1] = 0xefcdab89L;
+ ctx->H[2] = 0x98badcfeL;
+ ctx->H[3] = 0x10325476L;
+ ctx->H[4] = 0xc3d2e1f0L;
+
+ for (i = 0; i < 80; i++)
+ ctx->W[i] = 0;
+}
+
+
+void shaUpdate(SHA_CTX *ctx, unsigned char *dataIn, int len) {
+ int i;
+
+ /* Read the data into W and process blocks as they get full
+ */
+ for (i = 0; i < len; i++) {
+ ctx->W[ctx->lenW / 4] <<= 8;
+ ctx->W[ctx->lenW / 4] |= (unsigned long)dataIn[i];
+ if ((++ctx->lenW) % 64 == 0) {
+ shaHashBlock(ctx);
+ ctx->lenW = 0;
+ }
+ ctx->sizeLo += 8;
+ ctx->sizeHi += (ctx->sizeLo < 8);
+ }
+}
+
+
+void shaFinal(SHA_CTX *ctx, unsigned char hashout[20]) {
+ unsigned char pad0x80 = 0x80;
+ unsigned char pad0x00 = 0x00;
+ unsigned char padlen[8];
+ int i;
+
+ /* Pad with a binary 1 (e.g. 0x80), then zeroes, then length
+ */
+ padlen[0] = (unsigned char)((ctx->sizeHi >> 24) & 255);
+ padlen[1] = (unsigned char)((ctx->sizeHi >> 16) & 255);
+ padlen[2] = (unsigned char)((ctx->sizeHi >> 8) & 255);
+ padlen[3] = (unsigned char)((ctx->sizeHi >> 0) & 255);
+ padlen[4] = (unsigned char)((ctx->sizeLo >> 24) & 255);
+ padlen[5] = (unsigned char)((ctx->sizeLo >> 16) & 255);
+ padlen[6] = (unsigned char)((ctx->sizeLo >> 8) & 255);
+ padlen[7] = (unsigned char)((ctx->sizeLo >> 0) & 255);
+ shaUpdate(ctx, &pad0x80, 1);
+ while (ctx->lenW != 56)
+ shaUpdate(ctx, &pad0x00, 1);
+ shaUpdate(ctx, padlen, 8);
+
+ /* Output hash
+ */
+ for (i = 0; i < 20; i++) {
+ hashout[i] = (unsigned char)(ctx->H[i / 4] >> 24);
+ ctx->H[i / 4] <<= 8;
+ }
+
+ /*
+ * Re-initialize the context (also zeroizes contents)
+ */
+ shaInit(ctx);
+}
+
+
+void shaBlock(unsigned char *dataIn, int len, unsigned char hashout[20]) {
+ SHA_CTX ctx;
+
+ shaInit(&ctx);
+ shaUpdate(&ctx, dataIn, len);
+ shaFinal(&ctx, hashout);
+}
+
+
+#define SHA_ROTL(X,n) (((X) << (n)) | ((X) >> (32-(n))))
+
+static void shaHashBlock(SHA_CTX *ctx) {
+ int t;
+ unsigned long A,B,C,D,E,TEMP;
+
+ for (t = 16; t <= 79; t++)
+ ctx->W[t] =
+ SHA_ROTL(ctx->W[t-3] ^ ctx->W[t-8] ^ ctx->W[t-14] ^ ctx->W[t-16], 1);
+
+ A = ctx->H[0];
+ B = ctx->H[1];
+ C = ctx->H[2];
+ D = ctx->H[3];
+ E = ctx->H[4];
+
+ for (t = 0; t <= 19; t++) {
+ TEMP = SHA_ROTL(A,5) + (((C^D)&B)^D) + E + ctx->W[t] + 0x5a827999L;
+ E = D; D = C; C = SHA_ROTL(B, 30); B = A; A = TEMP;
+ }
+ for (t = 20; t <= 39; t++) {
+ TEMP = SHA_ROTL(A,5) + (B^C^D) + E + ctx->W[t] + 0x6ed9eba1L;
+ E = D; D = C; C = SHA_ROTL(B, 30); B = A; A = TEMP;
+ }
+ for (t = 40; t <= 59; t++) {
+ TEMP = SHA_ROTL(A,5) + ((B&C)|(D&(B|C))) + E + ctx->W[t] + 0x8f1bbcdcL;
+ E = D; D = C; C = SHA_ROTL(B, 30); B = A; A = TEMP;
+ }
+ for (t = 60; t <= 79; t++) {
+ TEMP = SHA_ROTL(A,5) + (B^C^D) + E + ctx->W[t] + 0xca62c1d6L;
+ E = D; D = C; C = SHA_ROTL(B, 30); B = A; A = TEMP;
+ }
+
+ ctx->H[0] += A;
+ ctx->H[1] += B;
+ ctx->H[2] += C;
+ ctx->H[3] += D;
+ ctx->H[4] += E;
+}
+
diff --git a/miranda-wine/protocols/Yahoo/libyahoo2/sha.h b/miranda-wine/protocols/Yahoo/libyahoo2/sha.h
new file mode 100644
index 0000000..fb58ea5
--- /dev/null
+++ b/miranda-wine/protocols/Yahoo/libyahoo2/sha.h
@@ -0,0 +1,49 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is SHA 180-1 Header File.
+ *
+ * The Initial Developer of the Original Code is
+ * Paul Kocher of Cryptography Research.
+ * Portions created by the Initial Developer are Copyright (C) 1995-9
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+typedef struct {
+ unsigned long H[5];
+ unsigned long W[80];
+ int lenW;
+ unsigned long sizeHi,sizeLo;
+} SHA_CTX;
+
+
+void shaInit(SHA_CTX *ctx);
+void shaUpdate(SHA_CTX *ctx, unsigned char *dataIn, int len);
+void shaFinal(SHA_CTX *ctx, unsigned char hashout[20]);
+void shaBlock(unsigned char *dataIn, int len, unsigned char hashout[20]);
+
diff --git a/miranda-wine/protocols/Yahoo/libyahoo2/yahoo2.h b/miranda-wine/protocols/Yahoo/libyahoo2/yahoo2.h
new file mode 100644
index 0000000..6d174bc
--- /dev/null
+++ b/miranda-wine/protocols/Yahoo/libyahoo2/yahoo2.h
@@ -0,0 +1,216 @@
+/*
+ * libyahoo2: yahoo2.h
+ *
+ * Copyright (C) 2002-2004, Philip S Tellis <philip.tellis AT gmx.net>
+ *
+ * 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 YAHOO2_H
+#define YAHOO2_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "yahoo2_types.h"
+
+/* returns the socket descriptor for a given pager connection. shouldn't be needed */
+int yahoo_get_fd(int id);
+
+/* says how much logging to do */
+/* see yahoo2_types.h for the different values */
+int yahoo_set_log_level(enum yahoo_log_level level);
+enum yahoo_log_level yahoo_get_log_level( void );
+
+/* these functions should be self explanatory */
+/* who always means the buddy you're acting on */
+/* id is the successful value returned by yahoo_init */
+
+
+/* init returns a connection id used to identify the connection hereon */
+/* or 0 on failure */
+/* you must call init before calling any other function */
+/*
+ * The optional parameters to init are key/value pairs that specify
+ * server settings to use. This list must be NULL terminated - even
+ * if the list is empty. If a parameter isn't set, a default value
+ * will be used. Parameter keys are strings, parameter values are
+ * either strings or ints, depending on the key. Values passed in
+ * are copied, so you can use const/auto/static/pointers/whatever
+ * you want. Parameters are:
+ * NAME TYPE DEFAULT
+ * pager_host char * scs.msg.yahoo.com
+ * pager_port int 5050
+ * filetransfer_host char * filetransfer.msg.yahoo.com
+ * filetransfer_port int 80
+ * webcam_host char * webcam.yahoo.com
+ * webcam_port int 5100
+ * webcam_description char * ""
+ * local_host char * ""
+ * conn_type int Y_WCM_DSL
+ *
+ * You should set at least local_host if you intend to use webcams
+ */
+int yahoo_init_with_attributes(const char *username, const char *password, ...);
+
+/* yahoo_init does the same as yahoo_init_with_attributes, assuming defaults
+ * for all attributes */
+int yahoo_init(const char *username, const char *password);
+
+
+
+/* release all resources held by this session */
+/* you need to call yahoo_close for a session only if
+ * yahoo_logoff is never called for it (ie, it was never logged in) */
+void yahoo_close(int id);
+/* login logs in to the server */
+/* initial is of type enum yahoo_status. see yahoo2_types.h */
+void yahoo_login(int id, int initial);
+void yahoo_logoff(int id);
+/* reloads status of all buddies */
+void yahoo_refresh(int id);
+/* activates/deactivates an identity */
+void yahoo_set_identity_status(int id, const char * identity, int active);
+/* regets the entire buddy list from the server */
+void yahoo_get_list(int id);
+/* download buddy contact information from your yahoo addressbook */
+void yahoo_get_yab(int id);
+/* add/modify an address book entry. if yab->dbid is set, it will */
+/* modify that entry else it creates a new entry */
+void yahoo_set_yab(int id, struct yab * yab);
+void yahoo_keepalive(int id);
+void yahoo_chat_keepalive(int id);
+
+/* from is the identity you're sending from. if NULL, the default is used */
+/* utf8 is whether msg is a utf8 string or not. */
+void yahoo_send_im(int id, const char *from, const char *who, const char *msg, int utf8, int buddy_icon);
+/* if type is true, send typing notice, else send stopped typing notice */
+void yahoo_send_typing(int id, const char *from, const char *who, int typ);
+
+/* used to set away/back status. */
+/* away says whether the custom message is an away message or a sig */
+void yahoo_set_away(int id, enum yahoo_status state, const char *msg, int away);
+void yahoo_set_stealth(int id, const char *buddy, int add);
+
+void yahoo_add_buddy(int id, const char *who, const char *group, const char *msg);
+void yahoo_remove_buddy(int id, const char *who, const char *group);
+void yahoo_accept_buddy(int id, const char *who);
+void yahoo_reject_buddy(int id, const char *who, const char *msg);
+/* if unignore is true, unignore, else ignore */
+void yahoo_ignore_buddy(int id, const char *who, int unignore);
+void yahoo_change_buddy_group(int id, const char *who, const char *old_group, const char *new_group);
+void yahoo_group_rename(int id, const char *old_group, const char *new_group);
+
+void yahoo_conference_invite(int id, const char * from, YList *who, const char *room, const char *msg);
+void yahoo_conference_addinvite(int id, const char * from, const char *who, const char *room, const YList * members, const char *msg);
+void yahoo_conference_decline(int id, const char * from, YList *who, const char *room, const char *msg);
+void yahoo_conference_message(int id, const char * from, YList *who, const char *room, const char *msg, int utf8);
+void yahoo_conference_logon(int id, const char * from, YList *who, const char *room);
+void yahoo_conference_logoff(int id, const char * from, YList *who, const char *room);
+
+/* Get a list of chatrooms */
+void yahoo_get_chatrooms(int id,int chatroomid);
+/* join room with specified roomname and roomid */
+void yahoo_chat_logon(int id, const char *from, const char *room, const char *roomid);
+/* Send message "msg" to room with specified roomname, msgtype is 1-normal message or 2-/me mesage */
+void yahoo_chat_message(int id, const char *from, const char *room, const char *msg, const int msgtype, const int utf8);
+/* Log off chat */
+void yahoo_chat_logoff(int id, const char *from);
+
+/* requests a webcam feed */
+/* who is the person who's webcam you would like to view */
+/* if who is null, then you're the broadcaster */
+void yahoo_webcam_get_feed(int id, const char *who);
+void yahoo_webcam_close_feed(int id, const char *who);
+
+/* sends an image when uploading */
+/* image points to a JPEG-2000 image, length is the length of the image */
+/* in bytes. The timestamp is the time in milliseconds since we started the */
+/* webcam. */
+void yahoo_webcam_send_image(int id, unsigned char *image, unsigned int length, unsigned int timestamp);
+
+/* this function should be called if we want to allow a user to watch the */
+/* webcam. Who is the user we want to accept. */
+/* Accept user (accept = 1), decline user (accept = 0) */
+void yahoo_webcam_accept_viewer(int id, const char* who, int accept);
+
+/* send an invitation to a user to view your webcam */
+void yahoo_webcam_invite(int id, const char *who);
+
+/* will set up a connection and initiate file transfer.
+ * callback will be called with the fd that you should write
+ * the file data to
+ */
+void yahoo_send_file(int id, const char *who, const char *msg, const char *name, unsigned long size,
+ yahoo_get_fd_callback callback, void *data);
+
+void yahoo_send_avatar(int id, const char *name, unsigned long size,
+ yahoo_get_fd_callback callback, void *data);
+
+/* send a search request
+ */
+void yahoo_search(int id, enum yahoo_search_type t, const char *text, enum yahoo_search_gender g, enum yahoo_search_agerange ar,
+ int photo, int yahoo_only);
+
+/* continue last search
+ * should be called if only (start+found >= total)
+ *
+ * where the above three are passed to ext_yahoo_got_search_result
+ */
+void yahoo_search_again(int id, int start);
+
+/* returns a socket fd to a url for downloading a file. */
+void yahoo_get_url_handle(int id, const char *url,
+ yahoo_get_url_handle_callback callback, void *data);
+
+/* these should be called when input is available on a fd */
+/* registered by ext_yahoo_add_handler */
+/* if these return negative values, errno may be set */
+int yahoo_read_ready(int id, int fd, void *data);
+int yahoo_write_ready(int id, int fd, void *data);
+
+/* utility functions. these do not hit the server */
+enum yahoo_status yahoo_current_status(int id);
+const YList * yahoo_get_buddylist(int id);
+const YList * yahoo_get_ignorelist(int id);
+const YList * yahoo_get_identities(int id);
+/* 'which' could be y, t, c or login. This may change in later versions. */
+const char * yahoo_get_cookie(int id, const char *which);
+
+/* returns the url used to get user profiles - you must append the user id */
+/* as of now this is http://profiles.yahoo.com/ */
+/* You'll have to do urlencoding yourself, but see yahoo_httplib.h first */
+const char * yahoo_get_profile_url( void );
+
+void yahoo_request_buddy_avatar(int id, const char *buddy);
+void yahoo_send_picture_checksum(int id, const char* who, int cksum);
+void yahoo_send_picture_info(int id, const char *who, int type, const char *pic_url, int cksum);
+void yahoo_send_avatar_update(int id, int buddy_icon);
+void yahoo_send_picture_update(int id, const char *who, int type);
+
+void yahoo_ftdc_cancel(int id, const char *buddy, const char *filename, const char *ft_token, int command);
+void yahoo_ft7dc_accept(int id, const char *buddy, const char *ft_token);
+void yahoo_ft7dc_cancel(int id, const char *buddy, const char *ft_token);
+char *yahoo_webmessenger_idle_packet(int id, int* len);
+void yahoo_send_idle_packet(int id);
+#include "yahoo_httplib.h"
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/miranda-wine/protocols/Yahoo/libyahoo2/yahoo2_callbacks.h b/miranda-wine/protocols/Yahoo/libyahoo2/yahoo2_callbacks.h
new file mode 100644
index 0000000..ac4ede2
--- /dev/null
+++ b/miranda-wine/protocols/Yahoo/libyahoo2/yahoo2_callbacks.h
@@ -0,0 +1,790 @@
+/*
+ * libyahoo2: yahoo2_callbacks.h
+ *
+ * Copyright (C) 2002-2004, Philip S Tellis <philip.tellis AT gmx.net>
+ *
+ * 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
+ *
+ */
+
+/*
+ * The functions in this file *must* be defined in your client program
+ * If you want to use a callback structure instead of direct functions,
+ * then you must define USE_STRUCT_CALLBACKS in all files that #include
+ * this one.
+ *
+ * Register the callback structure by calling yahoo_register_callbacks -
+ * declared in this file and defined in libyahoo2.c
+ */
+
+
+#ifndef YAHOO2_CALLBACKS_H
+#define YAHOO2_CALLBACKS_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "yahoo2_types.h"
+
+/*
+ * yahoo2_callbacks.h
+ *
+ * Callback interface for libyahoo2
+ */
+
+typedef enum {
+ YAHOO_INPUT_READ = 1 << 0,
+ YAHOO_INPUT_WRITE = 1 << 1,
+ YAHOO_INPUT_EXCEPTION = 1 << 2
+} yahoo_input_condition;
+
+/*
+ * A callback function called when an asynchronous connect completes.
+ *
+ * Params:
+ * fd - The file descriptor that has been connected, or -1 on error
+ * error - The value of errno set by the call to connect or 0 if no error
+ * Set both fd and error to 0 if the connect was cancelled by the
+ * user
+ * callback_data - the callback_data passed to the ext_yahoo_connect_async
+ * function
+ */
+typedef void (*yahoo_connect_callback)(int fd, int error, void *callback_data);
+
+
+/*
+ * The following functions need to be implemented in the client
+ * interface. They will be called by the library when each
+ * event occurs.
+ */
+
+/*
+ * should we use a callback structure or directly call functions
+ * if you want the structure, you *must* define USE_STRUCT_CALLBACKS
+ * both when you compile the library, and when you compile your code
+ * that uses the library
+ */
+
+#ifdef USE_STRUCT_CALLBACKS
+#define YAHOO_CALLBACK_TYPE(x) (*x)
+struct yahoo_callbacks {
+#else
+#define YAHOO_CALLBACK_TYPE(x) x
+#endif
+
+/*
+ * Name: ext_yahoo_login_response
+ * Called when the login process is complete
+ * Params:
+ * id - the id that identifies the server connection
+ * succ - enum yahoo_login_status
+ * url - url to reactivate account if locked
+ */
+void YAHOO_CALLBACK_TYPE(ext_yahoo_login_response)(int id, int succ, const char *url);
+
+
+/*
+ * Name: ext_yahoo_got_buddies
+ * Called when the contact list is got from the server
+ * Params:
+ * id - the id that identifies the server connection
+ * buds - the buddy list
+ */
+void YAHOO_CALLBACK_TYPE(ext_yahoo_got_buddies)(int id, YList * buds);
+
+
+/*
+ * Name: ext_yahoo_got_buddies
+ * Called when the contact list is got from the server
+ * Params:
+ * id - the id that identifies the server connection
+ * stealthlist - a string representing buddy ids to hide from
+ */
+void YAHOO_CALLBACK_TYPE(ext_yahoo_got_stealthlist)(int id, char *stealthlist);
+
+
+/*
+ * Name: ext_yahoo_got_avatar_share
+ * Called when the contact list is got from the server
+ * Params:
+ * id - the id that identifies the server connection
+ * buddyIcon - current setting of how we sharing avatars
+ */
+void YAHOO_CALLBACK_TYPE(ext_yahoo_got_avatar_share)(int id, int buddy_icon);
+
+
+/*
+ * Name: ext_yahoo_got_ignore
+ * Called when the ignore list is got from the server
+ * Params:
+ * id - the id that identifies the server connection
+ * igns - the ignore list
+ */
+void YAHOO_CALLBACK_TYPE(ext_yahoo_got_ignore)(int id, YList * igns);
+
+
+/*
+ * Name: ext_yahoo_got_identities
+ * Called when the contact list is got from the server
+ * Params:
+ * id - the id that identifies the server connection
+ * ids - the identity list
+ */
+void YAHOO_CALLBACK_TYPE(ext_yahoo_got_identities)(int id, YList * ids);
+
+
+/*
+ * Name: ext_yahoo_got_cookies
+ * Called when the cookie list is got from the server
+ * Params:
+ * id - the id that identifies the server connection
+ */
+void YAHOO_CALLBACK_TYPE(ext_yahoo_got_cookies)(int id);
+
+
+/*
+ * Name: ext_yahoo_got_ping
+ * Called when the ping packet is received from the server
+ * Params:
+ * id - the id that identifies the server connection
+ * errormsg - optional error message
+ */
+void YAHOO_CALLBACK_TYPE(ext_yahoo_got_ping)(int id, const char *errormsg);
+
+
+/*
+ * Name: ext_yahoo_status_logon
+ * Called when remote user's status changes to online.
+ * Params:
+ * id - the id that identifies the server connection
+ * who - the handle of the remote user
+ * stat - status code (enum yahoo_status)
+ * msg - the message if stat == YAHOO_STATUS_CUSTOM
+ * away - whether the contact is away or not (YAHOO_STATUS_CUSTOM)
+ * idle - this is the number of seconds he is idle [if he is idle]
+ * mobile - this is set for mobile users/buddies
+ * cksum - picture checksum [avatar support]
+ * buddy_icon - avatar type
+ * client_version - client version # (Yahoo sends some long numbers for different clients)
+ */
+void YAHOO_CALLBACK_TYPE(ext_yahoo_status_logon)(int id, const char *who, int stat, const char *msg, int away, int idle, int mobile, int cksum, int buddy_icon, long client_version);
+
+
+/*
+ * Name: ext_yahoo_status_changed
+ * Called when remote user's status changes.
+ * Params:
+ * id - the id that identifies the server connection
+ * who - the handle of the remote user
+ * stat - status code (enum yahoo_status)
+ * msg - the message if stat == YAHOO_STATUS_CUSTOM
+ * away - whether the contact is away or not (YAHOO_STATUS_CUSTOM)
+ * idle - this is the number of seconds he is idle [if he is idle]
+ * mobile - this is set for mobile users/buddies
+ * TODO: add support for pager, chat, and game states
+ */
+void YAHOO_CALLBACK_TYPE(ext_yahoo_status_changed)(int id, const char *who, int stat, const char *msg, int away, int idle, int mobile);
+
+
+/*
+ * Name: ext_yahoo_got_picture
+ * Called when we request picture URL.
+ * Params:
+ * id - the id that identifies the server connection
+ * me - the identity of mine being notified
+ * who - the handle of the remote user
+ * pic_url - URL to the buddy icon
+ * cksum - checksum
+ * type - type of packet (recv/send)
+ */
+void YAHOO_CALLBACK_TYPE(ext_yahoo_got_picture)(int id, const char *me, const char *who, const char *pic_url, int cksum, int type);
+
+
+/*
+ * Name: ext_yahoo_got_picture_checksum
+ * Called when our buddy changes his/hers buddy icon
+ * Params:
+ * id - the id that identifies the server connection
+ * me - the identity of mine being notified
+ * who - the handle of the remote user
+ * cksum - checksum
+ */
+void YAHOO_CALLBACK_TYPE(ext_yahoo_got_picture_checksum)(int id, const char *me, const char *who, int cksum);
+
+
+/*
+ * Name: ext_yahoo_got_picture_update
+ * Called when our buddy shares or stops sharing pictures with us.
+ * Params:
+ * id - the id that identifies the server connection
+ * me - the identity of mine being notified
+ * who - the handle of the remote user
+ * cksum - checksum
+ */
+void YAHOO_CALLBACK_TYPE(ext_yahoo_got_picture_update)(int id, const char *me, const char *who, int buddy_icon);
+
+
+/*
+ * Name: ext_yahoo_got_picture_upload
+ * Called when we just uploaded a picture to Yahoo File Servers
+ * Params:
+ * id - the id that identifies the server connection
+ * me - the identity of mine being notified
+ * who - the handle of the remote user
+ * cksum - checksum
+ */
+void YAHOO_CALLBACK_TYPE(ext_yahoo_got_picture_upload)(int id, const char *me, const char *url, unsigned int ts);
+
+
+/*
+ * Name: ext_yahoo_got_avatar_update (Apparently this is also a GLOBAL Notification.)
+ * GF Personal Notes: 2 Notifications?? 1 for Checksum, 1 for Global? To shut it off too?
+ * Called when our buddy shares or stops sharing pictures with us.
+ * Params:
+ * id - the id that identifies the server connection
+ * me - the identity of mine being notified
+ * who - the handle of the remote user
+ * cksum - checksum
+ */
+void YAHOO_CALLBACK_TYPE(ext_yahoo_got_avatar_update)(int id, const char *me, const char *who, int buddy_icon);
+
+
+/*
+ * Name: ext_yahoo_got_im
+ * Called when remote user sends you a message.
+ * Params:
+ * id - the id that identifies the server connection
+ * me - the identity the message was sent to
+ * who - the handle of the remote user
+ * msg - the message - NULL if stat == 2
+ * tm - timestamp of message if offline
+ * stat - message status - 0
+ * 1
+ * 2 == error sending message
+ * 5
+ * utf8 - whether the message is encoded as utf8 or not
+ * buddy_icon - whether the buddy has buddy_icon set or not.
+ */
+void YAHOO_CALLBACK_TYPE(ext_yahoo_got_im)(int id, const char *me, const char *who, const char *msg, long tm, int stat, int utf8, int buddy_icon);
+
+
+/*
+ * Name: ext_yahoo_got_audible
+ * Called when our buddy send an audible to us.
+ * Params:
+ * id - the id that identifies the server connection
+ * me - the identity of mine being notified
+ * who - the handle of the remote user
+ * aud - audible sent (filename?)
+ * msg - audible message
+ * aud_hash - md5 hash?
+ */
+void YAHOO_CALLBACK_TYPE(ext_yahoo_got_audible)(int id, const char *me, const char *who, const char *aud, const char *msg, const char *aud_hash);
+
+
+/*
+ * Name: ext_yahoo_got_calendar
+ * Called when our buddy send an audible to us.
+ * Params:
+ * id - the id that identifies the server connection
+ * url - the URL to the calendar reminder
+ * type - type of request?
+ * msg - string/description
+ * svc - service?
+ */
+void YAHOO_CALLBACK_TYPE(ext_yahoo_got_calendar)(int id, const char *url, int type, const char *msg, int svc);
+
+
+/*
+ * Name: ext_yahoo_got_conf_invite
+ * Called when remote user sends you a conference invitation.
+ * Params:
+ * id - the id that identifies the server connection
+ * me - the identity the invitation was sent to
+ * who - the user inviting you
+ * room - the room to join
+ * msg - the message
+ * members - the initial members of the conference (null terminated list)
+ */
+void YAHOO_CALLBACK_TYPE(ext_yahoo_got_conf_invite)(int id, const char *me, const char *who, const char *room, const char *msg, YList *members);
+
+
+/*
+ * Name: ext_yahoo_conf_userdecline
+ * Called when someone declines to join the conference.
+ * Params:
+ * id - the id that identifies the server connection
+ * me - the identity in the conference
+ * who - the user who has declined
+ * room - the room
+ * msg - the declining message
+ */
+void YAHOO_CALLBACK_TYPE(ext_yahoo_conf_userdecline)(int id, const char *me, const char *who, const char *room, const char *msg);
+
+
+/*
+ * Name: ext_yahoo_conf_userjoin
+ * Called when someone joins the conference.
+ * Params:
+ * id - the id that identifies the server connection
+ * me - the identity in the conference
+ * who - the user who has joined
+ * room - the room joined
+ */
+void YAHOO_CALLBACK_TYPE(ext_yahoo_conf_userjoin)(int id, const char *me, const char *who, const char *room);
+
+
+/*
+ * Name: ext_yahoo_conf_userleave
+ * Called when someone leaves the conference.
+ * Params:
+ * id - the id that identifies the server connection
+ * me - the identity in the conference
+ * who - the user who has left
+ * room - the room left
+ */
+void YAHOO_CALLBACK_TYPE(ext_yahoo_conf_userleave)(int id, const char *me, const char *who, const char *room);
+
+
+/*
+ * Name: ext_yahoo_chat_cat_xml
+ * Called when ?
+ * Params:
+ * id - the id that identifies the server connection
+ * xml - ?
+ */
+void YAHOO_CALLBACK_TYPE(ext_yahoo_chat_cat_xml)(int id, const char *xml);
+
+
+/*
+ * Name: ext_yahoo_chat_join
+ * Called when joining the chatroom.
+ * Params:
+ * id - the id that identifies the server connection
+ * me - the identity in the chatroom
+ * room - the room joined, used in all other chat calls, freed by
+ * library after call
+ * topic - the topic of the room, freed by library after call
+ * members - the initial members of the chatroom (null terminated YList
+ * of yahoo_chat_member's) Must be freed by the client
+ * fd - the socket where the connection is coming from (for tracking)
+ */
+void YAHOO_CALLBACK_TYPE(ext_yahoo_chat_join)(int id, const char *me, const char *room, const char *topic, YList *members, int fd);
+
+
+/*
+ * Name: ext_yahoo_chat_userjoin
+ * Called when someone joins the chatroom.
+ * Params:
+ * id - the id that identifies the server connection
+ * me - the identity in the chatroom
+ * room - the room joined
+ * who - the user who has joined, Must be freed by the client
+ */
+void YAHOO_CALLBACK_TYPE(ext_yahoo_chat_userjoin)(int id, const char *me, const char *room, struct yahoo_chat_member *who);
+
+
+/*
+ * Name: ext_yahoo_chat_userleave
+ * Called when someone leaves the chatroom.
+ * Params:
+ * id - the id that identifies the server connection
+ * me - the identity in the chatroom
+ * room - the room left
+ * who - the user who has left (Just the User ID)
+ */
+void YAHOO_CALLBACK_TYPE(ext_yahoo_chat_userleave)(int id, const char *me, const char *room, const char *who);
+
+
+/*
+ * Name: ext_yahoo_chat_message
+ * Called when someone messages in the chatroom.
+ * Params:
+ * id - the id that identifies the server connection
+ * me - the identity in the chatroom
+ * room - the room
+ * who - the user who messaged (Just the user id)
+ * msg - the message
+ * msgtype - 1 = Normal message
+ * 2 = /me type message
+ * utf8 - whether the message is utf8 encoded or not
+ */
+void YAHOO_CALLBACK_TYPE(ext_yahoo_chat_message)(int id, const char *me, const char *who, const char *room, const char *msg, int msgtype, int utf8);
+
+
+/*
+ *
+ * Name: ext_yahoo_chat_yahoologout
+ * called when yahoo disconnects your chat session
+ * Note this is called whenver a disconnect happens, client or server
+ * requested. Care should be taken to make sure you know the origin
+ * of the disconnect request before doing anything here (auto-join's etc)
+ * Params:
+ * id - the id that identifies this connection
+ * me - the identity in the chatroom
+ * Returns:
+ * nothing.
+ */
+void YAHOO_CALLBACK_TYPE(ext_yahoo_chat_yahoologout)(int id, const char *me);
+
+
+/*
+ *
+ * Name: ext_yahoo_chat_yahooerror
+ * called when yahoo sends back an error to you
+ * Note this is called whenver chat message is sent into a room
+ * in error (fd not connected, room doesn't exists etc)
+ * Care should be taken to make sure you know the origin
+ * of the error before doing anything about it.
+ * Params:
+ * id - the id that identifies this connection
+ * me - the identity in the chatroom
+ * Returns:
+ * nothing.
+ */
+void YAHOO_CALLBACK_TYPE(ext_yahoo_chat_yahooerror)(int id, const char *me);
+
+
+/*
+ * Name: ext_yahoo_conf_message
+ * Called when someone messages in the conference.
+ * Params:
+ * id - the id that identifies the server connection
+ * me - the identity the conf message was sent to
+ * who - the user who messaged
+ * room - the room
+ * msg - the message
+ * utf8 - whether the message is utf8 encoded or not
+ */
+void YAHOO_CALLBACK_TYPE(ext_yahoo_conf_message)(int id, const char *me, const char *who, const char *room, const char *msg, int utf8);
+
+
+/*
+ * Name: ext_yahoo_got_file
+ * Called when someone sends you a file
+ * Params:
+ * id - the id that identifies the server connection
+ * me - the identity the file was sent to
+ * who - the user who sent the file
+ * url - the file url
+ * expires - the expiry date of the file on the server (timestamp)
+ * msg - the message
+ * fname- the file name if direct transfer
+ * fsize- the file size if direct transfer
+ * ftoken - file token
+ * y7 - flag signalling y7 transfer
+ */
+void YAHOO_CALLBACK_TYPE(ext_yahoo_got_file)(int id, const char *me, const char *who, const char *url, long expires, const char *msg, const char *fname, unsigned long fesize, const char *ft_token, int y7);
+
+
+/*
+ * Name: ext_yahoo_contact_added
+ * Called when a contact adds you to their list
+ * Params:
+ * id - the id that identifies the server connection
+ * myid - the identity he was added to
+ * who - who was added
+ * msg - any message sent
+ */
+void YAHOO_CALLBACK_TYPE(ext_yahoo_contact_added)(int id, char *myid, char *who, char *fname, char *lname, char *msg);
+
+
+/*
+ * Name: ext_yahoo_buddy_group_changed
+ * Called when a buddy is moved from one group into another
+ * Params:
+ * id - the id that identifies the server connection
+ * myid - the identity he was added to
+ * who - who was added
+ * from_group
+ * to_group
+ */
+void YAHOO_CALLBACK_TYPE(ext_yahoo_buddy_group_changed)(int id, char *myid, char *who, char *old_group, char *new_group);
+
+
+/*
+ * Name: ext_yahoo_buddy_added
+ * Called when a contact is added to our server list
+ * Params:
+ * id - the id that identifies the server connection
+ * myid - the identity he was added to
+ * who - who was added
+ * group - group buddy was added to
+ * status - status of the operation
+ */
+void YAHOO_CALLBACK_TYPE(ext_yahoo_buddy_added)(int id, char *myid, char *who, char *group, int status, int auth);
+
+
+/*
+ * Name: ext_yahoo_rejected
+ * Called when a contact rejects your add
+ * Params:
+ * id - the id that identifies the server connection
+ * who - who rejected you
+ * msg - any message sent
+ */
+void YAHOO_CALLBACK_TYPE(ext_yahoo_rejected)(int id, const char *who, const char *msg);
+
+
+/*
+ * Name: ext_yahoo_typing_notify
+ * Called when remote user starts or stops typing.
+ * Params:
+ * id - the id that identifies the server connection
+ * me - the handle of the identity the notification is sent to
+ * who - the handle of the remote user
+ * stat - 1 if typing, 0 if stopped typing
+ */
+void YAHOO_CALLBACK_TYPE(ext_yahoo_typing_notify)(int id, const char *me, const char *who, int stat);
+
+
+/*
+ * Name: ext_yahoo_game_notify
+ * Called when remote user starts or stops a game.
+ * Params:
+ * id - the id that identifies the server connection
+ * me - the handle of the identity the notification is sent to
+ * who - the handle of the remote user
+ * stat - 1 if game, 0 if stopped gaming
+ */
+void YAHOO_CALLBACK_TYPE(ext_yahoo_game_notify)(int id, const char *me, const char *who, int stat, const char *msg);
+
+
+/*
+ * Name: ext_yahoo_mail_notify
+ * Called when you receive mail, or with number of messages
+ * Params:
+ * id - the id that identifies the server connection
+ * from - who the mail is from - NULL if only mail count
+ * subj - the subject of the mail - NULL if only mail count
+ * cnt - mail count - 0 if new mail notification
+ */
+void YAHOO_CALLBACK_TYPE(ext_yahoo_mail_notify)(int id, const char *from, const char *subj, int cnt);
+
+
+/*
+ * Name: ext_yahoo_system_message
+ * System message
+ * Params:
+ * id - the id that identifies the server connection
+ * msg - the message
+ */
+void YAHOO_CALLBACK_TYPE(ext_yahoo_system_message)(int id, const char *me, const char *who, const char *msg);
+
+
+/*
+ * Name: ext_yahoo_got_webcam_image
+ * Called when you get a webcam update
+ * An update can either be receiving an image, a part of an image or
+ * just an update with a timestamp
+ * Params:
+ * id - the id that identifies the server connection
+ * who - the user who's webcam we're viewing
+ * image - image data
+ * image_size - length of the image in bytes
+ * real_size - actual length of image data
+ * timestamp - milliseconds since the webcam started
+ *
+ * If the real_size is smaller then the image_size then only part of
+ * the image has been read. This function will keep being called till
+ * the total amount of bytes in image_size has been read. The image
+ * received is in JPEG-2000 Code Stream Syntax (ISO/IEC 15444-1).
+ * The size of the image will be either 160x120 or 320x240.
+ * Each webcam image contains a timestamp. This timestamp should be
+ * used to keep the image in sync since some images can take longer
+ * to transport then others. When image_size is 0 we can still receive
+ * a timestamp to stay in sync
+ */
+void YAHOO_CALLBACK_TYPE(ext_yahoo_got_webcam_image)(int id, const char * who,
+ const unsigned char *image, unsigned int image_size, unsigned int real_size,
+ unsigned int timestamp);
+
+
+/*
+ * Name: ext_yahoo_webcam_invite
+ * Called when you get a webcam invitation
+ * Params:
+ * id - the id that identifies the server connection
+ * me - identity the invitation is to
+ * from - who the invitation is from
+ */
+void YAHOO_CALLBACK_TYPE(ext_yahoo_webcam_invite)(int id, const char *me, const char *from);
+
+
+/*
+ * Name: ext_yahoo_webcam_invite_reply
+ * Called when you get a response to a webcam invitation
+ * Params:
+ * id - the id that identifies the server connection
+ * me - identity the invitation response is to
+ * from - who the invitation response is from
+ * accept - 0 (decline), 1 (accept)
+ */
+void YAHOO_CALLBACK_TYPE(ext_yahoo_webcam_invite_reply)(int id, const char *me, const char *from, int accept);
+
+
+/*
+ * Name: ext_yahoo_webcam_closed
+ * Called when the webcam connection closed
+ * Params:
+ * id - the id that identifies the server connection
+ * who - the user who we where connected to
+ * reason - reason why the connection closed
+ * 1 = user stopped broadcasting
+ * 2 = user cancelled viewing permission
+ * 3 = user declines permission
+ * 4 = user does not have webcam online
+ */
+void YAHOO_CALLBACK_TYPE(ext_yahoo_webcam_closed)(int id, const char *who, int reason);
+
+
+/*
+ * Name: ext_yahoo_got_search_result
+ * Called when the search result received from server
+ * Params:
+ * id - the id that identifies the server connection
+ * found - total number of results returned in the current result set
+ * start - offset from where the current result set starts
+ * total - total number of results available (start + found <= total)
+ * contacts - the list of results as a YList of yahoo_found_contact
+ * these will be freed after this function returns, so
+ * if you need to use the information, make a copy
+ */
+void YAHOO_CALLBACK_TYPE(ext_yahoo_got_search_result)(int id, int found, int start, int total, YList *contacts);
+
+
+/*
+ * Name: ext_yahoo_error
+ * Called on error.
+ * Params:
+ * id - the id that identifies the server connection
+ * err - the error message
+ * fatal- whether this error is fatal to the connection or not
+ * num - Which error is this
+ */
+void YAHOO_CALLBACK_TYPE(ext_yahoo_error)(int id, const char *err, int fatal, int num);
+
+
+/*
+ * Name: ext_yahoo_webcam_viewer
+ * Called when a viewer disconnects/connects/requests to connect
+ * Params:
+ * id - the id that identifies the server connection
+ * who - the viewer
+ * connect - 0=disconnect 1=connect 2=request
+ */
+void YAHOO_CALLBACK_TYPE(ext_yahoo_webcam_viewer)(int id, const char *who, int connect);
+
+
+/*
+ * Name: ext_yahoo_webcam_data_request
+ * Called when you get a request for webcam images
+ * Params:
+ * id - the id that identifies the server connection
+ * send - whether to send images or not
+ */
+void YAHOO_CALLBACK_TYPE(ext_yahoo_webcam_data_request)(int id, int send);
+
+
+/*
+ * Name: ext_yahoo_log
+ * Called to log a message.
+ * Params:
+ * fmt - the printf formatted message
+ * Returns:
+ * 0
+ */
+int YAHOO_CALLBACK_TYPE(ext_yahoo_log)(const char *fmt, ...);
+
+
+/*
+ * Name: ext_yahoo_add_handler
+ * Add a listener for the fd. Must call yahoo_read_ready
+ * when a YAHOO_INPUT_READ fd is ready and yahoo_write_ready
+ * when a YAHOO_INPUT_WRITE fd is ready.
+ * Params:
+ * id - the id that identifies the server connection
+ * fd - the fd on which to listen
+ * cond - the condition on which to call the callback
+ * data - callback data to pass to yahoo_*_ready
+ *
+ * Returns: a tag to be used when removing the handler
+ */
+int YAHOO_CALLBACK_TYPE(ext_yahoo_add_handler)(int id, int fd, yahoo_input_condition cond, void *data);
+
+
+/*
+ * Name: ext_yahoo_remove_handler
+ * Remove the listener for the fd.
+ * Params:
+ * id - the id that identifies the connection
+ * tag - the handler tag to remove
+ */
+void YAHOO_CALLBACK_TYPE(ext_yahoo_remove_handler)(int id, int tag);
+
+
+/*
+ * Name: ext_yahoo_connect
+ * Connect to a host:port
+ * Params:
+ * host - the host to connect to
+ * port - the port to connect on
+ * Returns:
+ * a unix file descriptor to the socket
+ */
+int YAHOO_CALLBACK_TYPE(ext_yahoo_connect)(const char *host, int port, int type);
+
+
+/*
+ * Name: ext_yahoo_connect_async
+ * Connect to a host:port asynchronously. This function should return
+ * immediately returing a tag used to identify the connection handler,
+ * or a pre-connect error (eg: host name lookup failure).
+ * Once the connect completes (successfully or unsuccessfully), callback
+ * should be called (see the signature for yahoo_connect_callback).
+ * The callback may safely be called before this function returns, but
+ * it should not be called twice.
+ * Params:
+ * id - the id that identifies this connection
+ * host - the host to connect to
+ * port - the port to connect on
+ * callback - function to call when connect completes
+ * callback_data - data to pass to the callback function
+ * Returns:
+ * a unix file descriptor to the socket
+ */
+int YAHOO_CALLBACK_TYPE(ext_yahoo_connect_async)(int id, const char *host, int port, int type,
+ yahoo_connect_callback callback, void *callback_data);
+
+#ifdef USE_STRUCT_CALLBACKS
+};
+
+/*
+ * if using a callback structure, call yahoo_register_callbacks
+ * before doing anything else
+ */
+void yahoo_register_callbacks(struct yahoo_callbacks * tyc);
+
+#undef YAHOO_CALLBACK_TYPE
+
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
diff --git a/miranda-wine/protocols/Yahoo/libyahoo2/yahoo2_types.h b/miranda-wine/protocols/Yahoo/libyahoo2/yahoo2_types.h
new file mode 100644
index 0000000..d0d4dfd
--- /dev/null
+++ b/miranda-wine/protocols/Yahoo/libyahoo2/yahoo2_types.h
@@ -0,0 +1,261 @@
+/*
+ * libyahoo2: yahoo2_types.h
+ *
+ * Copyright (C) 2002-2004, Philip S Tellis <philip.tellis AT gmx.net>
+ *
+ * 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 YAHOO2_TYPES_H
+#define YAHOO2_TYPES_H
+
+#include "yahoo_list.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+enum yahoo_status {
+ YAHOO_STATUS_DISCONNECTED = -1,
+ YAHOO_STATUS_AVAILABLE = 0,
+ YAHOO_STATUS_BRB,
+ YAHOO_STATUS_BUSY,
+ YAHOO_STATUS_NOTATHOME,
+ YAHOO_STATUS_NOTATDESK,
+ YAHOO_STATUS_NOTINOFFICE,
+ YAHOO_STATUS_ONPHONE,
+ YAHOO_STATUS_ONVACATION,
+ YAHOO_STATUS_OUTTOLUNCH,
+ YAHOO_STATUS_STEPPEDOUT,
+ YAHOO_STATUS_INVISIBLE = 12,
+ YAHOO_STATUS_CUSTOM = 99,
+ YAHOO_STATUS_IDLE = 999,
+ YAHOO_STATUS_WEBLOGIN = 0x5a55aa55,
+ YAHOO_STATUS_OFFLINE = 0x5a55aa56, /* don't ask */
+ YAHOO_STATUS_NOTIFY = 0x16 /* TYPING */
+};
+#define YAHOO_STATUS_GAME 0x2 /* Games don't fit into the regular status model */
+
+enum yahoo_login_status {
+ YAHOO_LOGIN_OK = 0,
+ YAHOO_LOGIN_LOGOFF = 2,
+ YAHOO_LOGIN_UNAME = 3,
+ YAHOO_LOGIN_PASSWD = 13,
+ YAHOO_LOGIN_LOCK = 14,
+ YAHOO_LOGIN_DUPL = 99,
+ YAHOO_LOGIN_SOCK = -1
+};
+
+enum yahoo_error {
+ E_UNKNOWN = -1,
+ E_CONNECTION = -2,
+ E_SYSTEM = -3,
+ E_CUSTOM = 0,
+
+ /* responses from ignore buddy */
+ E_IGNOREDUP = 2,
+ E_IGNORENONE = 3,
+ E_IGNORECONF = 12,
+
+ /* conference */
+ E_CONFNOTAVAIL = 20
+};
+
+enum yahoo_log_level {
+ YAHOO_LOG_NONE = 0,
+ YAHOO_LOG_FATAL,
+ YAHOO_LOG_ERR,
+ YAHOO_LOG_WARNING,
+ YAHOO_LOG_NOTICE,
+ YAHOO_LOG_INFO,
+ YAHOO_LOG_DEBUG
+};
+
+/* Yahoo Protocol versions. Thanks to GAIM devs.*/
+//#define YAHOO_WEBMESSENGER_PROTO_VER 0x0065
+#define YAHOO_WEBMESSENGER_PROTO_VER 0x000D
+//#define YAHOO_PROTO_VER 0x000c
+#define YAHOO_PROTO_VER 0x000d
+
+/* Yahoo style/color directives */
+#define YAHOO_COLOR_BLACK "\033[30m"
+#define YAHOO_COLOR_BLUE "\033[31m"
+#define YAHOO_COLOR_LIGHTBLUE "\033[32m"
+#define YAHOO_COLOR_GRAY "\033[33m"
+#define YAHOO_COLOR_GREEN "\033[34m"
+#define YAHOO_COLOR_PINK "\033[35m"
+#define YAHOO_COLOR_PURPLE "\033[36m"
+#define YAHOO_COLOR_ORANGE "\033[37m"
+#define YAHOO_COLOR_RED "\033[38m"
+#define YAHOO_COLOR_OLIVE "\033[39m"
+#define YAHOO_COLOR_ANY "\033[#"
+#define YAHOO_STYLE_ITALICON "\033[2m"
+#define YAHOO_STYLE_ITALICOFF "\033[x2m"
+#define YAHOO_STYLE_BOLDON "\033[1m"
+#define YAHOO_STYLE_BOLDOFF "\033[x1m"
+#define YAHOO_STYLE_UNDERLINEON "\033[4m"
+#define YAHOO_STYLE_UNDERLINEOFF "\033[x4m"
+#define YAHOO_STYLE_URLON "\033[lm"
+#define YAHOO_STYLE_URLOFF "\033[xlm"
+
+enum yahoo_connection_type {
+ YAHOO_CONNECTION_PAGER=0,
+ YAHOO_CONNECTION_FT,
+ YAHOO_CONNECTION_YAB,
+ YAHOO_CONNECTION_WEBCAM_MASTER,
+ YAHOO_CONNECTION_WEBCAM,
+ YAHOO_CONNECTION_CHATCAT,
+ YAHOO_CONNECTION_SEARCH
+};
+
+enum yahoo_webcam_direction_type {
+ YAHOO_WEBCAM_DOWNLOAD=0,
+ YAHOO_WEBCAM_UPLOAD
+};
+
+enum yahoo_stealth_visibility_type {
+ YAHOO_STEALTH_DEFAULT = 0,
+ YAHOO_STEALTH_ONLINE,
+ YAHOO_STEALTH_PERM_OFFLINE
+};
+
+/* chat member attribs */
+#define YAHOO_CHAT_MALE 0x8000
+#define YAHOO_CHAT_FEMALE 0x10000
+#define YAHOO_CHAT_FEMALE 0x10000
+#define YAHOO_CHAT_DUNNO 0x400
+#define YAHOO_CHAT_WEBCAM 0x10
+
+enum yahoo_webcam_conn_type { Y_WCM_DIALUP, Y_WCM_DSL, Y_WCM_T1 };
+
+struct yahoo_webcam {
+ int direction; /* Uploading or downloading */
+ int conn_type; /* 0=Dialup, 1=DSL/Cable, 2=T1/Lan */
+
+ char *user; /* user we are viewing */
+ char *server; /* webcam server to connect to */
+ int port; /* webcam port to connect on */
+ char *key; /* key to connect to the server with */
+ char *description; /* webcam description */
+ char *my_ip; /* own ip number */
+};
+
+struct yahoo_webcam_data {
+ unsigned int data_size;
+ unsigned int to_read;
+ unsigned int timestamp;
+ unsigned char packet_type;
+};
+
+struct yahoo_data {
+ char *user;
+ char *password;
+
+ char *cookie_y;
+ char *cookie_t;
+ char *cookie_c;
+ char *cookie_b;
+ char *login_cookie;
+
+ YList *buddies;
+ YList *ignore;
+ YList *identities;
+ char *login_id;
+
+ int current_status;
+ int initial_status;
+ int logged_in;
+
+ int session_id;
+
+ int client_id;
+ long session_timestamp;
+
+ char *rawbuddylist;
+ char *rawstealthlist;
+ char *ignorelist;
+
+ void *server_settings;
+};
+
+struct yab {
+ char *id;
+ char *fname;
+ char *lname;
+ char *nname;
+ char *email;
+ char *hphone;
+ char *wphone;
+ char *mphone;
+ int dbid;
+};
+
+struct yahoo_buddy {
+ char *group;
+ char *id;
+ char *real_name;
+ struct yab *yab_entry;
+};
+
+enum yahoo_search_type {
+ YAHOO_SEARCH_KEYWORD = 0,
+ YAHOO_SEARCH_YID,
+ YAHOO_SEARCH_NAME
+};
+
+enum yahoo_search_gender {
+ YAHOO_GENDER_NONE = 0,
+ YAHOO_GENDER_MALE,
+ YAHOO_GENDER_FEMALE
+};
+
+enum yahoo_search_agerange {
+ YAHOO_AGERANGE_NONE = 0
+};
+
+struct yahoo_found_contact {
+ char *id;
+ char *gender;
+ char *location;
+ int age;
+ int online;
+};
+
+/*
+ * Function pointer to be passed to http get/post and send file
+ */
+typedef void (*yahoo_get_fd_callback)(int id, int fd, int error, void *data);
+
+/*
+ * Function pointer to be passed to yahoo_get_url_handle
+ */
+typedef void (*yahoo_get_url_handle_callback)(int id, int fd, int error,
+ const char *filename, unsigned long size, void *data);
+
+
+struct yahoo_chat_member {
+ char *id;
+ int age;
+ int attribs;
+ char *alias;
+ char *location;
+};
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/miranda-wine/protocols/Yahoo/libyahoo2/yahoo_debug.h b/miranda-wine/protocols/Yahoo/libyahoo2/yahoo_debug.h
new file mode 100644
index 0000000..7c80725
--- /dev/null
+++ b/miranda-wine/protocols/Yahoo/libyahoo2/yahoo_debug.h
@@ -0,0 +1,55 @@
+/*
+ * libyahoo2: yahoo_debug.h
+ *
+ * Copyright (C) 2002-2004, Philip S Tellis <philip.tellis AT gmx.net>
+ *
+ * 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
+ *
+ */
+
+extern int yahoo_log_message(char *fmt, ...);
+
+/*
+#define NOTICE(x) if(yahoo_get_log_level() >= YAHOO_LOG_NOTICE) { yahoo_log_message x; yahoo_log_message("\n"); }
+
+#define LOG(x) if(yahoo_get_log_level() >= YAHOO_LOG_INFO) { yahoo_log_message("%s:%d: ", __FILE__, __LINE__); \
+ yahoo_log_message x; \
+ yahoo_log_message("\n"); }
+
+#define WARNING(x) if(yahoo_get_log_level() >= YAHOO_LOG_WARNING) { yahoo_log_message("%s:%d: warning: ", __FILE__, __LINE__); \
+ yahoo_log_message x; \
+ yahoo_log_message("\n"); }
+
+#define DEBUG_MSG(x) if(yahoo_get_log_level() >= YAHOO_LOG_DEBUG) { yahoo_log_message("%s:%d: debug: ", __FILE__, __LINE__); \
+ yahoo_log_message x; \
+ yahoo_log_message("\n"); }
+*/
+#define NOTICE(x) if(yahoo_get_log_level() >= YAHOO_LOG_NOTICE) { yahoo_log_message x; yahoo_log_message(" "); }
+
+#define LOG(x) if(yahoo_get_log_level() >= YAHOO_LOG_INFO) { yahoo_log_message("%s:%d: ", __FILE__, __LINE__); \
+ yahoo_log_message x; \
+ yahoo_log_message(" "); }
+
+#define WARNING(x) if(yahoo_get_log_level() >= YAHOO_LOG_WARNING) { yahoo_log_message("%s:%d: warning: ", __FILE__, __LINE__); \
+ yahoo_log_message x; \
+ yahoo_log_message(" "); }
+
+#define DEBUG_MSG(x) if(yahoo_get_log_level() >= YAHOO_LOG_DEBUG) { yahoo_log_message("%s:%d: debug: ", __FILE__, __LINE__); \
+ yahoo_log_message x; \
+ yahoo_log_message(" "); }
+
+#define DEBUG_MSG1(x) if(yahoo_get_log_level() >= YAHOO_LOG_DEBUG) { \
+ yahoo_log_message x; \
+ yahoo_log_message(" "); }
diff --git a/miranda-wine/protocols/Yahoo/libyahoo2/yahoo_fn.c b/miranda-wine/protocols/Yahoo/libyahoo2/yahoo_fn.c
new file mode 100644
index 0000000..f2db834
--- /dev/null
+++ b/miranda-wine/protocols/Yahoo/libyahoo2/yahoo_fn.c
@@ -0,0 +1,4622 @@
+/*
+ * libyahoo2 - originally from gaim patches by Amatus
+ *
+ * Copyright (C) 2003-2004
+ *
+ * Some code copyright (C) 1998-1999, Mark Spencer <markster@marko.net>
+ * libfaim code copyright 1998, 1999 Adam Fritzler <afritz@auk.cx>
+ *
+ * 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 "yahoo_fn.h"
+
+unsigned char table_0[256] = {
+ 0x5A, 0x41, 0x11, 0x77, 0x29, 0x9C, 0x31, 0xAD,
+ 0x4A, 0x32, 0x1A, 0x6D, 0x56, 0x9F, 0x39, 0xA6,
+ 0x0C, 0xE8, 0x49, 0x40, 0xA4, 0x21, 0xE9, 0x01,
+ 0x91, 0x86, 0x2F, 0xB9, 0xED, 0x80, 0x51, 0xAB,
+ 0x7F, 0x92, 0xF2, 0x73, 0xCD, 0xD9, 0x75, 0x2A,
+ 0x70, 0x34, 0x35, 0x8D, 0xA8, 0x72, 0x7D, 0x9B,
+ 0x2E, 0xC5, 0x2D, 0x76, 0x1E, 0xBB, 0xE7, 0x37,
+ 0xBA, 0xB7, 0xB2, 0x03, 0x20, 0x17, 0x8A, 0x07,
+ 0xD6, 0x96, 0x13, 0x95, 0xE5, 0xF1, 0x18, 0x3B,
+ 0xA5, 0x62, 0x33, 0xC1, 0x44, 0x3D, 0x6C, 0xA7,
+ 0xBF, 0x1C, 0x60, 0xFF, 0x5B, 0xF5, 0x8E, 0xE6,
+ 0x5C, 0xCC, 0xF7, 0x69, 0x15, 0x0F, 0x0B, 0xBD,
+ 0x12, 0x9D, 0xB3, 0x65, 0x53, 0xB1, 0x14, 0xF4,
+ 0x19, 0x3E, 0xB6, 0x45, 0xCB, 0xA2, 0x7A, 0xD3,
+ 0xF8, 0xD1, 0x61, 0xEE, 0xBC, 0xC6, 0xB0, 0x5D,
+ 0x4B, 0x09, 0x26, 0xE1, 0x1D, 0x6E, 0xC3, 0xFB,
+ 0x68, 0x4C, 0x42, 0x52, 0x5F, 0xDE, 0xFD, 0xEF,
+ 0x81, 0x04, 0x6F, 0xE0, 0xF0, 0x1F, 0x0D, 0x7C,
+ 0x58, 0x4F, 0x1B, 0x30, 0xCF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74, 0x08, 0x1D, 0xC4, 0xF9, 0x4D,
+ 0xEA, 0x8D, 0x2D, 0x5F, 0xF6, 0xA7, 0x80, 0x3A };
+
+unsigned char table_25[32] = {
+ 0x0A, 0x11, 0x17, 0x03, 0x05, 0x0B, 0x18, 0x13,
+ 0x09, 0x02, 0x00, 0x1C, 0x0C, 0x08, 0x1B, 0x14,
+ 0x06, 0x0E, 0x01, 0x0D, 0x16, 0x1E, 0x1D, 0x19,
+ 0x0F, 0x1A, 0x10, 0x04, 0x12, 0x15, 0x07, 0x1F };
+
+unsigned char table_26[32] = {
+ 0x19, 0x13, 0x1B, 0x01, 0x1C, 0x0D, 0x0C, 0x15,
+ 0x0B, 0x00, 0x1A, 0x0F, 0x12, 0x16, 0x08, 0x0A,
+ 0x03, 0x06, 0x14, 0x10, 0x18, 0x04, 0x11, 0x1D,
+ 0x1F, 0x07, 0x17, 0x05, 0x02, 0x0E, 0x1E, 0x09 };
+
+unsigned char table_27[256] = {
+ 0x72, 0xF0, 0x14, 0xCB, 0x61, 0xA5, 0xB2, 0x02,
+ 0x75, 0x22, 0xC3, 0x9D, 0x5A, 0x63, 0xFA, 0x5F,
+ 0xD9, 0x55, 0x58, 0x43, 0x24, 0x7D, 0x77, 0x93,
+ 0xBA, 0x50, 0x1D, 0xF7, 0x49, 0x18, 0xB0, 0x42,
+ 0xBB, 0xEC, 0x52, 0x38, 0xDC, 0xC8, 0x16, 0x54,
+ 0x17, 0x19, 0x89, 0x67, 0x33, 0x3C, 0x0A, 0xAD,
+ 0xC9, 0xDE, 0x81, 0xED, 0xBD, 0x0E, 0x0B, 0x6D,
+ 0x46, 0x30, 0x35, 0x2B, 0x8C, 0xA0, 0x1C, 0x0D,
+ 0xFD, 0xA1, 0x70, 0xC6, 0xD8, 0x41, 0xB3, 0xC0,
+ 0x44, 0xEB, 0x92, 0xBE, 0x6B, 0x98, 0x1A, 0x76,
+ 0x71, 0xC5, 0x51, 0x56, 0x80, 0xFC, 0x01, 0x53,
+ 0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39[32] = {
+ 0x12, 0x18, 0x0E, 0x08, 0x16, 0x05, 0x06, 0x00,
+ 0x11, 0x17, 0x15, 0x1B, 0x14, 0x01, 0x1F, 0x19,
+ 0x04, 0x0D, 0x0A, 0x0F, 0x10, 0x07, 0x1D, 0x03,
+ 0x0B, 0x13, 0x0C, 0x09, 0x1E, 0x02, 0x1A, 0x1C };
+
+unsigned char table_40[32] = {
+ 0x16, 0x02, 0x06, 0x0E, 0x0D, 0x1C, 0x08, 0x0A,
+ 0x0F, 0x13, 0x0B, 0x18, 0x07, 0x04, 0x14, 0x01,
+ 0x1B, 0x05, 0x17, 0x1E, 0x11, 0x1A, 0x10, 0x1F,
+ 0x12, 0x19, 0x1D, 0x03, 0x0C, 0x00, 0x09, 0x15 };
+
+unsigned char table_41[32] = {
+ 0x13, 0x18, 0x04, 0x1F, 0x1D, 0x11, 0x03, 0x00,
+ 0x10, 0x12, 0x06, 0x0A, 0x1C, 0x07, 0x15, 0x0E,
+ 0x08, 0x05, 0x0C, 0x09, 0x01, 0x02, 0x16, 0x0B,
+ 0x1A, 0x17, 0x14, 0x1E, 0x0D, 0x0F, 0x19, 0x1B };
+
+unsigned char table_42[32] = {
+ 0x00, 0x08, 0x15, 0x1D, 0x05, 0x18, 0x06, 0x07,
+ 0x1F, 0x01, 0x0B, 0x03, 0x19, 0x13, 0x02, 0x1C,
+ 0x17, 0x11, 0x0E, 0x1E, 0x0C, 0x0F, 0x09, 0x1A,
+ 0x1B, 0x16, 0x10, 0x0D, 0x0A, 0x14, 0x12, 0x04 };
+
+unsigned char table_43[256] = {
+ 0x34, 0xB7, 0x36, 0x85, 0x5F, 0x93, 0x98, 0x70,
+ 0x1E, 0x59, 0x83, 0x60, 0x6F, 0xBF, 0xF9, 0xD0,
+ 0xB3, 0x22, 0x12, 0x38, 0xF5, 0x01, 0xC9, 0x5B,
+ 0xEF, 0x1D, 0x81, 0x64, 0xFA, 0x8F, 0x7F, 0xBC,
+ 0x05, 0x08, 0xE0, 0x8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A, 0x18, 0x31, 0x46, 0x20, 0xBE, 0x1F, 0x3C,
+ 0x6D, 0xAA, 0xF6, 0xDD, 0xF4, 0x96, 0x03, 0x0A,
+ 0x9E, 0x83, 0xA1, 0x9D, 0xD5, 0xB0, 0x17, 0xBF,
+ 0x56, 0xAB, 0xAE, 0x1B, 0x52, 0xC6, 0x81, 0x4B,
+ 0xDC, 0x90, 0x5A, 0x9B, 0xB6, 0x0F, 0xF3, 0x67,
+ 0x30, 0x63, 0x7C, 0x40, 0x0E, 0x7F, 0x95, 0x36,
+ 0xC4, 0x4E, 0x43, 0xCB, 0x15, 0xB8, 0x00, 0x91,
+ 0x8A, 0x4C, 0x8E, 0x14, 0x06, 0x6E, 0xA9, 0x2E,
+ 0x3F, 0x48, 0x2F, 0x0C, 0xB5, 0x21, 0xBB, 0xDA,
+ 0x8B, 0x42, 0x29, 0x8C, 0x33, 0x59, 0xE8, 0xF8,
+ 0xC7, 0xE4, 0x37, 0xE5, 0xFC, 0xBD, 0x99, 0x41 };
+
+unsigned char table_47[32] = {
+ 0x18, 0x1D, 0x16, 0x10, 0x11, 0x04, 0x1E, 0x08,
+ 0x19, 0x0E, 0x0F, 0x02, 0x14, 0x1C, 0x07, 0x17,
+ 0x0D, 0x09, 0x12, 0x1A, 0x05, 0x01, 0x0B, 0x0A,
+ 0x13, 0x15, 0x0C, 0x00, 0x06, 0x1F, 0x03, 0x1B };
+
+unsigned char table_48[32] = {
+ 0x13, 0x08, 0x15, 0x01, 0x17, 0x10, 0x0F, 0x1F,
+ 0x1D, 0x0D, 0x12, 0x03, 0x06, 0x0A, 0x1C, 0x19,
+ 0x1A, 0x04, 0x1B, 0x02, 0x16, 0x1E, 0x11, 0x00,
+ 0x14, 0x09, 0x0C, 0x18, 0x05, 0x07, 0x0E, 0x0B };
+
+unsigned char table_49[32] = {
+ 0x1F, 0x0F, 0x19, 0x07, 0x18, 0x05, 0x1E, 0x1D,
+ 0x15, 0x08, 0x17, 0x10, 0x0A, 0x0E, 0x0C, 0x1B,
+ 0x02, 0x13, 0x03, 0x0D, 0x04, 0x1A, 0x06, 0x09,
+ 0x12, 0x1C, 0x0B, 0x16, 0x14, 0x01, 0x11, 0x00 };
+
+unsigned char table_50[32] = {
+ 0x16, 0x18, 0x1C, 0x0E, 0x12, 0x00, 0x04, 0x1B,
+ 0x1F, 0x13, 0x17, 0x0A, 0x1E, 0x03, 0x0C, 0x01,
+ 0x0F, 0x10, 0x02, 0x08, 0x14, 0x09, 0x19, 0x15,
+ 0x06, 0x0D, 0x0B, 0x1D, 0x05, 0x07, 0x11, 0x1A };
+
+unsigned char table_51[32] = {
+ 0x1C, 0x0D, 0x1B, 0x07, 0x17, 0x0E, 0x06, 0x01,
+ 0x12, 0x19, 0x03, 0x0B, 0x10, 0x08, 0x00, 0x1E,
+ 0x0A, 0x04, 0x1A, 0x1D, 0x0C, 0x18, 0x02, 0x13,
+ 0x0F, 0x11, 0x05, 0x09, 0x15, 0x16, 0x1F, 0x14 };
+
+unsigned char table_52[256] = {
+ 0x34, 0x0B, 0x47, 0xA3, 0x56, 0x30, 0x73, 0xD4,
+ 0x4B, 0xF6, 0xA6, 0x80, 0x22, 0x95, 0xA5, 0xBB,
+ 0xFE, 0xCD, 0x27, 0x88, 0x87, 0x18, 0x86, 0x6E,
+ 0xB9, 0x07, 0x37, 0x52, 0x0A, 0x28, 0x2C, 0xC4,
+ 0x75, 0xA1, 0x29, 0x54, 0x84, 0x08, 0x72, 0x51,
+ 0xDD, 0xF1, 0x4E, 0x1A, 0x90, 0x57, 0x20, 0xAD,
+ 0x68, 0x61, 0xAF, 0x50, 0x6B, 0x1B, 0x71, 0xEB,
+ 0x63, 0xC9, 0xB0, 0x58, 0x26, 0x40, 0xC7, 0xD9,
+ 0x70, 0xA2, 0x9A, 0x09, 0x3F, 0x92, 0x0D, 0x8C,
+ 0xC1, 0x96, 0x9F, 0x77, 0x4D, 0x5A, 0xEA, 0x11,
+ 0xD7, 0xF3, 0x33, 0x93, 0x10, 0x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 0xF2, 0x13, 0xBF, 0x40, 0x85, 0x77, 0x09, 0x3D,
+ 0x67, 0x63, 0x3F, 0x7F, 0xF3, 0x87, 0x8F, 0xFF,
+ 0x92, 0xC7, 0x4C, 0x23, 0xBA, 0xCB, 0xB1, 0xED,
+ 0x0C, 0x60, 0x47, 0xFE, 0x38, 0x5D, 0xCF, 0x8B,
+ 0x4D, 0xA9, 0x2E, 0xE5, 0xA4, 0x1B, 0x88, 0x3E,
+ 0x7D, 0xF8, 0xC0, 0xD5, 0x6D, 0x6C, 0x48, 0xAC,
+ 0x9B, 0x51, 0x7E, 0x6E, 0x50, 0x0D, 0x9A, 0xB3,
+ 0xEE, 0x07, 0x4F, 0x69, 0x9C, 0x03, 0xD9, 0xD4,
+ 0xB4, 0xD2, 0xAE, 0x4E, 0x55, 0xB7, 0xC9, 0x41,
+ 0x39, 0x6A, 0xC8, 0xA0, 0xB2, 0xC1, 0x84, 0xFC,
+ 0xAB, 0x64, 0xE0, 0xBE, 0xDA, 0xBD, 0x96, 0x94 };
+
+unsigned char table_54[32] = {
+ 0x01, 0x02, 0x1D, 0x10, 0x0E, 0x11, 0x08, 0x14,
+ 0x12, 0x09, 0x15, 0x17, 0x16, 0x04, 0x06, 0x1B,
+ 0x07, 0x1A, 0x18, 0x13, 0x0A, 0x1E, 0x1C, 0x1F,
+ 0x0C, 0x0B, 0x0D, 0x05, 0x0F, 0x00, 0x19, 0x03 };
+
+unsigned char table_55[32] = {
+ 0x01, 0x12, 0x13, 0x09, 0x0B, 0x19, 0x03, 0x0E,
+ 0x02, 0x1F, 0x1D, 0x1B, 0x1E, 0x11, 0x06, 0x05,
+ 0x00, 0x16, 0x07, 0x0C, 0x15, 0x0D, 0x1A, 0x08,
+ 0x18, 0x10, 0x0F, 0x17, 0x1C, 0x0A, 0x04, 0x14 };
+
+unsigned char table_56[256] = {
+ 0xEF, 0x06, 0x5F, 0x11, 0x4B, 0x60, 0x13, 0xBB,
+ 0x79, 0xD7, 0xE4, 0x6D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+ 0x13, 0x56, 0x6C, 0x89, 0x33, 0x6E, 0x2A, 0xA5,
+ 0xD1, 0x95, 0xC3, 0xA0, 0x0F, 0xCA, 0xAC, 0xFC };
+
+unsigned char table_77[32] = {
+ 0x1C, 0x0D, 0x1E, 0x01, 0x06, 0x16, 0x18, 0x17,
+ 0x0B, 0x1F, 0x04, 0x0F, 0x00, 0x19, 0x08, 0x0A,
+ 0x11, 0x03, 0x05, 0x07, 0x09, 0x0C, 0x15, 0x14,
+ 0x1A, 0x12, 0x13, 0x0E, 0x1D, 0x10, 0x02, 0x1B };
+
+unsigned char table_78[32] = {
+ 0x0E, 0x02, 0x17, 0x12, 0x1E, 0x09, 0x15, 0x03,
+ 0x01, 0x0B, 0x0F, 0x11, 0x10, 0x0A, 0x16, 0x06,
+ 0x07, 0x00, 0x1C, 0x1D, 0x1F, 0x0C, 0x18, 0x04,
+ 0x13, 0x0D, 0x1B, 0x08, 0x19, 0x14, 0x05, 0x1A };
+
+unsigned char table_79[32] = {
+ 0x12, 0x0B, 0x11, 0x01, 0x07, 0x0E, 0x1A, 0x0D,
+ 0x1E, 0x18, 0x14, 0x1F, 0x0A, 0x17, 0x19, 0x1B,
+ 0x00, 0x10, 0x0C, 0x08, 0x13, 0x02, 0x0F, 0x1D,
+ 0x09, 0x06, 0x04, 0x16, 0x15, 0x1C, 0x05, 0x03 };
+
+unsigned char table_80[256] = {
+ 0x14, 0xE7, 0x31, 0x0F, 0xD1, 0x5F, 0xED, 0x1E,
+ 0xA6, 0x77, 0x20, 0x57, 0x34, 0x64, 0x33, 0x0B,
+ 0x5A, 0xB4, 0x83, 0x62, 0xFD, 0x8E, 0xE4, 0xF3,
+ 0xBD, 0xA5, 0xC8, 0x6D, 0x3E, 0x4F, 0x01, 0x7A,
+ 0xD3, 0x45, 0x3C, 0xF2, 0x68, 0xFF, 0xE6, 0x84,
+ 0xC2, 0xC1, 0x53, 0x72, 0x8C, 0xA1, 0xC7, 0x00,
+ 0x89, 0x97, 0x69, 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03, 0x1B };
+
+unsigned char table_87[32] = {
+ 0x17, 0x0E, 0x1D, 0x13, 0x0B, 0x19, 0x03, 0x06,
+ 0x09, 0x01, 0x0D, 0x15, 0x1C, 0x16, 0x18, 0x1B,
+ 0x11, 0x10, 0x00, 0x1E, 0x1F, 0x08, 0x12, 0x0F,
+ 0x02, 0x04, 0x07, 0x1A, 0x14, 0x0A, 0x0C, 0x05 };
+
+unsigned char table_88[32] = {
+ 0x09, 0x08, 0x17, 0x10, 0x0A, 0x07, 0x1C, 0x1F,
+ 0x04, 0x0E, 0x01, 0x0C, 0x0D, 0x1B, 0x03, 0x15,
+ 0x02, 0x1E, 0x18, 0x19, 0x0F, 0x06, 0x1A, 0x0B,
+ 0x05, 0x11, 0x14, 0x00, 0x16, 0x1D, 0x12, 0x13 };
+
+unsigned char table_89[32] = {
+ 0x15, 0x1C, 0x1D, 0x14, 0x0F, 0x1A, 0x05, 0x02,
+ 0x07, 0x09, 0x06, 0x08, 0x1F, 0x00, 0x10, 0x13,
+ 0x0D, 0x03, 0x0C, 0x18, 0x0E, 0x16, 0x1B, 0x1E,
+ 0x12, 0x04, 0x11, 0x0A, 0x01, 0x0B, 0x17, 0x19 };
+
+unsigned char table_90[256] = {
+ 0x62, 0x36, 0x64, 0x0E, 0x4C, 0x6C, 0xBE, 0xCF,
+ 0x25, 0x5A, 0x3D, 0x12, 0x54, 0x9F, 0xE7, 0xA5,
+ 0xDE, 0xD7, 0xB2, 0x60, 0x18, 0x8D, 0x89, 0x70,
+ 0x48, 0x66, 0x1C, 0xA6, 0x17, 0x9B, 0xDF, 0x9A,
+ 0x82, 0xB9, 0x2E, 0xFA, 0x83, 0x5B, 0x7A, 0x61,
+ 0xFC, 0x6B, 0x8B, 0x4E, 0x0F, 0xAD, 0x78, 0xE1,
+ 0xE8, 0x15, 0x1A, 0xF7, 0xA3, 0x3A, 0x04, 0xE3,
+ 0x30, 0x8C, 0x06, 0xC4, 0x05, 0x32, 0x1F, 0x6A,
+ 0xB8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0xCC, 0xB6, 0x99, 0x4F,
+ 0x29, 0x0A, 0x08, 0xE4, 0x27, 0x19, 0x31, 0xC9,
+ 0x20, 0x94, 0x45, 0xED, 0xDC, 0xBD, 0x7E, 0x50 };
+
+unsigned char table_91[32] = {
+ 0x03, 0x04, 0x0C, 0x18, 0x10, 0x0D, 0x13, 0x1B,
+ 0x1F, 0x07, 0x11, 0x17, 0x1C, 0x1D, 0x05, 0x06,
+ 0x0A, 0x12, 0x02, 0x1A, 0x0B, 0x01, 0x0E, 0x08,
+ 0x14, 0x16, 0x00, 0x15, 0x19, 0x09, 0x0F, 0x1E };
+
+unsigned char table_92[32] = {
+ 0x1E, 0x10, 0x01, 0x07, 0x11, 0x16, 0x15, 0x17,
+ 0x1F, 0x14, 0x0C, 0x1C, 0x06, 0x03, 0x00, 0x18,
+ 0x08, 0x0E, 0x02, 0x1B, 0x09, 0x0D, 0x19, 0x05,
+ 0x0F, 0x12, 0x0B, 0x13, 0x0A, 0x04, 0x1D, 0x1A };
+
+unsigned char table_93[256] = {
+ 0x76, 0x78, 0xA2, 0x94, 0x0E, 0x7F, 0xDF, 0xC1,
+ 0xB9, 0xE1, 0x3D, 0x59, 0x6F, 0x1E, 0x53, 0x99,
+ 0x80, 0xE3, 0x21, 0xF8, 0x65, 0xB8, 0x08, 0xBC,
+ 0x29, 0x17, 0xFD, 0x33, 0x35, 0xF2, 0x70, 0xC7,
+ 0x25, 0xD0, 0xCD, 0x7A, 0xB7, 0x9B, 0xA5, 0xC3,
+ 0x00, 0x90, 0xDC, 0xB1, 0x0C, 0x20, 0x67, 0x8D,
+ 0x43, 0x49, 0xF3, 0x96, 0x14, 0x1A, 0xC8, 0x19,
+ 0x72, 0xD7, 0x8A, 0x38, 0x66, 0xDA, 0xDD, 0x2E,
+ 0xBE, 0xD5, 0x91, 0x7C, 0x3A, 0x92, 0x8E, 0xE7,
+ 0x51, 0xB5, 0xA8, 0xD9, 0x0B, 0x2A, 0xBA, 0x81,
+ 0x41, 0x0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 0x47, 0xF4, 0xB2 };
+
+unsigned char table_94[32] = {
+ 0x1C, 0x07, 0x05, 0x1A, 0x10, 0x1D, 0x14, 0x12,
+ 0x08, 0x0F, 0x0C, 0x01, 0x04, 0x1B, 0x16, 0x0A,
+ 0x11, 0x02, 0x1F, 0x13, 0x0D, 0x1E, 0x17, 0x06,
+ 0x0E, 0x09, 0x15, 0x19, 0x03, 0x18, 0x00, 0x0B };
+
+unsigned char table_95[32] = {
+ 0x12, 0x10, 0x11, 0x15, 0x03, 0x0A, 0x14, 0x05,
+ 0x1D, 0x07, 0x17, 0x0D, 0x09, 0x08, 0x1B, 0x1F,
+ 0x0B, 0x06, 0x19, 0x0E, 0x18, 0x04, 0x00, 0x02,
+ 0x1E, 0x1C, 0x01, 0x0C, 0x1A, 0x0F, 0x13, 0x16 };
+
+unsigned char table_96[256] = {
+ 0x1C, 0x6E, 0xCD, 0xB4, 0xB3, 0x93, 0xA8, 0x2E,
+ 0x4F, 0x09, 0xE3, 0x72, 0x64, 0x13, 0x21, 0xF5,
+ 0x89, 0xB2, 0xD2, 0x22, 0x5D, 0x63, 0x90, 0xC4,
+ 0x42, 0x9B, 0x07, 0xCA, 0x16, 0x19, 0x5C, 0x2B,
+ 0x3D, 0xA0, 0x69, 0x5F, 0x52, 0x41, 0x66, 0xC0,
+ 0x55, 0xDA, 0x82, 0x40, 0x25, 0x02, 0x3C, 0xDD,
+ 0xAE, 0xD7, 0xD6, 0xDB, 0x04, 0x78, 0x05, 0x4A,
+ 0x4C, 0x81, 0x00, 0xBE, 0x45, 0xC5, 0x30, 0xB0,
+ 0x65, 0x5A, 0xA9, 0x38, 0x75, 0x26, 0x85, 0x4E,
+ 0xF0, 0xA2, 0x91, 0x8A, 0x54, 0xD0, 0x3E, 0x0D,
+ 0xFE, 0xF2, 0x0A, 0x23, 0x24, 0x37, 0x32, 0x0B,
+ 0xCB, 0xB5, 0x28, 0x6A, 0x95, 0x49, 0x53, 0x9A,
+ 0xEE, 0x2C, 0x9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x88, 0x1F, 0x81, 0x67, 0xA1, 0x3A, 0xA7,
+ 0x22, 0xF8, 0x01, 0xA0, 0xCE, 0x7A, 0xDA, 0x30,
+ 0xC4, 0xE4, 0xEE, 0x7C, 0x3B, 0x4D, 0x3D, 0xE3,
+ 0xFA, 0x6A, 0x7F, 0x99, 0x00, 0x93, 0x0E, 0xFF,
+ 0x90, 0x0A, 0x2A, 0x5D, 0x96, 0x08, 0x6B, 0x83,
+ 0xBA, 0x1E, 0x44, 0x87, 0x45, 0x9F, 0xC9, 0x94 };
+
+unsigned char table_106[32] = {
+ 0x03, 0x11, 0x07, 0x1B, 0x0F, 0x14, 0x0C, 0x01,
+ 0x04, 0x02, 0x09, 0x0A, 0x05, 0x12, 0x06, 0x1F,
+ 0x1C, 0x0E, 0x0D, 0x15, 0x18, 0x08, 0x00, 0x10,
+ 0x1E, 0x1D, 0x17, 0x19, 0x13, 0x16, 0x0B, 0x1A };
+
+unsigned char table_107[32] = {
+ 0x13, 0x1B, 0x06, 0x11, 0x1C, 0x07, 0x08, 0x0E,
+ 0x10, 0x05, 0x09, 0x18, 0x04, 0x15, 0x1E, 0x0F,
+ 0x1F, 0x12, 0x02, 0x00, 0x17, 0x19, 0x1A, 0x0D,
+ 0x03, 0x0C, 0x0A, 0x1D, 0x14, 0x01, 0x16, 0x0B };
+
+unsigned char table_108[256] = {
+ 0x99, 0xA3, 0x48, 0xE8, 0x5A, 0x7D, 0x97, 0xCA,
+ 0x7F, 0x06, 0x9B, 0x04, 0xE0, 0xF3, 0x18, 0xAE,
+ 0x59, 0xA0, 0x2B, 0x15, 0x85, 0x3E, 0x12, 0x93,
+ 0x3D, 0x28, 0x32, 0xF5, 0x20, 0x5D, 0x86, 0x00,
+ 0x1B, 0x2E, 0x36, 0x10, 0x5E, 0x6C, 0xD8, 0x29,
+ 0xB6, 0x3F, 0x05, 0x1C, 0xCE, 0xC2, 0x34, 0x5F,
+ 0x5C, 0x79, 0xD1, 0x1F, 0xA2, 0xEE, 0x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xDA, 0x51, 0x81, 0x4A, 0x05, 0x00, 0xB8, 0x7C,
+ 0x30, 0x2F, 0x46, 0xB4, 0xC6, 0x87, 0x4B, 0x94,
+ 0x80, 0xF4, 0x7F, 0x3C, 0x26, 0xF1, 0x5B, 0xAB,
+ 0x91, 0x6E, 0x08, 0x76, 0x98, 0xD1, 0xE1, 0x36,
+ 0x21, 0xCA, 0xD8, 0x24, 0x9B, 0x39, 0xBB, 0xAD,
+ 0x13, 0x62, 0x97, 0x1A, 0x6D, 0x2C, 0x5A, 0xC4,
+ 0xD4, 0xA3, 0x03, 0xBF, 0x1E, 0xE4, 0xF3, 0x95,
+ 0x23, 0x73, 0x92, 0xB5, 0x01, 0x83, 0x82, 0xAA,
+ 0x09, 0x45, 0x6B, 0xD7, 0x0B, 0x89, 0x4F, 0x2A };
+
+unsigned char table_130[32] = {
+ 0x07, 0x03, 0x15, 0x0B, 0x02, 0x11, 0x17, 0x14,
+ 0x05, 0x10, 0x0A, 0x0F, 0x01, 0x1C, 0x1D, 0x0E,
+ 0x12, 0x06, 0x18, 0x16, 0x1A, 0x09, 0x13, 0x19,
+ 0x1B, 0x00, 0x08, 0x0D, 0x0C, 0x1E, 0x04, 0x1F };
+
+unsigned char table_131[32] = {
+ 0x1D, 0x13, 0x1B, 0x10, 0x07, 0x03, 0x0A, 0x02,
+ 0x00, 0x0C, 0x0E, 0x0B, 0x0D, 0x18, 0x12, 0x1F,
+ 0x1A, 0x04, 0x15, 0x11, 0x1E, 0x08, 0x1C, 0x14,
+ 0x19, 0x05, 0x0F, 0x17, 0x06, 0x01, 0x09, 0x16 };
+
+unsigned char table_132[256] = {
+ 0x33, 0x8D, 0x45, 0x6F, 0xFF, 0xF5, 0xB6, 0x53,
+ 0x3B, 0xF3, 0x07, 0xA4, 0x97, 0xEB, 0x6B, 0xA5,
+ 0xD3, 0xDC, 0x7B, 0x79, 0x93, 0xE7, 0xF7, 0x67,
+ 0x9C, 0x4F, 0x88, 0xF9, 0x3A, 0x2B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 0x0C,
+ 0x93, 0x1D, 0x9B, 0x5B, 0x40, 0xEE, 0x42, 0x19 };
+
+unsigned char table_137[32] = {
+ 0x0F, 0x09, 0x02, 0x06, 0x18, 0x0B, 0x1E, 0x05,
+ 0x11, 0x1D, 0x16, 0x01, 0x13, 0x10, 0x0E, 0x1A,
+ 0x1B, 0x00, 0x0D, 0x08, 0x15, 0x14, 0x19, 0x17,
+ 0x03, 0x1F, 0x0A, 0x12, 0x0C, 0x07, 0x04, 0x1C };
+
+unsigned char table_138[32] = {
+ 0x0D, 0x1C, 0x1F, 0x15, 0x0F, 0x14, 0x1B, 0x12,
+ 0x09, 0x0B, 0x19, 0x07, 0x11, 0x16, 0x0C, 0x04,
+ 0x13, 0x05, 0x1D, 0x03, 0x0E, 0x0A, 0x08, 0x1E,
+ 0x01, 0x06, 0x18, 0x17, 0x10, 0x1A, 0x02, 0x00 };
+
+unsigned char table_139[32] = {
+ 0x05, 0x15, 0x1D, 0x02, 0x0F, 0x03, 0x17, 0x1A,
+ 0x0A, 0x00, 0x1F, 0x12, 0x0E, 0x11, 0x1B, 0x13,
+ 0x0B, 0x0D, 0x09, 0x18, 0x1E, 0x08, 0x14, 0x07,
+ 0x0C, 0x04, 0x16, 0x19, 0x1C, 0x06, 0x10, 0x01 };
+
+unsigned char table_140[32] = {
+ 0x06, 0x1E, 0x0C, 0x11, 0x13, 0x08, 0x15, 0x01,
+ 0x1D, 0x03, 0x0F, 0x19, 0x18, 0x04, 0x00, 0x14,
+ 0x12, 0x1A, 0x0B, 0x0E, 0x02, 0x1B, 0x07, 0x05,
+ 0x1F, 0x17, 0x09, 0x0A, 0x0D, 0x16, 0x10, 0x1C };
+
+unsigned char table_141[256] = {
+ 0xE1, 0x0A, 0x28, 0xCD, 0x8A, 0x1E, 0x26, 0x10,
+ 0xC0, 0x6F, 0x06, 0x2C, 0xF8, 0x51, 0x6C, 0x8F,
+ 0xA8, 0x8C, 0x41, 0xF4, 0xED, 0x36, 0xAC, 0x89,
+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0xAC, 0x8A, 0x12, 0xC9, 0xCD,
+ 0xB8, 0x45, 0xAE, 0x32, 0xCE, 0xE2, 0x56, 0xFD,
+ 0x42, 0x89, 0x86, 0xCA, 0x4B, 0x3D, 0x5E, 0xBA,
+ 0x8B, 0x5D, 0xB0, 0xB7, 0xD9, 0x58, 0x2F, 0x08,
+ 0x43, 0x3A, 0x53, 0x9E, 0x80, 0x88, 0x07, 0x9D };
+
+unsigned char table_152[32] = {
+ 0x02, 0x1A, 0x17, 0x1D, 0x01, 0x03, 0x13, 0x1E,
+ 0x05, 0x18, 0x06, 0x0A, 0x0C, 0x04, 0x1B, 0x00,
+ 0x1C, 0x09, 0x1F, 0x16, 0x07, 0x0F, 0x0B, 0x0E,
+ 0x14, 0x12, 0x0D, 0x10, 0x19, 0x11, 0x08, 0x15 };
+
+unsigned char table_153[32] = {
+ 0x0E, 0x14, 0x12, 0x1E, 0x1C, 0x02, 0x06, 0x16,
+ 0x18, 0x0D, 0x17, 0x0C, 0x1D, 0x11, 0x08, 0x19,
+ 0x07, 0x0F, 0x13, 0x04, 0x03, 0x1B, 0x0B, 0x1F,
+ 0x1A, 0x0A, 0x05, 0x10, 0x00, 0x01, 0x15, 0x09 };
+
+unsigned char table_154[256] = {
+ 0x27, 0x5A, 0x08, 0x5B, 0xF4, 0x39, 0x13, 0x6F,
+ 0x67, 0xEA, 0x22, 0xCA, 0x5C, 0xCF, 0x18, 0x7C,
+ 0x05, 0x87, 0x60, 0xCC, 0x40, 0xC6, 0xE8, 0x6D,
+ 0xF5, 0x2A, 0x2D, 0xA2, 0x8C, 0x82, 0xE9, 0xDC,
+ 0xD6, 0x65, 0x74, 0x8E, 0x42, 0x4F, 0x3E, 0x55,
+ 0xFF, 0xC7, 0x9D, 0x0F, 0x81, 0xE2, 0x4C, 0xE6,
+ 0xEB, 0x4D, 0x70, 0xD1, 0x49, 0x43, 0x3D, 0x69,
+ 0x0C, 0x45, 0x28, 0x00, 0x99, 0xAE, 0xEC, 0xB8,
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0xDC, 0x9A, 0xB2, 0xED, 0x45, 0xC4, 0x50, 0x3F,
+ 0xE5, 0xCF, 0x88, 0x1C, 0x7A, 0x79, 0xEB, 0x70,
+ 0x2A, 0x7F, 0xBC, 0xDB, 0xD0, 0xB1, 0xCB, 0x08,
+ 0x86, 0x5D, 0x53, 0x72, 0xB6, 0x4B, 0xB3, 0x22,
+ 0xC3, 0x6F, 0xB9, 0xD5, 0x3B, 0x13, 0x2D, 0xAD,
+ 0x33, 0xFD, 0x02, 0x40, 0x8A, 0x3A, 0xF7, 0xE0,
+ 0x8C, 0x3E, 0x61, 0x6E, 0xE9, 0x63, 0xF9, 0xEC,
+ 0x48, 0x30, 0x87, 0x83, 0x12, 0x4D, 0x65, 0xDF };
+
+unsigned char table_171[32] = {
+ 0x07, 0x06, 0x11, 0x08, 0x0C, 0x1F, 0x19, 0x02,
+ 0x14, 0x04, 0x0D, 0x18, 0x1A, 0x05, 0x17, 0x13,
+ 0x1C, 0x1B, 0x15, 0x03, 0x01, 0x0F, 0x16, 0x1E,
+ 0x1D, 0x10, 0x00, 0x12, 0x0B, 0x0E, 0x09, 0x0A };
+
+unsigned char table_172[32] = {
+ 0x11, 0x01, 0x1F, 0x06, 0x1A, 0x04, 0x02, 0x09,
+ 0x05, 0x0D, 0x0B, 0x18, 0x0E, 0x12, 0x1B, 0x17,
+ 0x07, 0x08, 0x1D, 0x1E, 0x14, 0x19, 0x16, 0x15,
+ 0x03, 0x0C, 0x00, 0x10, 0x0A, 0x1C, 0x0F, 0x13 };
+
+unsigned char table_173[32] = {
+ 0x1F, 0x0B, 0x13, 0x00, 0x16, 0x15, 0x14, 0x0A,
+ 0x1D, 0x05, 0x1E, 0x1A, 0x0F, 0x04, 0x0E, 0x01,
+ 0x19, 0x07, 0x02, 0x12, 0x0C, 0x17, 0x08, 0x09,
+ 0x03, 0x11, 0x18, 0x10, 0x1C, 0x1B, 0x06, 0x0D };
+
+unsigned char table_174[32] = {
+ 0x02, 0x1B, 0x0C, 0x17, 0x1F, 0x05, 0x15, 0x1E,
+ 0x16, 0x09, 0x1A, 0x12, 0x0F, 0x1C, 0x18, 0x0A,
+ 0x19, 0x10, 0x0D, 0x13, 0x04, 0x11, 0x08, 0x14,
+ 0x1D, 0x0E, 0x06, 0x00, 0x01, 0x07, 0x0B, 0x03 };
+
+unsigned char table_175[32] = {
+ 0x00, 0x06, 0x0B, 0x08, 0x0C, 0x04, 0x1A, 0x1C,
+ 0x05, 0x1E, 0x14, 0x03, 0x0A, 0x18, 0x12, 0x1D,
+ 0x16, 0x1F, 0x07, 0x09, 0x0F, 0x0E, 0x17, 0x13,
+ 0x11, 0x19, 0x10, 0x0D, 0x1B, 0x02, 0x01, 0x15 };
+
+unsigned char table_176[32] = {
+ 0x12, 0x03, 0x1A, 0x15, 0x04, 0x19, 0x0B, 0x1B,
+ 0x17, 0x1E, 0x0D, 0x05, 0x11, 0x14, 0x1C, 0x00,
+ 0x18, 0x10, 0x0A, 0x06, 0x0E, 0x08, 0x02, 0x07,
+ 0x13, 0x09, 0x16, 0x1D, 0x0F, 0x0C, 0x01, 0x1F };
+
+unsigned char table_177[256] = {
+ 0x5E, 0x4D, 0x76, 0xFE, 0xB5, 0x50, 0x83, 0x23,
+ 0x72, 0xDD, 0x93, 0x08, 0x69, 0xAD, 0xEC, 0x3B,
+ 0x0B, 0x9A, 0x36, 0xC9, 0xCA, 0xBE, 0xF7, 0x30,
+ 0x19, 0x39, 0x2C, 0xAB, 0xE3, 0x7B, 0xBC, 0x32,
+ 0xA0, 0xE4, 0xA6, 0xB6, 0xCB, 0xC8, 0x37, 0x07,
+ 0xD2, 0xA1, 0xD9, 0xF6, 0xBF, 0xF5, 0x88, 0x01,
+ 0x95, 0x0F, 0x03, 0xFD, 0xE6, 0x68, 0x90, 0x61,
+ 0x21, 0x6D, 0x3C, 0x62, 0x34, 0x2B, 0x71, 0x4B,
+ 0x44, 0x64, 0x75, 0xA2, 0x6A, 0xFF, 0x29, 0xBD,
+ 0x35, 0x15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0x11, 0x3B, 0x94, 0xE8, 0x7D, 0x7B, 0xD9, 0x5A };
+
+unsigned char table_187[32] = {
+ 0x0F, 0x04, 0x1D, 0x1B, 0x15, 0x10, 0x01, 0x0B,
+ 0x00, 0x17, 0x13, 0x07, 0x1E, 0x1F, 0x08, 0x0A,
+ 0x19, 0x09, 0x05, 0x06, 0x0C, 0x1A, 0x14, 0x16,
+ 0x0E, 0x18, 0x03, 0x1C, 0x12, 0x11, 0x0D, 0x02 };
+
+struct yahoo_fn yahoo_fntable[5][96] =
+ {{{ IDENT, 0, 0 },
+ { IDENT, 0, 0 },
+ { IDENT, 0, 0 },
+ { IDENT, 0, 0 },
+ { IDENT, 0, 0 },
+ { IDENT, 0, 0 },
+ { IDENT, 0, 0 },
+ { IDENT, 0, 0 },
+ { IDENT, 0, 0 },
+ { IDENT, 0, 0 },
+ { IDENT, 0, 0 },
+ { IDENT, 0, 0 },
+ { IDENT, 0, 0 },
+ { IDENT, 0, 0 },
+ { IDENT, 0, 0 },
+ { IDENT, 0, 0 },
+ { IDENT, 0, 0 },
+ { IDENT, 0, 0 },
+ { IDENT, 0, 0 },
+ { IDENT, 0, 0 },
+ { IDENT, 0, 0 },
+ { IDENT, 0, 0 },
+ { IDENT, 0, 0 },
+ { IDENT, 0, 0 },
+ { IDENT, 0, 0 },
+ { IDENT, 0, 0 },
+ { IDENT, 0, 0 },
+ { IDENT, 0, 0 },
+ { IDENT, 0, 0 },
+ { IDENT, 0, 0 },
+ { IDENT, 0, 0 },
+ { IDENT, 0, 0 },
+ { IDENT, 0, 0 },
+ { IDENT, 0, 0 },
+ { IDENT, 0, 0 },
+ { IDENT, 0, 0 },
+ { IDENT, 0, 0 },
+ { IDENT, 0, 0 },
+ { IDENT, 0, 0 },
+ { IDENT, 0, 0 },
+ { IDENT, 0, 0 },
+ { IDENT, 0, 0 },
+ { IDENT, 0, 0 },
+ { IDENT, 0, 0 },
+ { IDENT, 0, 0 },
+ { IDENT, 0, 0 },
+ { IDENT, 0, 0 },
+ { IDENT, 0, 0 },
+ { IDENT, 0, 0 },
+ { IDENT, 0, 0 },
+ { IDENT, 0, 0 },
+ { IDENT, 0, 0 },
+ { IDENT, 0, 0 },
+ { IDENT, 0, 0 },
+ { IDENT, 0, 0 },
+ { IDENT, 0, 0 },
+ { IDENT, 0, 0 },
+ { IDENT, 0, 0 },
+ { IDENT, 0, 0 },
+ { IDENT, 0, 0 },
+ { IDENT, 0, 0 },
+ { IDENT, 0, 0 },
+ { IDENT, 0, 0 },
+ { IDENT, 0, 0 },
+ { IDENT, 0, 0 },
+ { IDENT, 0, 0 },
+ { IDENT, 0, 0 },
+ { IDENT, 0, 0 },
+ { IDENT, 0, 0 },
+ { IDENT, 0, 0 },
+ { IDENT, 0, 0 },
+ { IDENT, 0, 0 },
+ { IDENT, 0, 0 },
+ { IDENT, 0, 0 },
+ { IDENT, 0, 0 },
+ { IDENT, 0, 0 },
+ { IDENT, 0, 0 },
+ { IDENT, 0, 0 },
+ { IDENT, 0, 0 },
+ { IDENT, 0, 0 },
+ { IDENT, 0, 0 },
+ { IDENT, 0, 0 },
+ { IDENT, 0, 0 },
+ { IDENT, 0, 0 },
+ { IDENT, 0, 0 },
+ { IDENT, 0, 0 },
+ { IDENT, 0, 0 },
+ { IDENT, 0, 0 },
+ { IDENT, 0, 0 },
+ { IDENT, 0, 0 },
+ { IDENT, 0, 0 },
+ { IDENT, 0, 0 },
+ { IDENT, 0, 0 },
+ { IDENT, 0, 0 },
+ { IDENT, 0, 0 },
+ { IDENT, 0, 0 }},
+ {{ MULADD, 0x36056CD7, 0x4387 },
+ { LOOKUP, (long)table_0, 0 },
+ { LOOKUP, (long)table_1, 0 },
+ { BITFLD, (long)table_2, 0 },
+ { LOOKUP, (long)table_3, 0 },
+ { BITFLD, (long)table_4, 0 },
+ { MULADD, 0x4ABB534D, 0x3769 },
+ { XOR, 0x1D242DA5, 0 },
+ { MULADD, 0x3C23132D, 0x339B },
+ { XOR, 0x0191265C, 0 },
+ { XOR, 0x3DB979DB, 0 },
+ { LOOKUP, (long)table_5, 0 },
+ { XOR, 0x1A550E1E, 0 },
+ { XOR, 0x2F140A2D, 0 },
+ { MULADD, 0x7C466A4B, 0x29BF },
+ { XOR, 0x2D3F30D3, 0 },
+ { MULADD, 0x7E823B21, 0x6BB3 },
+ { BITFLD, (long)table_6, 0 },
+ { LOOKUP, (long)table_7, 0 },
+ { BITFLD, (long)table_8, 0 },
+ { LOOKUP, (long)table_9, 0 },
+ { BITFLD, (long)table_10, 0 },
+ { LOOKUP, (long)table_11, 0 },
+ { BITFLD, (long)table_12, 0 },
+ { LOOKUP, (long)table_13, 0 },
+ { BITFLD, (long)table_14, 0 },
+ { MULADD, 0x5B756AB9, 0x7E9B },
+ { LOOKUP, (long)table_15, 0 },
+ { XOR, 0x1D1C4911, 0 },
+ { LOOKUP, (long)table_16, 0 },
+ { LOOKUP, (long)table_17, 0 },
+ { XOR, 0x46BD7771, 0 },
+ { XOR, 0x51AE2B42, 0 },
+ { MULADD, 0x2417591B, 0x177B },
+ { MULADD, 0x57F27C5F, 0x2433 },
+ { LOOKUP, (long)table_18, 0 },
+ { LOOKUP, (long)table_19, 0 },
+ { XOR, 0x71422261, 0 },
+ { BITFLD, (long)table_20, 0 },
+ { MULADD, 0x58E937F9, 0x1075 },
+ { LOOKUP, (long)table_21, 0 },
+ { BITFLD, (long)table_22, 0 },
+ { LOOKUP, (long)table_23, 0 },
+ { LOOKUP, (long)table_24, 0 },
+ { MULADD, 0x0B4C3D13, 0x1597 },
+ { BITFLD, (long)table_25, 0 },
+ { XOR, 0x0FE07D38, 0 },
+ { MULADD, 0x689B4017, 0x3CFB },
+ { BITFLD, (long)table_26, 0 },
+ { LOOKUP, (long)table_27, 0 },
+ { XOR, 0x35413DF3, 0 },
+ { MULADD, 0x05B611AB, 0x570B },
+ { MULADD, 0x0DA5334F, 0x3AC7 },
+ { XOR, 0x47706008, 0 },
+ { BITFLD, (long)table_28, 0 },
+ { LOOKUP, (long)table_29, 0 },
+ { BITFLD, (long)table_30, 0 },
+ { XOR, 0x57611B36, 0 },
+ { MULADD, 0x314C2CD1, 0x2B5B },
+ { XOR, 0x1EF33946, 0 },
+ { MULADD, 0x28EA041F, 0x638F },
+ { LOOKUP, (long)table_31, 0 },
+ { LOOKUP, (long)table_32, 0 },
+ { LOOKUP, (long)table_33, 0 },
+ { MULADD, 0x511537CB, 0x7135 },
+ { MULADD, 0x1CF71007, 0x5E17 },
+ { XOR, 0x583D4BCF, 0 },
+ { LOOKUP, (long)table_34, 0 },
+ { XOR, 0x373E6856, 0 },
+ { MULADD, 0x4D595519, 0x1A7D },
+ { LOOKUP, (long)table_35, 0 },
+ { LOOKUP, (long)table_36, 0 },
+ { XOR, 0x0E2A36A7, 0 },
+ { LOOKUP, (long)table_37, 0 },
+ { LOOKUP, (long)table_38, 0 },
+ { BITFLD, (long)table_39, 0 },
+ { BITFLD, (long)table_40, 0 },
+ { XOR, 0x53F3604F, 0 },
+ { BITFLD, (long)table_41, 0 },
+ { BITFLD, (long)table_42, 0 },
+ { MULADD, 0x1EDC0BA3, 0x7531 },
+ { LOOKUP, (long)table_43, 0 },
+ { XOR, 0x10DF1038, 0 },
+ { BITFLD, (long)table_44, 0 },
+ { LOOKUP, (long)table_45, 0 },
+ { XOR, 0x4EDE0CAC, 0 },
+ { MULADD, 0x2F076EEB, 0x5BCF },
+ { XOR, 0x6D86030F, 0 },
+ { XOR, 0x3F331713, 0 },
+ { LOOKUP, (long)table_46, 0 },
+ { MULADD, 0x41CD726F, 0x3F79 },
+ { BITFLD, (long)table_47, 0 },
+ { XOR, 0x0ECE0054, 0 },
+ { MULADD, 0x19B32B03, 0x4AD1 },
+ { BITFLD, (long)table_48, 0 },
+ { BITFLD, (long)table_49, 0 }},
+ {{ MULADD, 0x39731111, 0x419B },
+ { XOR, 0x54F7757A, 0 },
+ { BITFLD, (long)table_50, 0 },
+ { BITFLD, (long)table_51, 0 },
+ { LOOKUP, (long)table_52, 0 },
+ { LOOKUP, (long)table_53, 0 },
+ { MULADD, 0x3CC0256B, 0x7CE7 },
+ { XOR, 0x79991847, 0 },
+ { MULADD, 0x228F7FB5, 0x472D },
+ { MULADD, 0x32DA290B, 0x7745 },
+ { XOR, 0x7A28180D, 0 },
+ { BITFLD, (long)table_54, 0 },
+ { BITFLD, (long)table_55, 0 },
+ { MULADD, 0x5C814F8B, 0x227F },
+ { LOOKUP, (long)table_56, 0 },
+ { MULADD, 0x0B496F6D, 0x412D },
+ { XOR, 0x6F4B62DA, 0 },
+ { LOOKUP, (long)table_57, 0 },
+ { XOR, 0x64973977, 0 },
+ { LOOKUP, (long)table_58, 0 },
+ { LOOKUP, (long)table_59, 0 },
+ { BITFLD, (long)table_60, 0 },
+ { LOOKUP, (long)table_61, 0 },
+ { LOOKUP, (long)table_62, 0 },
+ { XOR, 0x6DD14C92, 0 },
+ { LOOKUP, (long)table_63, 0 },
+ { BITFLD, (long)table_64, 0 },
+ { BITFLD, (long)table_65, 0 },
+ { BITFLD, (long)table_66, 0 },
+ { LOOKUP, (long)table_67, 0 },
+ { XOR, 0x5E6324D8, 0 },
+ { LOOKUP, (long)table_68, 0 },
+ { LOOKUP, (long)table_69, 0 },
+ { LOOKUP, (long)table_70, 0 },
+ { BITFLD, (long)table_71, 0 },
+ { XOR, 0x62745ED0, 0 },
+ { MULADD, 0x102C215B, 0x0581 },
+ { LOOKUP, (long)table_72, 0 },
+ { LOOKUP, (long)table_73, 0 },
+ { LOOKUP, (long)table_74, 0 },
+ { MULADD, 0x19511111, 0x12C1 },
+ { LOOKUP, (long)table_75, 0 },
+ { MULADD, 0x2A6E2953, 0x6977 },
+ { LOOKUP, (long)table_76, 0 },
+ { XOR, 0x55CD5445, 0 },
+ { BITFLD, (long)table_77, 0 },
+ { BITFLD, (long)table_78, 0 },
+ { MULADD, 0x646C21EB, 0x43E5 },
+ { XOR, 0x71DC4898, 0 },
+ { XOR, 0x167519CB, 0 },
+ { XOR, 0x6D3158F8, 0 },
+ { XOR, 0x7EA95BEA, 0 },
+ { BITFLD, (long)table_79, 0 },
+ { XOR, 0x47377587, 0 },
+ { XOR, 0x2D8B6E8F, 0 },
+ { MULADD, 0x5E6105DB, 0x1605 },
+ { XOR, 0x65B543C8, 0 },
+ { LOOKUP, (long)table_80, 0 },
+ { BITFLD, (long)table_81, 0 },
+ { MULADD, 0x48AF73CB, 0x0A67 },
+ { XOR, 0x4FB96154, 0 },
+ { LOOKUP, (long)table_82, 0 },
+ { BITFLD, (long)table_83, 0 },
+ { XOR, 0x622C4954, 0 },
+ { BITFLD, (long)table_84, 0 },
+ { XOR, 0x20D220F3, 0 },
+ { XOR, 0x361D4F0D, 0 },
+ { XOR, 0x2B2000D1, 0 },
+ { XOR, 0x6FB8593E, 0 },
+ { LOOKUP, (long)table_85, 0 },
+ { BITFLD, (long)table_86, 0 },
+ { XOR, 0x2B7F7DFC, 0 },
+ { MULADD, 0x5FC41A57, 0x0693 },
+ { MULADD, 0x17154387, 0x2489 },
+ { BITFLD, (long)table_87, 0 },
+ { BITFLD, (long)table_88, 0 },
+ { BITFLD, (long)table_89, 0 },
+ { LOOKUP, (long)table_90, 0 },
+ { XOR, 0x7E221470, 0 },
+ { XOR, 0x7A600061, 0 },
+ { BITFLD, (long)table_91, 0 },
+ { BITFLD, (long)table_92, 0 },
+ { LOOKUP, (long)table_93, 0 },
+ { BITFLD, (long)table_94, 0 },
+ { MULADD, 0x00E813A5, 0x2CE5 },
+ { MULADD, 0x3D707E25, 0x3827 },
+ { MULADD, 0x77A53E07, 0x6A5F },
+ { BITFLD, (long)table_95, 0 },
+ { LOOKUP, (long)table_96, 0 },
+ { LOOKUP, (long)table_97, 0 },
+ { XOR, 0x43A73788, 0 },
+ { LOOKUP, (long)table_98, 0 },
+ { BITFLD, (long)table_99, 0 },
+ { LOOKUP, (long)table_100, 0 },
+ { XOR, 0x55F4606B, 0 },
+ { BITFLD, (long)table_101, 0 }},
+ {{ BITFLD, (long)table_102, 0 },
+ { MULADD, 0x32CA58E3, 0x04F9 },
+ { XOR, 0x11756B30, 0 },
+ { MULADD, 0x218B2569, 0x5DB1 },
+ { XOR, 0x77D64B90, 0 },
+ { BITFLD, (long)table_103, 0 },
+ { LOOKUP, (long)table_104, 0 },
+ { MULADD, 0x7D1428CB, 0x3D },
+ { XOR, 0x6F872C49, 0 },
+ { XOR, 0x2E484655, 0 },
+ { MULADD, 0x1E3349F7, 0x41F5 },
+ { LOOKUP, (long)table_105, 0 },
+ { BITFLD, (long)table_106, 0 },
+ { XOR, 0x61640311, 0 },
+ { BITFLD, (long)table_107, 0 },
+ { LOOKUP, (long)table_108, 0 },
+ { LOOKUP, (long)table_109, 0 },
+ { LOOKUP, (long)table_110, 0 },
+ { XOR, 0x007044D3, 0 },
+ { BITFLD, (long)table_111, 0 },
+ { MULADD, 0x5C221625, 0x576F },
+ { LOOKUP, (long)table_112, 0 },
+ { LOOKUP, (long)table_113, 0 },
+ { XOR, 0x2D406BB1, 0 },
+ { MULADD, 0x680B1F17, 0x12CD },
+ { BITFLD, (long)table_114, 0 },
+ { MULADD, 0x12564D55, 0x32B9 },
+ { MULADD, 0x21A67897, 0x6BAB },
+ { LOOKUP, (long)table_115, 0 },
+ { MULADD, 0x06405119, 0x7143 },
+ { XOR, 0x351D01ED, 0 },
+ { MULADD, 0x46356F6B, 0x0A49 },
+ { MULADD, 0x32C77969, 0x72F3 },
+ { BITFLD, (long)table_116, 0 },
+ { LOOKUP, (long)table_117, 0 },
+ { LOOKUP, (long)table_118, 0 },
+ { BITFLD, (long)table_119, 0 },
+ { LOOKUP, (long)table_120, 0 },
+ { BITFLD, (long)table_121, 0 },
+ { MULADD, 0x74D52C55, 0x5F43 },
+ { XOR, 0x26201CA8, 0 },
+ { XOR, 0x7AEB3255, 0 },
+ { LOOKUP, (long)table_122, 0 },
+ { MULADD, 0x578F1047, 0x640B },
+ { LOOKUP, (long)table_123, 0 },
+ { LOOKUP, (long)table_124, 0 },
+ { BITFLD, (long)table_125, 0 },
+ { BITFLD, (long)table_126, 0 },
+ { XOR, 0x4A1352CF, 0 },
+ { MULADD, 0x4BFB6EF3, 0x704F },
+ { MULADD, 0x1B4C7FE7, 0x5637 },
+ { MULADD, 0x04091A3B, 0x4917 },
+ { XOR, 0x270C2F52, 0 },
+ { LOOKUP, (long)table_127, 0 },
+ { BITFLD, (long)table_128, 0 },
+ { LOOKUP, (long)table_129, 0 },
+ { BITFLD, (long)table_130, 0 },
+ { MULADD, 0x127549D5, 0x579B },
+ { MULADD, 0x0AB54121, 0x7A47 },
+ { BITFLD, (long)table_131, 0 },
+ { XOR, 0x751E6E49, 0 },
+ { LOOKUP, (long)table_132, 0 },
+ { LOOKUP, (long)table_133, 0 },
+ { XOR, 0x670C3F74, 0 },
+ { MULADD, 0x6B080851, 0x7E8B },
+ { XOR, 0x71CD789E, 0 },
+ { XOR, 0x3EB20B7B, 0 },
+ { BITFLD, (long)table_134, 0 },
+ { LOOKUP, (long)table_135, 0 },
+ { MULADD, 0x58A67753, 0x272B },
+ { MULADD, 0x1AB54AD7, 0x4D33 },
+ { MULADD, 0x07D30A45, 0x0569 },
+ { MULADD, 0x737616BF, 0x70C7 },
+ { LOOKUP, (long)table_136, 0 },
+ { MULADD, 0x45C4485D, 0x2063 },
+ { BITFLD, (long)table_137, 0 },
+ { XOR, 0x2598043D, 0 },
+ { MULADD, 0x223A4FE3, 0x49A7 },
+ { XOR, 0x1EED619F, 0 },
+ { BITFLD, (long)table_138, 0 },
+ { XOR, 0x6F477561, 0 },
+ { BITFLD, (long)table_139, 0 },
+ { BITFLD, (long)table_140, 0 },
+ { LOOKUP, (long)table_141, 0 },
+ { MULADD, 0x4BC13C4F, 0x45C1 },
+ { XOR, 0x3B547BFB, 0 },
+ { LOOKUP, (long)table_142, 0 },
+ { MULADD, 0x71406AB3, 0x7A5F },
+ { XOR, 0x2F1467E9, 0 },
+ { MULADD, 0x009366D1, 0x22D1 },
+ { MULADD, 0x587D1B75, 0x2CA5 },
+ { MULADD, 0x213A4BE7, 0x4499 },
+ { MULADD, 0x62653E89, 0x2D5D },
+ { BITFLD, (long)table_143, 0 },
+ { MULADD, 0x4F5F3257, 0x444F },
+ { MULADD, 0x4C0E2B2B, 0x19D3 }},
+ {{ MULADD, 0x3F867B35, 0x7B3B },
+ { MULADD, 0x32D25CB1, 0x3D6D },
+ { BITFLD, (long)table_144, 0 },
+ { MULADD, 0x50FA1C51, 0x5F4F },
+ { LOOKUP, (long)table_145, 0 },
+ { XOR, 0x05FE7AF1, 0 },
+ { MULADD, 0x14067C29, 0x10C5 },
+ { LOOKUP, (long)table_146, 0 },
+ { MULADD, 0x4A5558C5, 0x271F },
+ { XOR, 0x3C0861B1, 0 },
+ { BITFLD, (long)table_147, 0 },
+ { LOOKUP, (long)table_148, 0 },
+ { MULADD, 0x18837C9D, 0x6335 },
+ { BITFLD, (long)table_149, 0 },
+ { XOR, 0x7DAB5033, 0 },
+ { LOOKUP, (long)table_150, 0 },
+ { MULADD, 0x03B87321, 0x7225 },
+ { XOR, 0x7F906745, 0 },
+ { LOOKUP, (long)table_151, 0 },
+ { BITFLD, (long)table_152, 0 },
+ { XOR, 0x21C46C2C, 0 },
+ { MULADD, 0x2B36757D, 0x028D },
+ { BITFLD, (long)table_153, 0 },
+ { LOOKUP, (long)table_154, 0 },
+ { XOR, 0x106B4A85, 0 },
+ { XOR, 0x17640F11, 0 },
+ { LOOKUP, (long)table_155, 0 },
+ { XOR, 0x69E60486, 0 },
+ { LOOKUP, (long)table_156, 0 },
+ { MULADD, 0x3782017D, 0x05BF },
+ { BITFLD, (long)table_157, 0 },
+ { LOOKUP, (long)table_158, 0 },
+ { XOR, 0x6BCA53B0, 0 },
+ { LOOKUP, (long)table_159, 0 },
+ { LOOKUP, (long)table_160, 0 },
+ { LOOKUP, (long)table_161, 0 },
+ { LOOKUP, (long)table_162, 0 },
+ { XOR, 0x0B8236E3, 0 },
+ { BITFLD, (long)table_163, 0 },
+ { MULADD, 0x5EE51C43, 0x4553 },
+ { BITFLD, (long)table_164, 0 },
+ { LOOKUP, (long)table_165, 0 },
+ { LOOKUP, (long)table_166, 0 },
+ { LOOKUP, (long)table_167, 0 },
+ { MULADD, 0x42B14C6F, 0x5531 },
+ { XOR, 0x4A2548E8, 0 },
+ { MULADD, 0x5C071D85, 0x2437 },
+ { LOOKUP, (long)table_168, 0 },
+ { MULADD, 0x29195861, 0x108B },
+ { XOR, 0x24012258, 0 },
+ { LOOKUP, (long)table_169, 0 },
+ { XOR, 0x63CC2377, 0 },
+ { XOR, 0x08D04B59, 0 },
+ { MULADD, 0x3FD30CF5, 0x7027 },
+ { XOR, 0x7C3E0478, 0 },
+ { MULADD, 0x457776B7, 0x24B3 },
+ { XOR, 0x086652BC, 0 },
+ { MULADD, 0x302F5B13, 0x371D },
+ { LOOKUP, (long)table_170, 0 },
+ { MULADD, 0x58692D47, 0x0671 },
+ { XOR, 0x6601178E, 0 },
+ { MULADD, 0x0F195B9B, 0x1369 },
+ { XOR, 0x07BA21D8, 0 },
+ { BITFLD, (long)table_171, 0 },
+ { BITFLD, (long)table_172, 0 },
+ { XOR, 0x13AC3D21, 0 },
+ { MULADD, 0x5BCF3275, 0x6E1B },
+ { MULADD, 0x62725C5B, 0x16B9 },
+ { MULADD, 0x5B950FDF, 0x2D35 },
+ { BITFLD, (long)table_173, 0 },
+ { BITFLD, (long)table_174, 0 },
+ { MULADD, 0x73BA5335, 0x1C13 },
+ { BITFLD, (long)table_175, 0 },
+ { BITFLD, (long)table_176, 0 },
+ { XOR, 0x3E144154, 0 },
+ { MULADD, 0x4EED7B27, 0x38AB },
+ { LOOKUP, (long)table_177, 0 },
+ { MULADD, 0x627C7E0F, 0x7F01 },
+ { MULADD, 0x5D7E1F73, 0x2C0F },
+ { LOOKUP, (long)table_178, 0 },
+ { MULADD, 0x55C9525F, 0x4659 },
+ { XOR, 0x3765334C, 0 },
+ { MULADD, 0x5DF66DDF, 0x7C25 },
+ { LOOKUP, (long)table_179, 0 },
+ { LOOKUP, (long)table_180, 0 },
+ { XOR, 0x16AE5776, 0 },
+ { LOOKUP, (long)table_181, 0 },
+ { LOOKUP, (long)table_182, 0 },
+ { BITFLD, (long)table_183, 0 },
+ { BITFLD, (long)table_184, 0 },
+ { LOOKUP, (long)table_185, 0 },
+ { MULADD, 0x4392327B, 0x7E0D },
+ { LOOKUP, (long)table_186, 0 },
+ { MULADD, 0x3D8B0CB5, 0x640D },
+ { MULADD, 0x32865601, 0x4D43 },
+ { BITFLD, (long)table_187, 0 }}};
+
+#define A( x ) (( x ) & 0xFF )
+#define B( x ) (( x ) >> 8 & 0xFF )
+#define C( x ) (( x ) >> 16 & 0xFF )
+#define D( x ) (( x ) >> 24 & 0xFF )
+
+int yahoo_xfrm( int table, int depth, int seed )
+{
+ struct yahoo_fn *xfrm;
+ int i, j, z;
+ unsigned int n = seed;
+ unsigned char *arg;
+
+ for( i = 0; i < depth; i++ )
+ {
+ xfrm = &yahoo_fntable[table][n % 96];
+ switch( xfrm->type )
+ {
+ case IDENT:
+ return seed;
+ case XOR:
+ seed ^= xfrm->arg1;
+ break;
+ case MULADD:
+ seed = seed * xfrm->arg1 + xfrm->arg2;
+ break;
+ case LOOKUP:
+ arg = (unsigned char *)xfrm->arg1;
+ seed = arg[A( seed )] | arg[B( seed )] << 8 | arg[C( seed )] << 16
+ | arg[D( seed )] << 24;
+ break;
+ case BITFLD:
+ arg = (unsigned char *)xfrm->arg1;
+ for( j = 0, z = 0; j < 32; j++ )
+ z = ((( seed >> j ) & 1 ) << arg[j] ) | ( ~( 1 << arg[j] ) & z );
+ seed = z;
+ break;
+ }
+ if( depth - i == 1 )
+ return seed;
+ z = (((((( A( seed ) * 0x9E3779B1 ) ^ B( seed )) * 0x9E3779B1 )
+ ^ C( seed )) * 0x9E3779B1 ) ^ D( seed )) * 0x9E3779B1;
+ n = (((( z ^ ( z >> 8 )) >> 16 ) ^ z ) ^ ( z >> 8 )) & 0xFF;
+ seed *= 0x00010DCD;
+ }
+ return seed;
+}
diff --git a/miranda-wine/protocols/Yahoo/libyahoo2/yahoo_fn.h b/miranda-wine/protocols/Yahoo/libyahoo2/yahoo_fn.h
new file mode 100644
index 0000000..ac1c569
--- /dev/null
+++ b/miranda-wine/protocols/Yahoo/libyahoo2/yahoo_fn.h
@@ -0,0 +1,33 @@
+/*
+ * libyahoo2 - originally from gaim patches by Amatus
+ *
+ * Copyright (C) 2003-2004
+ *
+ * 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
+ */
+
+#define IDENT 1 /* identify function */
+#define XOR 2 /* xor with arg1 */
+#define MULADD 3 /* multipy by arg1 then add arg2 */
+#define LOOKUP 4 /* lookup each byte in the table pointed to by arg1 */
+#define BITFLD 5 /* reorder bits according to table pointed to by arg1 */
+
+struct yahoo_fn
+{
+ int type; /* type of transform */
+ int arg1, arg2; /* arguments */
+};
+
+int yahoo_xfrm( int table, int depth, int seed );
diff --git a/miranda-wine/protocols/Yahoo/libyahoo2/yahoo_httplib.c b/miranda-wine/protocols/Yahoo/libyahoo2/yahoo_httplib.c
new file mode 100644
index 0000000..60325c6
--- /dev/null
+++ b/miranda-wine/protocols/Yahoo/libyahoo2/yahoo_httplib.c
@@ -0,0 +1,451 @@
+/*
+ * libyahoo2: yahoo_httplib.c
+ *
+ * Copyright (C) 2002-2004, Philip S Tellis <philip.tellis AT gmx.net>
+ *
+ * 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
+ *
+ */
+
+#if HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#if STDC_HEADERS
+# include <string.h>
+#else
+# if !HAVE_STRCHR
+# define strchr index
+# define strrchr rindex
+# endif
+char *strchr (), *strrchr ();
+# if !HAVE_MEMCPY
+# define memcpy(d, s, n) bcopy ((s), (d), (n))
+# define memmove(d, s, n) bcopy ((s), (d), (n))
+# endif
+#endif
+
+
+#include <errno.h>
+
+/* special check for MSVC compiler */
+#ifndef _MSC_VER
+#ifndef __GNUC__
+ #include <unistd.h>
+#endif
+#endif
+
+#include <ctype.h>
+#include "yahoo2.h"
+#include "yahoo2_callbacks.h"
+#include "yahoo_httplib.h"
+#include "yahoo_util.h"
+
+#include "yahoo_debug.h"
+
+#ifdef USE_STRUCT_CALLBACKS
+extern struct yahoo_callbacks *yc;
+#define YAHOO_CALLBACK(x) yc->x
+#else
+#define YAHOO_CALLBACK(x) x
+#endif
+
+extern enum yahoo_log_level log_level;
+
+int yahoo_tcp_readline(char *ptr, int maxlen, int fd)
+{
+ int n, rc;
+ char c;
+
+ for (n = 1; n < maxlen; n++) {
+
+ do {
+ rc = read(fd, &c, 1);
+ } while(rc == -1 && (errno == EINTR || errno == EAGAIN)); /* this is bad - it should be done asynchronously */
+
+ if (rc == 1) {
+ if(c == '\r') /* get rid of \r */
+ continue;
+ *ptr = c;
+ if (c == '\n')
+ break;
+ ptr++;
+ } else if (rc == 0) {
+ if (n == 1)
+ return (0); /* EOF, no data */
+ else
+ break; /* EOF, w/ data */
+ } else {
+ return -1;
+ }
+ }
+
+ *ptr = 0;
+ return (n);
+}
+
+static int url_to_host_port_path(const char *url,
+ char *host, int *port, char *path)
+{
+ char *urlcopy=NULL;
+ char *slash=NULL;
+ char *colon=NULL;
+
+ /*
+ * http://hostname
+ * http://hostname/
+ * http://hostname/path
+ * http://hostname/path:foo
+ * http://hostname:port
+ * http://hostname:port/
+ * http://hostname:port/path
+ * http://hostname:port/path:foo
+ */
+
+ if(strstr(url, "http://") == url) {
+ urlcopy = strdup(url+7);
+ } else {
+ WARNING(("Weird url - unknown protocol: %s", url));
+ return 0;
+ }
+
+ slash = strchr(urlcopy, '/');
+ colon = strchr(urlcopy, ':');
+
+ if(!colon || (slash && slash < colon)) {
+ *port = 80;
+ } else {
+ *colon = 0;
+ *port = atoi(colon+1);
+ }
+
+ if(!slash) {
+ strcpy(path, "/");
+ } else {
+ strcpy(path, slash);
+ *slash = 0;
+ }
+
+ strcpy(host, urlcopy);
+
+ FREE(urlcopy);
+
+ return 1;
+}
+
+static int isurlchar(unsigned char c)
+{
+ return (isalnum(c) || '-' == c || '_' == c);
+}
+
+char *yahoo_urlencode(const char *instr)
+{
+ int ipos=0, bpos=0;
+ char *str = NULL;
+ int len = strlen(instr);
+
+ if(!(str = y_new(char, 3*len + 1) ))
+ return "";
+
+ while(instr[ipos]) {
+ while(isurlchar(instr[ipos]))
+ str[bpos++] = instr[ipos++];
+ if(!instr[ipos])
+ break;
+
+ snprintf(&str[bpos], 4, "%%%.2x", instr[ipos]);
+ bpos+=3;
+ ipos++;
+ }
+ str[bpos]='\0';
+
+ /* free extra alloc'ed mem. */
+ len = strlen(str);
+ str = y_renew(char, str, len+1);
+
+ return (str);
+}
+
+char *yahoo_urldecode(const char *instr)
+{
+ int ipos=0, bpos=0;
+ char *str = NULL;
+ char entity[3]={0,0,0};
+ unsigned dec;
+ int len = strlen(instr);
+
+ if(!(str = y_new(char, len+1) ))
+ return "";
+
+ while(instr[ipos]) {
+ while(instr[ipos] && instr[ipos]!='%')
+ if(instr[ipos]=='+') {
+ str[bpos++]=' ';
+ ipos++;
+ } else
+ str[bpos++] = instr[ipos++];
+ if(!instr[ipos])
+ break;
+
+ if(instr[ipos+1] && instr[ipos+2]) {
+ ipos++;
+ entity[0]=instr[ipos++];
+ entity[1]=instr[ipos++];
+ sscanf(entity, "%2x", &dec);
+ str[bpos++] = (char)dec;
+ } else {
+ str[bpos++] = instr[ipos++];
+ }
+ }
+ str[bpos]='\0';
+
+ /* free extra alloc'ed mem. */
+ len = strlen(str);
+ str = y_renew(char, str, len+1);
+
+ return (str);
+}
+
+char *yahoo_xmldecode(const char *instr)
+{
+ int ipos=0, bpos=0, epos=0;
+ char *str = NULL;
+ char entity[4]={0,0,0,0};
+ char *entitymap[5][2]={
+ {"amp;", "&"},
+ {"quot;", "\""},
+ {"lt;", "<"},
+ {"gt;", "<"},
+ {"nbsp;", " "}
+ };
+ unsigned dec;
+ int len = strlen(instr);
+
+ if(!(str = y_new(char, len+1) ))
+ return "";
+
+ while(instr[ipos]) {
+ while(instr[ipos] && instr[ipos]!='&')
+ if(instr[ipos]=='+') {
+ str[bpos++]=' ';
+ ipos++;
+ } else
+ str[bpos++] = instr[ipos++];
+ if(!instr[ipos] || !instr[ipos+1])
+ break;
+ ipos++;
+
+ if(instr[ipos] == '#') {
+ ipos++;
+ epos=0;
+ while(instr[ipos] != ';')
+ entity[epos++]=instr[ipos++];
+ sscanf(entity, "%u", &dec);
+ str[bpos++] = (char)dec;
+ ipos++;
+ } else {
+ int i;
+ for (i=0; i<5; i++)
+ if(!strncmp(instr+ipos, entitymap[i][0],
+ strlen(entitymap[i][0]))) {
+ str[bpos++] = entitymap[i][1][0];
+ ipos += strlen(entitymap[i][0]);
+ break;
+ }
+ }
+ }
+ str[bpos]='\0';
+
+ /* free extra alloc'ed mem. */
+ len = strlen(str);
+ str = y_renew(char, str, len+1);
+
+ return (str);
+}
+
+typedef void (*http_connected)(int id, int fd, int error);
+
+struct callback_data {
+ int id;
+ yahoo_get_fd_callback callback;
+ char *request;
+ void *user_data;
+};
+
+static void connect_complete(int fd, int error, void *data)
+{
+ struct callback_data *ccd = data;
+ if(error == 0 && fd > 0)
+ write(fd, ccd->request, strlen(ccd->request));
+ FREE(ccd->request);
+ ccd->callback(ccd->id, fd, error, ccd->user_data);
+ FREE(ccd);
+}
+
+static void yahoo_send_http_request(int id, char *host, int port, char *request,
+ yahoo_get_fd_callback callback, void *data)
+{
+ struct callback_data *ccd=y_new0(struct callback_data, 1);
+ ccd->callback = callback;
+ ccd->id = id;
+ ccd->request = strdup(request);
+ ccd->user_data = data;
+
+ YAHOO_CALLBACK(ext_yahoo_connect_async)(id, host, port, YAHOO_CONNECTION_FT, connect_complete, ccd);
+}
+
+void yahoo_http_post(int id, const char *url, const char *cookies, long content_length,
+ yahoo_get_fd_callback callback, void *data)
+{
+ char host[255];
+ int port = 80;
+ char path[255];
+ char ck[2048];
+ char buff[4096];
+
+ if(!url_to_host_port_path(url, host, &port, path))
+ return;
+
+ if (cookies == NULL)
+ ck[0] = '\0';
+ else
+ snprintf(ck, sizeof(ck), "Cookie: %s\r\n", cookies);
+
+ snprintf(buff, sizeof(buff),
+ "POST %s HTTP/1.0\r\n"
+ "User-Agent: Mozilla/4.0 (compatible; MSIE 5.5)\r\n"
+ "Pragma: no-cache\r\n"
+ "Host: %s:%d\r\n"
+ "Content-Length: %ld\r\n"
+ "%s"
+ "\r\n",
+ path,
+ host, port,content_length,
+ ck);
+
+ yahoo_send_http_request(id, host, port, buff, callback, data);
+}
+
+void yahoo_http_get(int id, const char *url, const char *cookies,
+ yahoo_get_fd_callback callback, void *data)
+{
+ char host[255];
+ int port = 80;
+ char path[255];
+ char ck[2048];
+ char buff[4096];
+
+ if(!url_to_host_port_path(url, host, &port, path))
+ return;
+
+ if (cookies == NULL)
+ ck[0] = '\0';
+ else
+ snprintf(ck, sizeof(ck), "Cookie: %s\r\n", cookies);
+
+ snprintf(buff, sizeof(buff),
+ "GET %s HTTP/1.0\r\n"
+ "User-Agent: Mozilla/4.0 (compatible; MSIE 5.5)\r\n"
+ "Pragma: no-cache\r\n"
+ "Host: %s\r\n"
+ "%s"
+ "\r\n",
+ path, host, ck);
+
+ yahoo_send_http_request(id, host, port, buff, callback, data);
+}
+
+struct url_data {
+ yahoo_get_url_handle_callback callback;
+ void *user_data;
+};
+
+static void yahoo_got_url_fd(int id, int fd, int error, void *data)
+{
+ char *tmp=NULL;
+ char buff[1024];
+ unsigned long filesize=0;
+ char *filename=NULL;
+ int n;
+
+ struct url_data *ud = data;
+
+ if(error || fd < 0) {
+ ud->callback(id, fd, error, filename, filesize, ud->user_data);
+ FREE(ud);
+ return;
+ }
+
+ while((n=yahoo_tcp_readline(buff, sizeof(buff), fd)) > 0) {
+ LOG(("Read:%s:\n", buff));
+ if(!strcmp(buff, ""))
+ break;
+
+ if( !strncasecmp(buff, "Content-length:",
+ strlen("Content-length:")) ) {
+ tmp = strrchr(buff, ' ');
+ if(tmp)
+ filesize = atol(tmp);
+ }
+
+ if( !strncasecmp(buff, "Content-disposition:",
+ strlen("Content-disposition:")) ) {
+ tmp = strstr(buff, "name=");
+ if(tmp) {
+ tmp+=strlen("name=");
+ if(tmp[0] == '"') {
+ char *tmp2;
+ tmp++;
+ tmp2 = strchr(tmp, '"');
+ if(tmp2)
+ *tmp2 = '\0';
+ } else {
+ char *tmp2;
+ tmp2 = strchr(tmp, ';');
+ if(!tmp2)
+ tmp2 = strchr(tmp, '\r');
+ if(!tmp2)
+ tmp2 = strchr(tmp, '\n');
+ if(tmp2)
+ *tmp2 = '\0';
+ }
+
+ filename = strdup(tmp);
+ }
+ }
+ }
+
+ LOG(("n == %d\n", n));
+ LOG(("Calling callback, filename:%s, size: %ld\n", filename, filesize));
+ ud->callback(id, fd, error, filename, filesize, ud->user_data);
+ FREE(ud);
+ FREE(filename);
+}
+
+void yahoo_get_url_fd(int id, const char *url, const struct yahoo_data *yd,
+ yahoo_get_url_handle_callback callback, void *data)
+{
+ char buff[1024];
+ struct url_data *ud = y_new0(struct url_data, 1);
+ //snprintf(buff, sizeof(buff), "Y=%s; T=%s", yd->cookie_y, yd->cookie_t);
+ buff[0]='\0'; /*don't send them our cookies!! */
+ ud->callback = callback;
+ ud->user_data = data;
+ yahoo_http_get(id, url, buff, yahoo_got_url_fd, ud);
+}
+
diff --git a/miranda-wine/protocols/Yahoo/libyahoo2/yahoo_httplib.h b/miranda-wine/protocols/Yahoo/libyahoo2/yahoo_httplib.h
new file mode 100644
index 0000000..5a6c247
--- /dev/null
+++ b/miranda-wine/protocols/Yahoo/libyahoo2/yahoo_httplib.h
@@ -0,0 +1,48 @@
+/*
+ * libyahoo2: yahoo_httplib.h
+ *
+ * Copyright (C) 2002-2004, Philip S Tellis <philip.tellis AT gmx.net>
+ *
+ * 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 YAHOO_HTTPLIB_H
+#define YAHOO_HTTPLIB_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "yahoo2_types.h"
+
+char *yahoo_urlencode(const char *instr);
+char *yahoo_urldecode(const char *instr);
+char *yahoo_xmldecode(const char *instr);
+
+int yahoo_tcp_readline(char *ptr, int maxlen, int fd);
+void yahoo_http_post(int id, const char *url, const char *cookies, long size,
+ yahoo_get_fd_callback callback, void *data);
+void yahoo_http_get(int id, const char *url, const char *cookies,
+ yahoo_get_fd_callback callback, void *data);
+void yahoo_get_url_fd(int id, const char *url, const struct yahoo_data *yd,
+ yahoo_get_url_handle_callback callback, void *data);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/miranda-wine/protocols/Yahoo/libyahoo2/yahoo_list.c b/miranda-wine/protocols/Yahoo/libyahoo2/yahoo_list.c
new file mode 100644
index 0000000..193a78f
--- /dev/null
+++ b/miranda-wine/protocols/Yahoo/libyahoo2/yahoo_list.c
@@ -0,0 +1,236 @@
+/*
+ * yahoo_list.c: linked list routines
+ *
+ * Some code copyright (C) 2002-2004, Philip S Tellis <philip.tellis AT gmx.net>
+ * Other code copyright Meredydd Luff <meredydd AT everybuddy.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
+ *
+ * Some of this code was borrowed from elist.c in the eb-lite sources
+ *
+ */
+
+#include <stdlib.h>
+
+#include "yahoo_list.h"
+
+YList *y_list_append(YList * list, void *data)
+{
+ YList *n;
+ YList *new_list = malloc(sizeof(YList));
+ YList *attach_to = NULL;
+
+ new_list->next = NULL;
+ new_list->data = data;
+
+ for (n = list; n != NULL; n = n->next) {
+ attach_to = n;
+ }
+
+ if (attach_to == NULL) {
+ new_list->prev = NULL;
+ return new_list;
+ } else {
+ new_list->prev = attach_to;
+ attach_to->next = new_list;
+ return list;
+ }
+}
+
+YList *y_list_prepend(YList * list, void *data)
+{
+ YList *n = malloc(sizeof(YList));
+
+ n->next = list;
+ n->prev = NULL;
+ n->data = data;
+ if (list)
+ list->prev = n;
+
+ return n;
+}
+
+YList *y_list_concat(YList * list, YList * add)
+{
+ YList *l;
+
+ if(!list)
+ return add;
+
+ if(!add)
+ return list;
+
+ for (l = list; l->next; l = l->next)
+ ;
+
+ l->next = add;
+ add->prev = l;
+
+ return list;
+}
+
+YList *y_list_remove(YList * list, void *data)
+{
+ YList *n;
+
+ for (n = list; n != NULL; n = n->next) {
+ if (n->data == data) {
+ list=y_list_remove_link(list, n);
+ y_list_free_1(n);
+ break;
+ }
+ }
+
+ return list;
+}
+
+/* Warning */
+/* link MUST be part of list */
+/* caller must free link using y_list_free_1 */
+YList *y_list_remove_link(YList * list, const YList * link)
+{
+ if (!link)
+ return list;
+
+ if (link->next)
+ link->next->prev = link->prev;
+ if (link->prev)
+ link->prev->next = link->next;
+
+ if (link == list)
+ list = link->next;
+
+ return list;
+}
+
+int y_list_length(const YList * list)
+{
+ int retval = 0;
+ const YList *n = list;
+
+ for (n = list; n != NULL; n = n->next) {
+ retval++;
+ }
+
+ return retval;
+}
+
+/* well, you could just check for list == NULL, but that would be
+ * implementation dependent
+ */
+int y_list_empty(const YList * list)
+{
+ if(!list)
+ return 1;
+ else
+ return 0;
+}
+
+int y_list_singleton(const YList * list)
+{
+ if(!list || list->next)
+ return 0;
+ return 1;
+}
+
+YList *y_list_copy(YList * list)
+{
+ YList *n;
+ YList *copy = NULL;
+
+ for (n = list; n != NULL; n = n->next) {
+ copy = y_list_append(copy, n->data);
+ }
+
+ return copy;
+}
+
+void y_list_free_1(YList * list)
+{
+ free(list);
+}
+
+void y_list_free(YList * list)
+{
+ YList *n = list;
+
+ while (n != NULL) {
+ YList *next = n->next;
+ free(n);
+ n = next;
+ }
+}
+
+YList *y_list_find(YList * list, const void *data)
+{
+ YList *l;
+ for (l = list; l && l->data != data; l = l->next)
+ ;
+
+ return l;
+}
+
+void y_list_foreach(YList * list, YListFunc fn, void * user_data)
+{
+ for (; list; list = list->next)
+ fn(list->data, user_data);
+}
+
+YList *y_list_find_custom(YList * list, const void *data, YListCompFunc comp)
+{
+ YList *l;
+ for (l = list; l; l = l->next)
+ if (comp(l->data, data) == 0)
+ return l;
+
+ return NULL;
+}
+
+YList *y_list_nth(YList * list, int n)
+{
+ int i=n;
+ for ( ; list && i; list = list->next, i--)
+ ;
+
+ return list;
+}
+
+YList *y_list_insert_sorted(YList * list, void *data, YListCompFunc comp)
+{
+ YList *l, *n, *prev = NULL;
+ if (!list)
+ return y_list_append(list, data);
+
+ n = malloc(sizeof(YList));
+ n->data = data;
+ for (l = list; l && comp(l->data, n->data) <= 0; l = l->next)
+ prev = l;
+
+ if (l) {
+ n->prev = l->prev;
+ l->prev = n;
+ } else
+ n->prev = prev;
+
+ n->next = l;
+
+ if(n->prev) {
+ n->prev->next = n;
+ return list;
+ } else {
+ return n;
+ }
+
+}
diff --git a/miranda-wine/protocols/Yahoo/libyahoo2/yahoo_list.h b/miranda-wine/protocols/Yahoo/libyahoo2/yahoo_list.h
new file mode 100644
index 0000000..abb2c64
--- /dev/null
+++ b/miranda-wine/protocols/Yahoo/libyahoo2/yahoo_list.h
@@ -0,0 +1,74 @@
+/*
+ * yahoo_list.h: linked list routines
+ *
+ * Some code copyright (C) 2002-2004, Philip S Tellis <philip.tellis AT gmx.net>
+ * Other code copyright Meredydd Luff <meredydd AT everybuddy.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
+ *
+ */
+
+/*
+ * This is a replacement for the GList. It only provides functions that
+ * we use in Ayttm. Thanks to Meredyyd from everybuddy dev for doing
+ * most of it.
+ */
+
+#ifndef __YLIST_H__
+#define __YLIST_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef struct _YList {
+ struct _YList *next;
+ struct _YList *prev;
+ void *data;
+} YList;
+
+typedef int (*YListCompFunc) (const void *, const void *);
+typedef void (*YListFunc) (void *, void *);
+
+YList *y_list_append(YList * list, void *data);
+YList *y_list_prepend(YList * list, void *data);
+YList *y_list_remove_link(YList * list, const YList * link);
+YList *y_list_remove(YList * list, void *data);
+
+YList *y_list_insert_sorted(YList * list, void * data, YListCompFunc comp);
+
+YList *y_list_copy(YList * list);
+
+YList *y_list_concat(YList * list, YList * add);
+
+YList *y_list_find(YList * list, const void *data);
+YList *y_list_find_custom(YList * list, const void *data, YListCompFunc comp);
+
+YList *y_list_nth(YList * list, int n);
+
+void y_list_foreach(YList * list, YListFunc fn, void *user_data);
+
+void y_list_free_1(YList * list);
+void y_list_free(YList * list);
+int y_list_length(const YList * list);
+int y_list_empty(const YList * list);
+int y_list_singleton(const YList * list);
+
+#define y_list_next(list) list->next
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/miranda-wine/protocols/Yahoo/libyahoo2/yahoo_util.c b/miranda-wine/protocols/Yahoo/libyahoo2/yahoo_util.c
new file mode 100644
index 0000000..f166501
--- /dev/null
+++ b/miranda-wine/protocols/Yahoo/libyahoo2/yahoo_util.c
@@ -0,0 +1,161 @@
+/*
+ * libyahoo2: yahoo_util.c
+ *
+ * Copyright (C) 2002-2004, Philip S Tellis <philip.tellis AT gmx.net>
+ *
+ * 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
+ *
+ */
+
+#if HAVE_CONFIG_H
+# include "config.h"
+#endif
+
+#if STDC_HEADERS
+# include <string.h>
+#else
+# if !HAVE_STRCHR
+# define strchr index
+# define strrchr rindex
+# endif
+char *strchr (), *strrchr ();
+# if !HAVE_MEMCPY
+# define memcpy(d, s, n) bcopy ((s), (d), (n))
+# define memmove(d, s, n) bcopy ((s), (d), (n))
+# endif
+#endif
+
+#include "yahoo_util.h"
+
+char * y_string_append(char * string, char * append)
+{
+ int size = strlen(string) + strlen(append) + 1;
+ char * new_string = y_renew(char, string, size);
+
+ if(new_string == NULL) {
+ new_string = y_new(char, size);
+ strcpy(new_string, string);
+ FREE(string);
+ }
+
+ strcat(new_string, append);
+
+ return new_string;
+}
+
+/*char * y_str_to_utf8(const char *in)
+{
+ unsigned int n, i = 0;
+ char *result = NULL;
+
+ if(in == NULL || *in == '\0')
+ return "";
+
+ result = y_new(char, strlen(in) * 2 + 1);
+
+ // convert a string to UTF-8 Format
+ for (n = 0; n < strlen(in); n++) {
+ unsigned char c = (unsigned char)in[n];
+
+ if (c < 128) {
+ result[i++] = (char) c;
+ } else {
+ result[i++] = (char) ((c >> 6) | 192);
+ result[i++] = (char) ((c & 63) | 128);
+ }
+ }
+ result[i] = '\0';
+ return result;
+}
+
+char * y_utf8_to_str(const char *in)
+{
+ int i = 0;
+ unsigned int n;
+ char *result = NULL;
+
+ if(in == NULL || *in == '\0')
+ return "";
+
+ result = y_new(char, strlen(in) + 1);
+
+ // convert a string from UTF-8 Format
+ for (n = 0; n < strlen(in); n++) {
+ unsigned char c = in[n];
+
+ if (c < 128) {
+ result[i++] = (char) c;
+ } else {
+ result[i++] = (c << 6) | (in[++n] & 63);
+ }
+ }
+ result[i] = '\0';
+ return result;
+} */
+
+#if !HAVE_GLIB
+
+void y_strfreev(char ** vector)
+{
+ char **v;
+ for(v = vector; *v; v++) {
+ FREE(*v);
+ }
+ FREE(vector);
+}
+
+char ** y_strsplit(char * str, char * sep, int nelem)
+{
+ char ** vector;
+ char *s, *p;
+ int i=0;
+ int l = strlen(sep);
+ if(nelem <= 0) {
+ char * s;
+ nelem=0;
+ if (*str) {
+ for(s=strstr(str, sep); s; s=strstr(s+l, sep),nelem++)
+ ;
+ if(strcmp(str+strlen(str)-l, sep))
+ nelem++;
+ }
+ }
+
+ vector = y_new(char *, nelem + 1);
+
+ for(p=str, s=strstr(p,sep); i<nelem && s; p=s+l, s=strstr(p,sep), i++) {
+ int len = s-p;
+ vector[i] = y_new(char, len+1);
+ strncpy(vector[i], p, len);
+ vector[i][len] = '\0';
+ }
+
+ if(i<nelem && *str) /* str didn't end with sep, and str isn't empty */
+ vector[i++] = strdup(p);
+
+ vector[i] = NULL;
+
+ return vector;
+}
+
+void * y_memdup(const void * addr, int n)
+{
+ void * new_chunk = malloc(n);
+ if(new_chunk)
+ memcpy(new_chunk, addr, n);
+ return new_chunk;
+}
+
+#endif
diff --git a/miranda-wine/protocols/Yahoo/libyahoo2/yahoo_util.h b/miranda-wine/protocols/Yahoo/libyahoo2/yahoo_util.h
new file mode 100644
index 0000000..396ce14
--- /dev/null
+++ b/miranda-wine/protocols/Yahoo/libyahoo2/yahoo_util.h
@@ -0,0 +1,104 @@
+/*
+ * libyahoo2: yahoo_util.h
+ *
+ * Copyright (C) 2002-2004, Philip S Tellis <philip.tellis AT gmx.net>
+ *
+ * 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 __YAHOO_UTIL_H__
+#define __YAHOO_UTIL_H__
+
+#if HAVE_CONFIG_H
+# include "config.h"
+#endif
+
+#if HAVE_GLIB
+# include <glib.h>
+
+# define FREE(x) if(x) {g_free(x); x=NULL;}
+
+# define y_new g_new
+# define y_new0 g_new0
+# define y_renew g_renew
+
+# define y_memdup g_memdup
+# define y_strsplit g_strsplit
+# define y_strfreev g_strfreev
+# ifndef strdup
+# define strdup g_strdup
+# endif
+# ifndef strncasecmp
+# define strncasecmp g_strncasecmp
+# define strcasecmp g_strcasecmp
+# endif
+
+# define snprintf g_snprintf
+# define vsnprintf g_vsnprintf
+
+#else
+
+# include <stdlib.h>
+# include <stdarg.h>
+
+# define FREE(x) if(x) {free(x); x=NULL;}
+
+# define y_new(type, n) (type *)malloc(sizeof(type) * (n))
+# define y_new0(type, n) (type *)calloc((n), sizeof(type))
+# define y_renew(type, mem, n) (type *)realloc(mem, n)
+
+void * y_memdup(const void * addr, int n);
+char ** y_strsplit(char * str, char * sep, int nelem);
+void y_strfreev(char ** vector);
+
+/*
+int strncasecmp(const char * s1, const char * s2, size_t n);
+int strcasecmp(const char * s1, const char * s2);
+
+char * strdup(const char *s);
+
+int snprintf(char *str, size_t size, const char *format, ...);
+int vsnprintf(char *str, size_t size, const char *format, va_list ap);
+*/
+
+#endif
+
+#ifndef TRUE
+#define TRUE 1
+#endif
+
+#ifndef FALSE
+#define FALSE 0
+#endif
+
+#ifndef MIN
+#define MIN(x,y) ((x)<(y)?(x):(y))
+#endif
+
+#ifndef MAX
+#define MAX(x,y) ((x)>(y)?(x):(y))
+#endif
+
+/*
+ * The following three functions return newly allocated memory.
+ * You must free it yourself
+ */
+char * y_string_append(char * str, char * append);
+/*char * y_str_to_utf8(const char * in);
+char * y_utf8_to_str(const char * in);*/
+
+#endif
+
diff --git a/miranda-wine/protocols/Yahoo/main.c b/miranda-wine/protocols/Yahoo/main.c
new file mode 100644
index 0000000..7700b56
--- /dev/null
+++ b/miranda-wine/protocols/Yahoo/main.c
@@ -0,0 +1,302 @@
+/*
+ * $Id: main.c 3717 2006-09-06 17:49:35Z gena01 $
+ *
+ * myYahoo Miranda Plugin
+ *
+ * Authors: Gennady Feldman (aka Gena01)
+ * Laurent Marechal (aka Peorth)
+ *
+ * This code is under GPL and is based on AIM, MSN and Miranda source code.
+ * I want to thank Robert Rainwater and George Hazan for their code and support
+ * and for answering some of my questions during development of this plugin.
+ */
+#include <windows.h>
+#include "yahoo.h"
+#include "http_gateway.h"
+#include "version.h"
+#include "resource.h"
+
+#include <m_system.h>
+#include <m_langpack.h>
+#include <m_options.h>
+#include <m_skin.h>
+#include <m_message.h>
+#include <m_idle.h>
+#include <m_userinfo.h>
+
+#include "options.h"
+
+//#define HTTP_GATEWAY
+extern char *szStartMsg;
+
+/*
+ * Global Variables
+ */
+HINSTANCE hinstance;
+PLUGINLINK *pluginLink;
+char yahooProtocolName[MAX_PATH];
+
+HANDLE hNetlibUser = NULL;
+HANDLE YahooMenuItems[ MENU_ITEMS_COUNT ];
+static HANDLE hHookOptsInit;
+static HANDLE hHookModulesLoaded;
+static HANDLE hHookSettingChanged;
+static HANDLE hHookUserTyping;
+static HANDLE hHookUserInfoInit;
+HANDLE hHookContactDeleted;
+HANDLE hHookIdle;
+HANDLE hYahooNudge = NULL;
+
+pthread_mutex_t connectionHandleMutex;
+
+PLUGININFO pluginInfo={
+ sizeof(PLUGININFO),
+#ifdef YAHOO_CVSBUILD
+ "Yahoo Protocol Beta/Nightly",
+#else
+ "Yahoo Protocol",
+#endif
+ __VERSION_DWORD,
+ "Yahoo Protocol support via libyahoo2 library. [Built: "__DATE__" "__TIME__"]",
+ "Gennady Feldman, Laurent Marechal",
+ "gena01@miranda-im.org",
+ "© 2003-2006 G.Feldman",
+ "http://www.miranda-im.org/download/details.php?action=viewfile&id=1248",
+ 0, //not transient
+ 0 //DEFMOD_PROTOCOLYAHOO - no core yahoo protocol
+};
+
+int yahooStatus = ID_STATUS_OFFLINE;
+BOOL yahooLoggedIn = FALSE;
+
+/*
+ * WINAPI DllMain - main entry point into a DLL
+ * Parameters:
+ * HINSTANCE hinst,
+ * DWORD fdwReason,
+ * LPVOID lpvReserved
+ * Returns :
+ * BOOL
+ *
+ */
+BOOL WINAPI DllMain(HINSTANCE hinst,DWORD fdwReason,LPVOID lpvReserved)
+{
+ hinstance=hinst;
+ return TRUE;
+}
+
+
+/*
+ * MainInit - Called at very beginning of plugin
+ * Parameters: wparam , lparam
+ * Returns : int
+ */
+/*int MainInit(WPARAM wparam,LPARAM lparam)
+{
+ return 0;
+}*/
+
+/*
+ * MirandaPluginInfo - Sets plugin info
+ * Parameters: (DWORD mirandaVersion)
+ */
+__declspec(dllexport) PLUGININFO* MirandaPluginInfo(DWORD mirandaVersion)
+{
+ //
+ // We require Miranda 0.6
+ // This requires the latest trunk... experimental API used here
+ //
+ if (mirandaVersion < PLUGIN_MAKE_VERSION(0, 6, 0, 0)) {
+ MessageBox( NULL,
+ "Yahoo plugin cannot be loaded. It requires Miranda IM 0.6 or later.",
+ "Yahoo",
+ MB_OK|MB_ICONWARNING|MB_SETFOREGROUND|MB_TOPMOST );
+
+ return NULL;
+ }
+
+ return &pluginInfo;
+}
+
+/*
+ * Unload - Unloads plugin
+ * Parameters: void
+ */
+
+int __declspec(dllexport) Unload(void)
+{
+ YAHOO_DebugLog("Unload");
+
+ //stop_timer();
+
+ if (yahooLoggedIn)
+ yahoo_logout();
+
+ YAHOO_DebugLog("Logged out");
+ pthread_mutex_destroy(&connectionHandleMutex);
+
+ LocalEventUnhook(hHookContactDeleted);
+ LocalEventUnhook(hHookIdle);
+ LocalEventUnhook(hHookModulesLoaded);
+ LocalEventUnhook(hHookOptsInit);
+ LocalEventUnhook(hHookSettingChanged);
+ LocalEventUnhook(hHookUserTyping);
+
+ if (szStartMsg)
+ free(szStartMsg);
+
+ YAHOO_DebugLog("Before Netlib_CloseHandle");
+ Netlib_CloseHandle( hNetlibUser );
+
+ return 0;
+}
+
+int YahooIdleEvent(WPARAM wParam, LPARAM lParam);
+int OnDetailsInit(WPARAM wParam, LPARAM lParam);
+
+
+/*
+ * Load - loads plugin into memory
+ */
+
+static int OnModulesLoaded( WPARAM wParam, LPARAM lParam )
+{
+ char tModule[ 100 ], tModuleDescr[ 100 ];
+ NETLIBUSER nlu = {0};
+
+ if ( !ServiceExists( MS_DB_CONTACT_GETSETTING_STR )) {
+ MessageBox( NULL,
+ Translate("Yahoo plugin requires db3x plugin version 0.5.1.0 or later" ),
+ Translate("Yahoo"),
+ MB_OK );
+ return 1;
+ }
+
+ CharUpper( lstrcpy( tModule, yahooProtocolName ));
+ wsprintf(tModuleDescr, "%s plugin connections", yahooProtocolName);
+
+ nlu.cbSize = sizeof(nlu);
+
+#ifdef HTTP_GATEWAY
+ nlu.flags = NUF_OUTGOING | NUF_HTTPGATEWAY| NUF_HTTPCONNS;
+#else
+ nlu.flags = NUF_OUTGOING | NUF_HTTPCONNS;
+#endif
+
+ nlu.szSettingsModule = tModule;
+ nlu.szDescriptiveName = Translate( tModuleDescr );
+
+#ifdef HTTP_GATEWAY
+ // Here comes the Gateway Code!
+ nlu.szHttpGatewayHello = NULL;
+ nlu.szHttpGatewayUserAgent = "User-Agent: Mozilla/4.01 [en] (Win95; I)";
+ nlu.pfnHttpGatewayInit = YAHOO_httpGatewayInit;
+ nlu.pfnHttpGatewayBegin = NULL;
+ nlu.pfnHttpGatewayWrapSend = YAHOO_httpGatewayWrapSend;
+ nlu.pfnHttpGatewayUnwrapRecv = YAHOO_httpGatewayUnwrapRecv;
+#endif
+
+ hNetlibUser = ( HANDLE )YAHOO_CallService( MS_NETLIB_REGISTERUSER, 0, ( LPARAM )&nlu );
+
+ hHookOptsInit = HookEvent( ME_OPT_INITIALISE, YahooOptInit );
+ hHookSettingChanged = HookEvent(ME_DB_CONTACT_SETTINGCHANGED, YAHOO_util_dbsettingchanged);
+ hHookIdle = HookEvent(ME_IDLE_CHANGED, YahooIdleEvent);
+ hHookUserInfoInit = HookEvent(ME_USERINFO_INITIALISE, OnDetailsInit);
+
+ // Add support for Plugin Uninstaller
+ //DBWriteContactSettingString(NULL, "Uninstall", "Yahoo", yahooProtocolName);
+
+ //add as a known module in DB Editor ++
+ CallService("DBEditorpp/RegisterSingleModule",(WPARAM)yahooProtocolName, 0);
+
+ //start_timer();
+ return 0;
+}
+
+//=====================================================
+// Name : Load
+// Parameters: PLUGINLINK *link
+// Returns : int
+// Description : Called when plugin is loaded into Miranda
+//=====================================================
+
+int __declspec(dllexport)Load(PLUGINLINK *link)
+{
+ PROTOCOLDESCRIPTOR pd;
+ char path[MAX_PATH], tNudge[250];
+ char* protocolname;
+
+ pluginLink=link;
+ //
+ // Need to disable threading since we got our own routines.
+ //
+ DisableThreadLibraryCalls(hinstance);
+
+ GetModuleFileName( hinstance, path, sizeof( path ));
+
+ protocolname = strrchr(path,'\\');
+
+ if (protocolname != NULL) {
+ char* fend;
+
+ protocolname++;
+ fend = strrchr(path,'.');
+
+ if (fend != NULL)
+ *fend = '\0';
+
+ CharUpper( protocolname );
+ lstrcpyn(yahooProtocolName, protocolname, MAX_PATH);
+ } else
+ lstrcpy(yahooProtocolName, "YAHOO");
+
+ mir_snprintf( path, sizeof( path ), "%s/Status", yahooProtocolName );
+ CallService( MS_DB_SETSETTINGRESIDENT, TRUE, ( LPARAM )path );
+
+ mir_snprintf( path, sizeof( path ), "%s/YStatus", yahooProtocolName );
+ CallService( MS_DB_SETSETTINGRESIDENT, TRUE, ( LPARAM )path );
+
+ mir_snprintf( path, sizeof( path ), "%s/YAway", yahooProtocolName );
+ CallService( MS_DB_SETSETTINGRESIDENT, TRUE, ( LPARAM )path );
+
+ mir_snprintf( path, sizeof( path ), "%s/Mobile", yahooProtocolName );
+ CallService( MS_DB_SETSETTINGRESIDENT, TRUE, ( LPARAM )path );
+
+ mir_snprintf( path, sizeof( path ), "%s/YGMsg", yahooProtocolName );
+ CallService( MS_DB_SETSETTINGRESIDENT, TRUE, ( LPARAM )path );
+
+ mir_snprintf( path, sizeof( path ), "%s/IdleTS", yahooProtocolName );
+ CallService( MS_DB_SETSETTINGRESIDENT, TRUE, ( LPARAM )path );
+
+ mir_snprintf( path, sizeof( path ), "%s/PictLastCheck", yahooProtocolName );
+ CallService( MS_DB_SETSETTINGRESIDENT, TRUE, ( LPARAM )path );
+
+ mir_snprintf( path, sizeof( path ), "%s/PictLoading", yahooProtocolName );
+ CallService( MS_DB_SETSETTINGRESIDENT, TRUE, ( LPARAM )path );
+
+ // 1.
+ hHookModulesLoaded = HookEvent( ME_SYSTEM_MODULESLOADED, OnModulesLoaded );
+ // Create nudge event
+ lstrcpyn(tNudge, yahooProtocolName , sizeof( tNudge ) - 7);
+ lstrcat(tNudge, "/Nudge");
+ hYahooNudge = CreateHookableEvent(tNudge);
+
+ // 2.
+ ZeroMemory(&pd,sizeof(pd));
+ pd.cbSize=sizeof(pd);
+ pd.szName=yahooProtocolName;
+ pd.type=PROTOTYPE_PROTOCOL;
+ CallService(MS_PROTO_REGISTERMODULE,0,(LPARAM)&pd);
+
+ register_callbacks();
+ // 3.
+ yahoo_logoff_buddies();
+
+ SkinAddNewSoundEx(Translate( "mail" ), yahooProtocolName, "New E-mail available in Inbox" );
+
+ LoadYahooServices();
+
+ pthread_mutex_init(&connectionHandleMutex);
+ return 0;
+}
+
diff --git a/miranda-wine/protocols/Yahoo/options.c b/miranda-wine/protocols/Yahoo/options.c
new file mode 100644
index 0000000..32d7b06
--- /dev/null
+++ b/miranda-wine/protocols/Yahoo/options.c
@@ -0,0 +1,256 @@
+/*
+ * $Id: options.c 3640 2006-08-29 17:54:56Z gena01 $
+ *
+ * myYahoo Miranda Plugin
+ *
+ * Authors: Gennady Feldman (aka Gena01)
+ * Laurent Marechal (aka Peorth)
+ *
+ * This code is under GPL and is based on AIM, MSN and Miranda source code.
+ * I want to thank Robert Rainwater and George Hazan for their code and support
+ * and for answering some of my questions during development of this plugin.
+ */
+#include <windows.h>
+#include <shlwapi.h>
+
+#include "yahoo.h"
+#include "resource.h"
+
+#include <m_langpack.h>
+#include <m_utils.h>
+#include <m_options.h>
+#include <m_popup.h>
+
+#include "options.h"
+
+/*
+ * YahooOptInit - initialize/register our Options w/ Miranda.
+ */
+int YahooOptInit(WPARAM wParam,LPARAM lParam)
+{
+ OPTIONSDIALOGPAGE odp;
+
+ ZeroMemory(&odp, sizeof( odp ));
+ odp.cbSize = sizeof(odp);
+ odp.position = -790000000;
+ odp.hInstance = hinstance;
+ odp.pszTemplate = MAKEINTRESOURCE(IDD_OPT_YAHOO);
+ odp.pszTitle = Translate( yahooProtocolName );
+ odp.pszGroup = Translate("Network");
+ odp.flags = ODPF_BOLDGROUPS;
+ odp.nIDBottomSimpleControl = IDC_STYAHOOGROUP;
+ odp.pfnDlgProc = DlgProcYahooOpts;
+ YAHOO_CallService( MS_OPT_ADDPAGE, wParam,( LPARAM )&odp );
+
+ return 0;
+}
+
+/*
+ * DlgProcYahooOpts - Connection Options Dialog
+ */
+BOOL CALLBACK DlgProcYahooOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
+{
+ DBVARIANT dbv;
+ YList *l;
+
+ switch ( msg ) {
+ case WM_INITDIALOG:
+ TranslateDialogDefault( hwndDlg );
+
+ if ( !DBGetContactSetting( NULL, yahooProtocolName, YAHOO_LOGINID, &dbv )) {
+ SetDlgItemText(hwndDlg,IDC_HANDLE,dbv.pszVal);
+ DBFreeVariant(&dbv);
+ }
+
+ if ( !DBGetContactSetting( NULL, yahooProtocolName, "Nick", &dbv )) {
+ SetDlgItemText(hwndDlg,IDC_NICK,dbv.pszVal);
+ DBFreeVariant(&dbv);
+ }
+
+ if ( !DBGetContactSetting( NULL, yahooProtocolName, YAHOO_PASSWORD, &dbv )) {
+ //bit of a security hole here, since it's easy to extract a password from an edit box
+ YAHOO_CallService( MS_DB_CRYPT_DECODESTRING, strlen( dbv.pszVal )+1, ( LPARAM )dbv.pszVal );
+ SetDlgItemText( hwndDlg, IDC_PASSWORD, dbv.pszVal );
+ DBFreeVariant( &dbv );
+ }
+
+ if ( !DBGetContactSetting( NULL, yahooProtocolName, YAHOO_LOGINSERVER, &dbv )){
+ SetDlgItemText( hwndDlg, IDC_LOGINSERVER, dbv. pszVal );
+ DBFreeVariant( &dbv );
+ }
+ else SetDlgItemText( hwndDlg, IDC_LOGINSERVER, YAHOO_DEFAULT_LOGIN_SERVER );
+
+ SetDlgItemInt( hwndDlg, IDC_YAHOOPORT, YAHOO_GetWord( NULL, YAHOO_LOGINPORT, 5050 ), FALSE );
+
+ SetButtonCheck( hwndDlg, IDC_YAHOO_JAPAN, YAHOO_GetByte( "YahooJapan", 0 ) );
+ SetButtonCheck( hwndDlg, IDC_DISMAINMENU, YAHOO_GetByte( "DisableMainMenu", 0 ) );
+ SetButtonCheck( hwndDlg, IDC_USE_YAB, YAHOO_GetByte( "UseYAB", 1 ));
+ SetButtonCheck( hwndDlg, IDC_SHOW_AVATARS, YAHOO_GetByte( "ShowAvatars", 0 ));
+ SetButtonCheck( hwndDlg, IDC_MAIL_AUTOLOGIN, YAHOO_GetByte( "MailAutoLogin", 0 ));
+ SetButtonCheck( hwndDlg, IDC_DISABLEYAHOOMAIL, !YAHOO_GetByte( "DisableYahoomail", 0 ));
+ SetButtonCheck( hwndDlg, IDC_SHOW_ERRORS, YAHOO_GetByte( "ShowErrors", 1 ));
+
+ /* show our current ignore list */
+ l = (YList *)YAHOO_GetIgnoreList();
+ while (l != NULL) {
+ struct yahoo_buddy *b = (struct yahoo_buddy *) l->data;
+
+ //MessageBox(NULL, b->id, "ID", MB_OK);
+ SendMessage(GetDlgItem(hwndDlg,IDC_YIGN_LIST), LB_ADDSTRING, 0, (LPARAM)b->id);
+ l = l->next;
+ }
+ return TRUE;
+
+ case WM_COMMAND:
+ switch ( LOWORD( wParam )) {
+ case IDC_NEWYAHOOACCOUNTLINK:
+ YAHOO_CallService( MS_UTILS_OPENURL, 1,
+ YAHOO_GetByte( "YahooJapan", 0 )
+ ?(LPARAM)"http://edit.yahoo.co.jp/config/eval_register"
+ :(LPARAM)"http://edit.yahoo.com/config/eval_register" );
+ return TRUE;
+
+ case IDC_RESETSERVER:
+ SetDlgItemText( hwndDlg, IDC_LOGINSERVER, YAHOO_DEFAULT_LOGIN_SERVER );
+ SetDlgItemInt( hwndDlg, IDC_YAHOOPORT, 5050, FALSE );
+ SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
+ break;
+
+ case IDC_IGN_ADD:
+ {
+ char id[128];
+ int i;
+
+ if (!yahooLoggedIn) {
+ MessageBox(hwndDlg, Translate("You need to be connected to Yahoo to add to Ignore List."), Translate("Yahoo Ignore"), MB_OK| MB_ICONINFORMATION);
+ break;
+ }
+
+
+ i = GetDlgItemText( hwndDlg, IDC_YIGN_EDIT, id, sizeof( id ));
+
+ if (i < 3) {
+ MessageBox(hwndDlg, Translate("Please enter a valid buddy name to ignore."), Translate("Yahoo Ignore"), MB_OK| MB_ICONINFORMATION);
+ break;
+ }
+
+ i = SendMessage(GetDlgItem(hwndDlg,IDC_YIGN_LIST), LB_FINDSTRINGEXACT,(WPARAM) -1, (LPARAM)id);
+ if (i != LB_ERR ) {
+ MessageBox(hwndDlg, Translate("The buddy is already on your ignore list. "), Translate("Yahoo Ignore"), MB_OK | MB_ICONINFORMATION);
+ break;
+ }
+ YAHOO_IgnoreBuddy(id, 0);
+ SendMessage(GetDlgItem(hwndDlg,IDC_YIGN_LIST), LB_ADDSTRING, 0, (LPARAM)id);
+ SetDlgItemText( hwndDlg, IDC_YIGN_EDIT, "" );
+ }
+ break;
+
+ case IDC_IGN_REMOVE:
+ {
+ int i;
+ char id[128];
+
+ if (!yahooLoggedIn) {
+ MessageBox(hwndDlg, Translate("You need to be connected to Yahoo to remove from the Ignore List."), Translate("Yahoo Ignore"), MB_OK| MB_ICONINFORMATION);
+ break;
+ }
+
+ i = SendMessage(GetDlgItem(hwndDlg,IDC_YIGN_LIST), LB_GETCURSEL, 0, 0);
+ if (i == LB_ERR) {
+ MessageBox(hwndDlg, Translate("Please select a buddy on the ignore list to remove."), Translate("Yahoo Ignore"), MB_OK| MB_ICONINFORMATION);
+ break;
+ }
+
+ SendMessage(GetDlgItem(hwndDlg,IDC_YIGN_LIST), LB_GETTEXT, i, (LPARAM)id);
+
+ YAHOO_IgnoreBuddy(id, 1);
+ SendMessage(GetDlgItem(hwndDlg,IDC_YIGN_LIST), LB_DELETESTRING, i, 0);
+ }
+
+ break;
+ case IDC_YAHOO_JAPAN:
+ SetDlgItemText( hwndDlg, IDC_LOGINSERVER,
+ (IsDlgButtonChecked(hwndDlg,IDC_YAHOO_JAPAN)==BST_CHECKED)
+ ?YAHOO_DEFAULT_JAPAN_LOGIN_SERVER
+ :YAHOO_DEFAULT_LOGIN_SERVER );
+ // fall through and enable apply button
+
+ case IDC_DISMAINMENU:
+ case IDC_USE_YAB:
+ case IDC_SHOW_AVATARS:
+ case IDC_MAIL_AUTOLOGIN:
+ case IDC_SHOW_ERRORS:
+ case IDC_DISABLEYAHOOMAIL:
+ SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
+ break;
+ }
+
+ if ( HIWORD( wParam ) == EN_CHANGE && ( HWND )lParam == GetFocus())
+ switch( LOWORD( wParam )) {
+ case IDC_HANDLE:
+ case IDC_PASSWORD:
+ case IDC_LOGINSERVER:
+ case IDC_YAHOOPORT:
+ case IDC_NICK:
+ SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
+ }
+
+ break;
+
+
+
+ case WM_NOTIFY:
+ if (((LPNMHDR)lParam)->code == PSN_APPLY )
+ {
+ BOOL reconnectRequired = FALSE, restartRequired = FALSE;
+ char str[128];
+ char id[128];
+ DBVARIANT dbv;
+
+ GetDlgItemText( hwndDlg, IDC_HANDLE, id, sizeof( id ));
+ dbv.pszVal = NULL;
+
+ if ( DBGetContactSetting( NULL, yahooProtocolName, YAHOO_LOGINID, &dbv ) ||
+ lstrcmp( id, dbv.pszVal ))
+ reconnectRequired = TRUE;
+
+ if ( dbv.pszVal != NULL ) DBFreeVariant( &dbv );
+
+ YAHOO_SetString( NULL, YAHOO_LOGINID, id );
+
+ GetDlgItemText( hwndDlg, IDC_PASSWORD, str, sizeof( str ));
+ YAHOO_CallService( MS_DB_CRYPT_ENCODESTRING, sizeof( str ),( LPARAM )str );
+ dbv.pszVal = NULL;
+ if ( DBGetContactSetting( NULL, yahooProtocolName, YAHOO_PASSWORD, &dbv ) ||
+ lstrcmp( str, dbv.pszVal ))
+ reconnectRequired = TRUE;
+ if ( dbv.pszVal != NULL ) DBFreeVariant( &dbv );
+
+ YAHOO_SetString( NULL, YAHOO_PASSWORD, str );
+ GetDlgItemText( hwndDlg, IDC_NICK, str, sizeof( str ));
+ YAHOO_SetString( NULL, "Nick", str );
+
+ GetDlgItemText( hwndDlg, IDC_LOGINSERVER, str, sizeof( str ));
+ YAHOO_SetString( NULL, YAHOO_LOGINSERVER, str );
+
+ YAHOO_SetWord( NULL, YAHOO_LOGINPORT, GetDlgItemInt( hwndDlg, IDC_YAHOOPORT, NULL, FALSE ));
+
+ YAHOO_SetByte("YahooJapan", ( BYTE )IsDlgButtonChecked( hwndDlg, IDC_YAHOO_JAPAN ));
+ YAHOO_SetByte("DisableMainMenu", ( BYTE )IsDlgButtonChecked( hwndDlg, IDC_DISMAINMENU ));
+ YAHOO_SetByte("UseYAB", ( BYTE )IsDlgButtonChecked( hwndDlg, IDC_USE_YAB ));
+ YAHOO_SetByte("ShowAvatars", ( BYTE )IsDlgButtonChecked( hwndDlg, IDC_SHOW_AVATARS ));
+ YAHOO_SetByte("MailAutoLogin", ( BYTE )IsDlgButtonChecked( hwndDlg, IDC_MAIL_AUTOLOGIN ));
+ YAHOO_SetByte("DisableYahoomail", ( BYTE )!IsDlgButtonChecked( hwndDlg, IDC_DISABLEYAHOOMAIL ));
+ YAHOO_SetByte("ShowErrors", ( BYTE )IsDlgButtonChecked( hwndDlg, IDC_SHOW_ERRORS ));
+
+ if ( restartRequired )
+ MessageBox( hwndDlg, Translate( "The changes you have made require you to restart Miranda IM before they take effect"), Translate("YAHOO Options"), MB_OK );
+ else if ( reconnectRequired && yahooLoggedIn )
+ MessageBox( hwndDlg, Translate( "The changes you have made require you to reconnect to the Yahoo network before they take effect"), Translate("YAHOO Options"), MB_OK );
+
+ return TRUE;
+ }
+ break;
+ }
+ return FALSE;
+}
diff --git a/miranda-wine/protocols/Yahoo/options.h b/miranda-wine/protocols/Yahoo/options.h
new file mode 100644
index 0000000..345d0e2
--- /dev/null
+++ b/miranda-wine/protocols/Yahoo/options.h
@@ -0,0 +1,20 @@
+/*
+ * $Id: options.h 3640 2006-08-29 17:54:56Z gena01 $
+ *
+ * myYahoo Miranda Plugin
+ *
+ * Authors: Gennady Feldman (aka Gena01)
+ * Laurent Marechal (aka Peorth)
+ *
+ * This code is under GPL and is based on AIM, MSN and Miranda source code.
+ * I want to thank Robert Rainwater and George Hazan for their code and support
+ * and for answering some of my questions during development of this plugin.
+ */
+#ifndef _YAHOO_SEARCH_H_
+#define _YAHOO_SEARCH_H_
+
+BOOL CALLBACK DlgProcYahooOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam);
+//BOOL CALLBACK DlgProcYahooPopUpOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam);
+int YahooOptInit(WPARAM wParam,LPARAM lParam);
+
+#endif
diff --git a/miranda-wine/protocols/Yahoo/pthread.c b/miranda-wine/protocols/Yahoo/pthread.c
new file mode 100644
index 0000000..f979b0e
--- /dev/null
+++ b/miranda-wine/protocols/Yahoo/pthread.c
@@ -0,0 +1,75 @@
+/*
+ * $Id: pthread.c 2874 2006-05-16 21:38:00Z ghazan $
+ *
+ * myYahoo Miranda Plugin
+ *
+ * Authors: Gennady Feldman (aka Gena01)
+ * Laurent Marechal (aka Peorth)
+ *
+ * Code borrowed for myYahoo plugin. Fixed to compile on Mingw by G.Feldman
+ * Original Copyright (c) 2003 Robert Rainwater
+ *
+ * This code is under GPL and is based on AIM, MSN and Miranda source code.
+ * I want to thank Robert Rainwater and George Hazan for their code and support
+ * and for answering some of my questions during development of this plugin.
+ */
+#include "yahoo.h"
+#include <process.h>
+#include <m_system.h>
+
+/* Gena01 - added some defined to fix compilation with mingw gcc */
+/* __try/__finally taken from abiword patch found on the web */
+#ifdef __GNUC__
+
+#if 0
+ #include <crtdbg.h>
+#else
+#define __try
+#define __except(x) if (0) /* don't execute handler */
+#define __finally
+
+#define _try __try
+#define _except __except
+#define _finally __finally
+#endif
+
+#endif
+
+#include <excpt.h>
+
+struct pthread_arg
+{
+ HANDLE hEvent;
+ void (*threadcode) (void *);
+ void *arg;
+};
+
+void pthread_r(struct pthread_arg *fa)
+{
+ void (*callercode) (void *) = fa->threadcode;
+ void *arg = fa->arg;
+ CallService(MS_SYSTEM_THREAD_PUSH, 0, 0);
+ SetEvent(fa->hEvent);
+ __try {
+ callercode(arg);
+ }
+ __finally {
+ CallService(MS_SYSTEM_THREAD_POP, 0, 0);
+ }
+}
+
+unsigned long pthread_create(void (*threadcode) (void *), void *arg)
+{
+ unsigned long rc;
+ struct pthread_arg fa;
+ fa.hEvent = CreateEvent(NULL, FALSE, FALSE, NULL);
+ fa.threadcode = threadcode;
+ fa.arg = arg;
+ rc = _beginthread((void *) (void *) pthread_r, 0, &fa);
+ if ((unsigned long) -1L != rc) {
+ WaitForSingleObject(fa.hEvent, INFINITE);
+ }
+ CloseHandle(fa.hEvent);
+ return rc;
+}
+
diff --git a/miranda-wine/protocols/Yahoo/pthread.h b/miranda-wine/protocols/Yahoo/pthread.h
new file mode 100644
index 0000000..e3a769a
--- /dev/null
+++ b/miranda-wine/protocols/Yahoo/pthread.h
@@ -0,0 +1,26 @@
+/*
+ * $Id: pthread.h 2874 2006-05-16 21:38:00Z ghazan $
+ *
+ * myYahoo Miranda Plugin
+ *
+ * Authors: Gennady Feldman (aka Gena01)
+ * Laurent Marechal (aka Peorth)
+ *
+ * Code borrowed for myYahoo plugin. Fixed to compile on Mingw by G.Feldman
+ * Original Copyright (c) 2003 Robert Rainwater
+ *
+ * This code is under GPL and is based on AIM, MSN and Miranda source code.
+ * I want to thank Robert Rainwater and George Hazan for their code and support
+ * and for answering some of my questions during development of this plugin.
+ */
+#ifndef PTHREAD_H
+#define PTHREAD_H
+
+unsigned long pthread_create(void (*threadcode) (void *), void *arg);
+typedef CRITICAL_SECTION pthread_mutex_t;
+#define pthread_mutex_init(pmutex) InitializeCriticalSection(pmutex)
+#define pthread_mutex_destroy(pmutex) DeleteCriticalSection(pmutex)
+#define pthread_mutex_lock(pmutex) EnterCriticalSection(pmutex)
+#define pthread_mutex_unlock(pmutex) LeaveCriticalSection(pmutex)
+
+#endif
diff --git a/miranda-wine/protocols/Yahoo/resource.h b/miranda-wine/protocols/Yahoo/resource.h
new file mode 100644
index 0000000..4c4451b
--- /dev/null
+++ b/miranda-wine/protocols/Yahoo/resource.h
@@ -0,0 +1,70 @@
+/*
+ * $Id: resource.h 3465 2006-08-06 01:26:35Z gena01 $
+ *
+ * myYahoo Miranda Plugin
+ *
+ * Authors: Gennady Feldman (aka Gena01)
+ * Laurent Marechal (aka Peorth)
+ *
+ * This code is under GPL and is based on AIM, MSN and Miranda source code.
+ * I want to thank Robert Rainwater and George Hazan for their code and support
+ * and for answering some of my questions during development of this plugin.
+ */
+
+//#define IDI_ICON1 101
+#define IDI_MAIN 101
+#define IDI_YAHOO 102
+#define IDI_INBOX 103
+#define IDI_PROFILE 104
+#define IDI_REFRESH 105
+#define IDI_YAB 106
+#define IDI_SET_STATUS 107
+#define IDI_CALENDAR 108
+
+#define IDD_OPT_YAHOO 185
+#define IDD_SETCUSTSTAT 186
+#define IDD_OPT_YAHOO_POPUP 187
+#define IDC_CUSTSTATBUSY 1000
+#define IDC_CUSTSTAT 1001
+#define IDC_STYAHOOGROUP 1002
+#define IDC_EDIT1 1003
+#define IDC_STIGNGROUP 1004
+#define IDC_USEWINCOLORS 1008
+#define IDC_YCHECKMAIL 1011
+#define IDC_YTNOTIF 1012
+#define IDC_PASSWORD 1020
+#define IDC_NICK 1021
+#define IDC_HANDLE 1022
+#define IDC_BGCOLOUR 1026
+#define IDC_TEXTCOLOUR 1028
+#define IDC_PREVIEW 1030
+#define IDC_DEBUG 1050
+#define IDC_POPUP_TIMEOUT 1051
+#define IDC_LOGINSERVER 1171
+#define IDC_YAHOOPORT 1174
+#define IDC_DISABLEYAHOOMAIL 1301
+#define IDC_NEWYAHOOACCOUNTLINK 1438
+#define IDC_RESETSERVER 1472
+#define IDC_DISMAINMENU 1475
+#define IDC_USE_YAB 1477
+#define IDC_SHOW_ERRORS 1478
+#define IDC_SHOW_AVATARS 1479
+#define IDC_MAIL_AUTOLOGIN 1480
+#define IDC_YAHOO_JAPAN 1481
+
+#define IDD_OPT_YAHOO_IGNORE 201
+#define IDC_YIGN_EDIT 202
+#define IDC_YIGN_LIST 203
+#define IDC_IGN_ADD 204
+#define IDC_IGN_REMOVE 205
+
+#define IDD_INFO_AVATAR 300
+#define IDC_AVATAR 301
+#define IDC_SETAVATAR 302
+#define IDC_DELETEAVATAR 303
+#define IDC_SHARE_AVATAR 304
+
+/*
+ *
+ */
+#define IDC_STATIC -1
diff --git a/miranda-wine/protocols/Yahoo/search.c b/miranda-wine/protocols/Yahoo/search.c
new file mode 100644
index 0000000..7a06df8
--- /dev/null
+++ b/miranda-wine/protocols/Yahoo/search.c
@@ -0,0 +1,121 @@
+/*
+ * $Id: search.c 3659 2006-08-30 19:43:41Z gena01 $
+ *
+ * myYahoo Miranda Plugin
+ *
+ * Authors: Gennady Feldman (aka Gena01)
+ * Laurent Marechal (aka Peorth)
+ *
+ * This code is under GPL and is based on AIM, MSN and Miranda source code.
+ * I want to thank Robert Rainwater and George Hazan for their code and support
+ * and for answering some of my questions during development of this plugin.
+ */
+#include "yahoo.h"
+#include <m_protosvc.h>
+#include <m_langpack.h>
+#include <m_message.h>
+
+extern yahoo_local_account * ylad;
+
+//=======================================================
+//Search for user
+//=======================================================
+static void __cdecl yahoo_search_simplethread(void *snsearch)
+{
+ PROTOSEARCHRESULT psr;
+
+/* if (aim_util_isme(sn)) {
+ ProtoBroadcastAck(AIM_PROTO, NULL, ACKTYPE_SEARCH, ACKRESULT_SUCCESS, (HANDLE) 1, 0);
+ return;
+ }
+ */
+ ZeroMemory(&psr, sizeof(psr));
+ psr.cbSize = sizeof(psr);
+ psr.nick = (char *)snsearch;
+ //psr.email = (char *)snsearch;
+
+ //void yahoo_search(int id, enum yahoo_search_type t, const char *text, enum yahoo_search_gender g, enum yahoo_search_agerange ar,
+ // int photo, int yahoo_only)
+
+ YAHOO_SendBroadcast(NULL, ACKTYPE_SEARCH, ACKRESULT_DATA, (HANDLE) 1, (LPARAM) & psr);
+ //YAHOO_SendBroadcast(NULL, ACKTYPE_SEARCH, ACKRESULT_SUCCESS, (HANDLE) 1, 0);
+}
+
+static void yahoo_search_simple(const char *nick)
+{
+ static char m[255];
+ char *c;
+
+ c = strchr(nick, '@');
+
+ if (c != NULL){
+ int l = c - nick;
+
+ strncpy(m, nick, l);
+ m[l] = '\0';
+ }else
+ strcpy(m, nick);
+
+ //YAHOO_basicsearch(nick);
+ yahoo_search(ylad->id, YAHOO_SEARCH_YID, nick, YAHOO_GENDER_NONE, YAHOO_AGERANGE_NONE, 0, 1);
+
+ pthread_create(yahoo_search_simplethread, (void *) m);
+}
+
+int YahooBasicSearch(WPARAM wParam,LPARAM lParam)
+{
+ if ( !yahooLoggedIn )
+ return 0;
+
+ yahoo_search_simple((char *) lParam);
+ return 1;
+}
+
+void ext_yahoo_got_search_result(int id, int found, int start, int total, YList *contacts)
+{
+ PROTOSEARCHRESULT psr;
+ struct yahoo_found_contact *yct=NULL;
+ char *c;
+ int i=start;
+ YList *en=contacts;
+
+ LOG(("got search result: "));
+
+ LOG(("ID: %d", id));
+ LOG(("Found: %d", found));
+ LOG(("Start: %d", start));
+ LOG(("Total: %d", total));
+
+ ZeroMemory(&psr, sizeof(psr));
+ psr.cbSize = sizeof(psr);
+
+ while (en) {
+ yct = en->data;
+
+ if (yct == NULL) {
+ LOG(("[%d] Empty record?",i++));
+ } else {
+ LOG(("[%d] id: '%s', online: %d, age: %d, sex: '%s', location: '%s'", i++, yct->id, yct->online, yct->age, yct->gender, yct->location));
+ psr.nick = (char *)yct->id;
+ c = (char *)malloc(10);
+
+ if (yct->gender[0] != 5)
+ psr.firstName = yct->gender;
+
+ if (yct->age > 0) {
+ itoa(yct->age, c,10);
+ psr.lastName = (char *)c;
+ }
+
+ if (yct->location[0] != 5)
+ psr.email = (char *)yct->location;
+
+ //void yahoo_search(int id, enum yahoo_search_type t, const char *text, enum yahoo_search_gender g, enum yahoo_search_agerange ar,
+ // int photo, int yahoo_only)
+
+ YAHOO_SendBroadcast(NULL, ACKTYPE_SEARCH, ACKRESULT_DATA, (HANDLE) 1, (LPARAM) & psr);
+ }
+ en = y_list_next(en);
+ }
+ YAHOO_SendBroadcast(NULL, ACKTYPE_SEARCH, ACKRESULT_SUCCESS, (HANDLE) 1, 0);
+}
diff --git a/miranda-wine/protocols/Yahoo/search.h b/miranda-wine/protocols/Yahoo/search.h
new file mode 100644
index 0000000..ba347a2
--- /dev/null
+++ b/miranda-wine/protocols/Yahoo/search.h
@@ -0,0 +1,19 @@
+/*
+ * $Id: search.h 3640 2006-08-29 17:54:56Z gena01 $
+ *
+ * myYahoo Miranda Plugin
+ *
+ * Authors: Gennady Feldman (aka Gena01)
+ * Laurent Marechal (aka Peorth)
+ *
+ * This code is under GPL and is based on AIM, MSN and Miranda source code.
+ * I want to thank Robert Rainwater and George Hazan for their code and support
+ * and for answering some of my questions during development of this plugin.
+ */
+#ifndef _YAHOO_SEARCH_H_
+#define _YAHOO_SEARCH_H_
+
+int YahooBasicSearch(WPARAM wParam,LPARAM lParam);
+void ext_yahoo_got_search_result(int id, int found, int start, int total, YList *contacts);
+
+#endif
diff --git a/miranda-wine/protocols/Yahoo/server.c b/miranda-wine/protocols/Yahoo/server.c
new file mode 100644
index 0000000..83d67e4
--- /dev/null
+++ b/miranda-wine/protocols/Yahoo/server.c
@@ -0,0 +1,221 @@
+/*
+ * $Id: server.c 3699 2006-09-04 18:01:00Z gena01 $
+ *
+ * myYahoo Miranda Plugin
+ *
+ * Authors: Gennady Feldman (aka Gena01)
+ * Laurent Marechal (aka Peorth)
+ *
+ * This code is under GPL and is based on AIM, MSN and Miranda source code.
+ * I want to thank Robert Rainwater and George Hazan for their code and support
+ * and for answering some of my questions during development of this plugin.
+ */
+#include <windows.h>
+#include "yahoo.h"
+#include <m_system.h>
+#include <time.h>
+
+int poll_loop = 1;
+long lLastSend;
+extern YList *connections;
+
+int PASCAL send(SOCKET s, const char FAR *buf, int len, int flags)
+{
+ int rlen;
+ //LOG(("send socket: %d, %d bytes", s, len));
+
+ if (yahooStatus == ID_STATUS_OFFLINE) {
+ LOG(("WARNING: WE OFFLINE ALREADY!!"));
+ //return 0;
+ }
+
+ rlen = Netlib_Send((HANDLE)s, buf, len, 0);
+
+#ifdef HTTP_GATEWAY
+ if (iHTTPGateway)
+ lLastSend = time(NULL);
+#endif
+
+ if (rlen == SOCKET_ERROR) {
+ LOG(("SEND Error."));
+ return -1;
+ }
+
+ return len;
+}
+
+int PASCAL recv(SOCKET s, char FAR *buf, int len, int flags)
+{
+ int RecvResult;
+ //LOG(("Recv socket: %d", s));
+ if (yahooStatus == ID_STATUS_OFFLINE)
+ LOG(("WARNING:WE ARE OFFLINE!!"));
+
+ RecvResult = Netlib_Recv((HANDLE)s, buf, len, (len == 1) ? MSG_NODUMP : 0);
+
+ //LOG(("Got bytes: %d, len: %d", RecvResult, len));
+ if (RecvResult == SOCKET_ERROR) {
+ LOG(("Receive error on socket: %d", s));
+ return -1;
+ }
+
+ return RecvResult;
+}
+
+extern yahoo_local_account * ylad;
+
+void __cdecl yahoo_server_main(void *empty)
+{
+ int status = (int) empty;
+ long lLastPing;
+ YList *l;
+ NETLIBSELECTEX nls = {0};
+
+ if (hNetlibUser == 0) {
+ /* wait for the stupid netlib to load!!!! */
+ int i;
+
+ for (i = 0; (i < 3) && (hNetlibUser == 0); i++)
+ SleepEx(30, TRUE);
+
+ }
+
+ YAHOO_DebugLog("Server Thread Starting status: %d", status);
+
+ do_yahoo_debug=YAHOO_LOG_DEBUG;
+ yahoo_set_log_level(do_yahoo_debug);
+
+ //YAHOO_DebugLog("Before Yahoo Login Need Status: %d", status);
+ poll_loop = 1; /* set this so we start looping */
+
+ ext_yahoo_login(status);
+
+ lLastPing = time(NULL);
+ {
+ int recvResult, ridx = 0, widx = 0, i;
+
+ while (poll_loop) {
+ nls.cbSize = sizeof(nls);
+ nls.dwTimeout = 1000; // 1000 millis = 1 sec
+
+ FD_ZERO(&nls.hReadStatus);
+ FD_ZERO(&nls.hWriteStatus);
+ FD_ZERO(&nls.hExceptStatus);
+ nls.hExceptConns[0] = NULL;
+ ridx = 0; widx = 0;
+
+ for(l=connections; l; ) {
+ struct _conn *c = l->data;
+ //LOG(("Connection tag:%d id:%d fd:%d remove:%d", c->tag, c->id, c->fd, c->remove));
+ if(c->remove) {
+ YList *n = y_list_next(l);
+ //LOG(("Removing id:%d fd:%d tag:%d", c->id, c->fd, c->tag));
+ connections = y_list_remove_link(connections, l);
+ y_list_free_1(l);
+ FREE(c);
+ l=n;
+ } else {
+ if(c->cond & YAHOO_INPUT_READ)
+ nls.hReadConns[ridx++] = (HANDLE)c->fd;
+
+ if(c->cond & YAHOO_INPUT_WRITE)
+ nls.hWriteConns[widx++] =(HANDLE) c->fd;
+
+ l = y_list_next(l);
+ }
+ }
+
+ //YAHOO_DebugLog("[Yahoo_Server] ridx:%d widx:%d", ridx, widx);
+
+ nls.hReadConns[ridx] = NULL;
+ nls.hWriteConns[widx] = NULL;
+
+ if (connections == NULL){
+ YAHOO_DebugLog("Last connection closed.");
+ break;
+ }
+ recvResult = CallService(MS_NETLIB_SELECTEX, (WPARAM) 0, (LPARAM)&nls);
+
+ /* Check for Miranda Exit Status */
+ if (Miranda_Terminated()) {
+ YAHOO_DebugLog("Miranda Exiting... stopping the loop.");
+ break;
+ }
+
+ /* do the timer check */
+ if (ylad != NULL) {
+#ifdef HTTP_GATEWAY
+ //YAHOO_DebugLog("HTTPGateway: %d", iHTTPGateway);
+ if (!iHTTPGateway) {
+#endif
+ if (yahooLoggedIn && time(NULL) - lLastPing > 60) {
+ LOG(("[TIMER] Sending a keep alive message"));
+ yahoo_keepalive(ylad->id);
+
+ lLastPing = time(NULL);
+ }
+#ifdef HTTP_GATEWAY
+ } else {
+ YAHOO_DebugLog("[SERVER] Got packets: %d", ylad->rpkts);
+
+ if ( yahooLoggedIn && ( (ylad->rpkts > 0 && (time(NULL) - lLastSend) >=3) ||
+ ( (time(NULL) - lLastSend) >= 13) ) ) {
+
+ LOG(("[TIMER] Sending an idle message..."));
+ yahoo_send_idle_packet(ylad->id);
+ }
+
+ //
+ // need to sleep, cause netlibselectex is too fast?
+ //
+ SleepEx(500, TRUE);
+ }
+#endif
+ }
+ /* do the timer check ends */
+
+ for(l = connections; l; l = y_list_next(l)) {
+ struct _conn *c = l->data;
+
+ if (c->remove)
+ continue;
+
+ for (i = 0; i < ridx; i++) {
+ if ((HANDLE)c->fd == nls.hReadConns[i]) {
+ if (nls.hReadStatus[i])
+ yahoo_callback(c, YAHOO_INPUT_READ);
+ }//if c->fd=
+ }//for i = 0
+
+ for (i = 0; i < widx; i++) {
+ if ((HANDLE)c->fd == nls.hWriteConns[i]) {
+ if (nls.hWriteStatus[i])
+ yahoo_callback(c, YAHOO_INPUT_WRITE);
+ } // if c->fd == nls
+ }// for i = 0
+ }// for l=connections
+
+ }
+ YAHOO_DebugLog("Exited loop");
+ }
+
+ /* need to logout first */
+ yahoo_logout();
+
+ /* cleanup the data stuff and close our connection handles */
+ while(connections) {
+ YList *tmp = connections;
+ struct _conn * c = connections->data;
+ Netlib_CloseHandle((HANDLE)c->fd);
+ FREE(c);
+ connections = y_list_remove_link(connections, connections);
+ y_list_free_1(tmp);
+ }
+
+ /* now set ourselves to offline */
+ yahoo_util_broadcaststatus(ID_STATUS_OFFLINE);
+ yahoo_logoff_buddies();
+
+ YAHOO_DebugLog("Server thread ending");
+}
+
diff --git a/miranda-wine/protocols/Yahoo/services.c b/miranda-wine/protocols/Yahoo/services.c
new file mode 100644
index 0000000..df39017
--- /dev/null
+++ b/miranda-wine/protocols/Yahoo/services.c
@@ -0,0 +1,1134 @@
+/*
+ * $Id: services.c 3707 2006-09-05 20:47:58Z gena01 $
+ *
+ * myYahoo Miranda Plugin
+ *
+ * Authors: Gennady Feldman (aka Gena01)
+ * Laurent Marechal (aka Peorth)
+ *
+ * This code is under GPL and is based on AIM, MSN and Miranda source code.
+ * I want to thank Robert Rainwater and George Hazan for their code and support
+ * and for answering some of my questions during development of this plugin.
+ */
+#include <malloc.h>
+#include <time.h>
+
+#include "yahoo.h"
+
+#include <m_system.h>
+#include <m_protomod.h>
+#include <m_protosvc.h>
+#include <m_langpack.h>
+#include <m_skin.h>
+#include <m_utils.h>
+#include <m_options.h>
+#include <m_popup.h>
+#include <m_idle.h>
+
+#include "avatar.h"
+#include "resource.h"
+#include "file_transfer.h"
+#include "im.h"
+#include "search.h"
+
+void yahoo_logoff_buddies()
+{
+ //set all contacts to 'offline'
+ HANDLE hContact = ( HANDLE )YAHOO_CallService( MS_DB_CONTACT_FINDFIRST, 0, 0 );
+ while ( hContact != NULL )
+ {
+ if ( !lstrcmp( yahooProtocolName, ( char* )YAHOO_CallService( MS_PROTO_GETCONTACTBASEPROTO, ( WPARAM )hContact,0 ))) {
+ YAHOO_SetWord( hContact, "Status", ID_STATUS_OFFLINE );
+ DBWriteContactSettingDword(hContact, yahooProtocolName, "IdleTS", 0);
+ DBWriteContactSettingDword(hContact, yahooProtocolName, "PictLastCheck", 0);
+ DBWriteContactSettingDword(hContact, yahooProtocolName, "PictLoading", 0);
+ DBDeleteContactSetting(hContact, "CList", "StatusMsg" );
+ DBDeleteContactSetting(hContact, yahooProtocolName, "YMsg" );
+ DBDeleteContactSetting(hContact, yahooProtocolName, "YGMsg" );
+ //DBDeleteContactSetting(hContact, yahooProtocolName, "MirVer" );
+ }
+
+ hContact = ( HANDLE )YAHOO_CallService( MS_DB_CONTACT_FINDNEXT,( WPARAM )hContact, 0 );
+ }
+}
+
+
+//=======================================================
+//GetCaps
+//=======================================================
+int GetCaps(WPARAM wParam,LPARAM lParam)
+{
+ int ret = 0;
+ switch (wParam) {
+ case PFLAGNUM_1:
+ ret = PF1_IM | PF1_ADDED | PF1_AUTHREQ | PF1_MODEMSGRECV | PF1_MODEMSGSEND | PF1_BASICSEARCH
+ | PF1_FILESEND | PF1_FILERECV| PF1_VISLIST;
+// | PF1_SERVERCLIST ;
+ break;
+
+ case PFLAGNUM_2:
+ ret = PF2_ONLINE | PF2_SHORTAWAY | PF2_LONGAWAY | PF2_ONTHEPHONE |
+ PF2_OUTTOLUNCH | PF2_INVISIBLE | PF2_LIGHTDND | PF2_HEAVYDND;
+ break;
+
+ case PFLAGNUM_3:
+ ret = PF2_ONLINE | PF2_SHORTAWAY | PF2_LONGAWAY | PF2_ONTHEPHONE |
+ PF2_OUTTOLUNCH | /*PF2_INVISIBLE |*/ PF2_LIGHTDND | PF2_HEAVYDND;
+ break;
+
+ case PFLAGNUM_4:
+ ret = PF4_FORCEAUTH|PF4_FORCEADDED|PF4_SUPPORTTYPING|PF4_SUPPORTIDLE| PF4_AVATARS;
+ break;
+ case PFLAG_UNIQUEIDTEXT:
+ ret = (int) Translate("ID");
+ break;
+ case PFLAG_UNIQUEIDSETTING:
+ ret = (int) YAHOO_LOGINID;
+ break;
+ case PFLAG_MAXLENOFMESSAGE:
+ ret = 800; /* STUPID YAHOO!!! */
+ break;
+
+ }
+ return ret;
+
+}
+
+//=======================================================
+//GetName
+//=======================================================
+int GetName(WPARAM wParam,LPARAM lParam)
+{
+ lstrcpyn((char*)lParam, yahooProtocolName, wParam);
+ return 0;
+}
+
+//=======================================================
+//YahooLoadIcon
+//=======================================================
+int YahooLoadIcon(WPARAM wParam,LPARAM lParam)
+{
+ UINT id;
+
+ switch(wParam&0xFFFF) {
+ case PLI_PROTOCOL: id=IDI_MAIN; break; // IDI_MAIN is the main icon for the protocol
+ default: return (int)(HICON)NULL;
+ }
+ return (int)LoadImage(hinstance,MAKEINTRESOURCE(id),IMAGE_ICON,GetSystemMetrics(wParam&PLIF_SMALL?SM_CXSMICON:SM_CXICON),GetSystemMetrics(wParam&PLIF_SMALL?SM_CYSMICON:SM_CYICON),0);
+}
+
+//=======================================================
+//GetStatus
+//=======================================================
+int GetStatus(WPARAM wParam,LPARAM lParam)
+{
+ return yahooStatus;
+}
+
+extern yahoo_local_account *ylad;
+
+int gStartStatus = ID_STATUS_ONLINE;
+char *szStartMsg = NULL;
+
+//=======================================================
+//SetStatus
+//=======================================================
+int SetStatus(WPARAM wParam,LPARAM lParam)
+{
+ int status = (int) wParam;
+
+ //if (yahooStatus == status)
+ // return 0;
+
+ YAHOO_DebugLog("[SetStatus] New status %s", (char *) CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION, status, 0));
+ if (status == ID_STATUS_OFFLINE) {
+ yahoo_logout();
+
+ yahoo_util_broadcaststatus(ID_STATUS_OFFLINE);
+ yahoo_logoff_buddies();
+ }
+ else if (!yahooLoggedIn) {
+ DBVARIANT dbv;
+ int err = 0;
+ char errmsg[80];
+
+ if (yahooStatus == ID_STATUS_CONNECTING)
+ return 0;
+
+ YAHOO_utils_logversion();
+
+ ylad = y_new0(yahoo_local_account, 1);
+
+ /*
+ * Load Yahoo ID form the database.
+ */
+ if (!DBGetContactSetting(NULL, yahooProtocolName, YAHOO_LOGINID, &dbv)) {
+ if (lstrlen(dbv.pszVal) > 0) {
+ lstrcpyn(ylad->yahoo_id, dbv.pszVal, 255);
+ } else
+ err++;
+ DBFreeVariant(&dbv);
+ } else
+ err++;
+
+ if (err) {
+ lstrcpyn(errmsg, Translate("Please enter your yahoo id in Options/Network/Yahoo"), 80);
+ } else {
+ if (!DBGetContactSetting(NULL, yahooProtocolName, YAHOO_PASSWORD, &dbv)) {
+ CallService(MS_DB_CRYPT_DECODESTRING, lstrlen(dbv.pszVal) + 1, (LPARAM) dbv.pszVal);
+ if (lstrlen(dbv.pszVal) > 0) {
+ lstrcpyn(ylad->password, dbv.pszVal, 255);
+ } else
+ err++;
+
+ DBFreeVariant(&dbv);
+ } else
+ err++;
+
+ if (err) {
+ lstrcpyn(errmsg, Translate("Please enter your yahoo password in Options/Network/Yahoo"), 80);
+ }
+ }
+
+ if (err != 0){
+ FREE(ylad);
+ ylad = NULL;
+ yahoo_util_broadcaststatus(ID_STATUS_OFFLINE);
+
+ YAHOO_ShowError(Translate("Yahoo Login Error"), errmsg);
+ return 0;
+ }
+
+ if (status == ID_STATUS_OFFLINE)
+ status = ID_STATUS_ONLINE;
+
+ //DBWriteContactSettingWord(NULL, yahooProtocolName, "StartupStatus", status);
+ gStartStatus = status;
+
+ yahoo_util_broadcaststatus(ID_STATUS_CONNECTING);
+
+ status = (status == ID_STATUS_INVISIBLE) ? YAHOO_STATUS_INVISIBLE: YAHOO_STATUS_AVAILABLE;
+ pthread_create(yahoo_server_main, (void *) status );
+
+ //start_timer();
+ } else if (status == ID_STATUS_INVISIBLE){ /* other normal away statuses are set via setaway */
+ yahoo_util_broadcaststatus(status);
+ yahoo_set_status(yahooStatus,NULL,(yahooStatus != ID_STATUS_ONLINE) ? 1 : 0);
+ } else {
+ /* clear out our message just in case, STUPID AA! */
+ if (szStartMsg) free(szStartMsg);
+
+ szStartMsg = NULL;
+
+ /* now tell miranda that we are Online, don't tell Yahoo server yet though! */
+ yahoo_util_broadcaststatus(status);
+ }
+ return 0;
+}
+
+//=======================================================
+//Broadcast the user status
+//=======================================================
+void yahoo_util_broadcaststatus(int s)
+{
+ int oldStatus = yahooStatus;
+ if (oldStatus == s)
+ return;
+
+ yahooStatus = s;
+
+ YAHOO_DebugLog("[yahoo_util_broadcaststatus] Old Status: %s (%d), New Status: %s (%d)",
+ NEWSTR_ALLOCA((char *) CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION, oldStatus, 0)), oldStatus,
+ NEWSTR_ALLOCA((char *) CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION, yahooStatus, 0)), yahooStatus);
+ ProtoBroadcastAck(yahooProtocolName, NULL, ACKTYPE_STATUS, ACKRESULT_SUCCESS, (HANDLE) oldStatus, (LPARAM)yahooStatus);
+}
+
+static int YahooContactDeleted( WPARAM wParam, LPARAM lParam )
+{
+ char* szProto;
+ DBVARIANT dbv;
+
+ YAHOO_DebugLog("[YahooContactDeleted]");
+
+ if ( !yahooLoggedIn ) {//should never happen for Yahoo contacts
+ YAHOO_DebugLog("[YahooContactDeleted] We are not Logged On!!!");
+ return 0;
+ }
+
+ szProto = ( char* )YAHOO_CallService( MS_PROTO_GETCONTACTBASEPROTO, wParam, 0 );
+ if ( szProto == NULL || lstrcmp( szProto, yahooProtocolName )) {
+ YAHOO_DebugLog("[YahooContactDeleted] Not a Yahoo Contact!!!");
+ return 0;
+ }
+
+ // he is not a permanent contact!
+ if (DBGetContactSettingByte(( HANDLE )wParam, "CList", "NotOnList", 0) != 0) {
+ YAHOO_DebugLog("[YahooContactDeleted] Not a permanent buddy!!!");
+ return 0;
+ }
+
+ if ( !DBGetContactSetting(( HANDLE )wParam, yahooProtocolName, YAHOO_LOGINID, &dbv )){
+ YAHOO_DebugLog("[YahooContactDeleted] Removing %s", dbv.pszVal);
+ YAHOO_remove_buddy(dbv.pszVal);
+
+ DBFreeVariant( &dbv );
+ } else {
+ YAHOO_DebugLog("[YahooContactDeleted] Can't retrieve contact Yahoo ID");
+ }
+ return 0;
+}
+
+int YahooSendAuthRequest(WPARAM wParam,LPARAM lParam)
+{
+ YAHOO_DebugLog("[YahooSendAuthRequest]");
+
+ if (lParam && yahooLoggedIn){
+
+ CCSDATA *ccs = (CCSDATA *)lParam;
+
+ if (ccs->hContact){
+
+ DBVARIANT dbv;
+
+ if (!DBGetContactSetting(ccs->hContact, yahooProtocolName, YAHOO_LOGINID, &dbv )) {
+ char *c = NULL;
+
+ if ( ccs->lParam )
+ c = (char *)ccs->lParam;
+
+ YAHOO_DebugLog("Adding buddy:%s Auth:%s", dbv.pszVal, c);
+ YAHOO_add_buddy(dbv.pszVal, "miranda", c);
+ YAHOO_SetString(ccs->hContact, "YGroup", "miranda");
+ DBFreeVariant( &dbv );
+
+ return 0; // Success
+
+ }
+
+ }
+
+ }
+
+ return 1; // Failure
+}
+
+int YahooAddToList(WPARAM wParam,LPARAM lParam)
+{
+ PROTOSEARCHRESULT *psr=(PROTOSEARCHRESULT*)lParam;
+ HANDLE hContact;
+
+ YAHOO_DebugLog("[YahooAddToList]");
+
+ if (!yahooLoggedIn){
+ YAHOO_DebugLog("[YahooAddToList] WARNING: WE ARE OFFLINE!");
+ return 0;
+ }
+
+ if (psr == NULL || psr->cbSize != sizeof( PROTOSEARCHRESULT )) {
+ YAHOO_DebugLog("[YahooAddToList] Empty data passed?");
+ return 0;
+ }
+
+
+
+ hContact = getbuddyH(psr->nick);
+ if (hContact != NULL) {
+ if (DBGetContactSettingByte(hContact, "CList", "NotOnList", 0)) {
+ YAHOO_DebugLog("[YahooAddToList] Temporary Buddy:%s already on our buddy list", psr->nick);
+ //return 0;
+ } else {
+ YAHOO_DebugLog("[YahooAddToList] Buddy:%s already on our buddy list", psr->nick);
+ return 0;
+ }
+ } else if (wParam & PALF_TEMPORARY ) { /* not on our list */
+ YAHOO_DebugLog("[YahooAddToList] Adding Temporary Buddy:%s ", psr->nick);
+ }
+
+ YAHOO_DebugLog("Adding buddy:%s", psr->nick);
+ return (int)add_buddy(psr->nick, psr->nick, wParam);
+}
+
+int YahooAddToListByEvent(WPARAM wParam,LPARAM lParam)
+{
+ DBEVENTINFO dbei;
+ char* nick;
+ HANDLE hContact;
+
+ YAHOO_DebugLog("[YahooAddToListByEvent]");
+ if ( !yahooLoggedIn )
+ return 0;
+
+
+ memset( &dbei, 0, sizeof( dbei ));
+ dbei.cbSize = sizeof( dbei );
+
+ if (( dbei.cbBlob = YAHOO_CallService( MS_DB_EVENT_GETBLOBSIZE, lParam, 0 )) == -1 ) {
+ YAHOO_DebugLog("[YahooAddToListByEvent] ERROR: Can't get blob size.");
+ return 0;
+ }
+
+ YAHOO_DebugLog("[YahooAddToListByEvent] Got blob size: %lu", dbei.cbBlob);
+ dbei.pBlob = ( PBYTE )_alloca( dbei.cbBlob );
+ if ( YAHOO_CallService( MS_DB_EVENT_GET, lParam, ( LPARAM )&dbei )) {
+ YAHOO_DebugLog("[YahooAddToListByEvent] ERROR: Can't get event.");
+ return 0;
+ }
+
+ if ( dbei.eventType != EVENTTYPE_AUTHREQUEST ) {
+ YAHOO_DebugLog("[YahooAddToListByEvent] ERROR: Not authorization.");
+ return 0;
+ }
+
+ if ( strcmp( dbei.szModule, yahooProtocolName )) {
+ YAHOO_DebugLog("[YahooAddToListByEvent] ERROR: Not Yahoo protocol.");
+ return 0;
+ }
+
+ //Adds a contact to the contact list given an auth, added or contacts event
+//wParam=MAKEWPARAM(flags,iContact)
+//lParam=(LPARAM)(HANDLE)hDbEvent
+//Returns a HANDLE to the new contact, or NULL on failure
+//hDbEvent must be either EVENTTYPE_AUTHREQ or EVENTTYPE_ADDED
+//flags are the same as for PS_ADDTOLIST.
+//iContact is only used for contacts events. It is the 0-based index of the
+//contact in the event to add. There is no way to add two or more contacts at
+//once, you should just do lots of calls.
+
+ /* TYPE ADDED
+ blob is: uin(DWORD), hcontact(HANDLE), nick(ASCIIZ), first(ASCIIZ),
+ last(ASCIIZ), email(ASCIIZ)
+
+ TYPE AUTH REQ
+ blob is: uin(DWORD), hcontact(HANDLE), nick(ASCIIZ), first(ASCIIZ),
+ last(ASCIIZ), email(ASCIIZ), reason(ASCIIZ)
+ */
+ //hContact = (HANDLE) ( dbei.pBlob + sizeof( DWORD ));
+
+ nick = ( char* )( dbei.pBlob + sizeof( DWORD )*2 );
+ {
+ char* firstName = nick + lstrlen(nick) + 1;
+ char* lastName = firstName + lstrlen(firstName) + 1;
+ char* email = lastName + lstrlen(lastName) + 1;
+ char* reason = email + lstrlen(email) + 1;
+
+ YAHOO_DebugLog("buddy:%s first:%s last:%s e-mail:%s", nick,
+ firstName, lastName, email);
+ YAHOO_DebugLog("reason:%s ", reason);
+ }
+
+ /* we need to send out a packet to request an add */
+ //YAHOO_add_buddy(nick, "miranda", reason);
+ //return 0;
+ hContact = getbuddyH(nick);
+ if (hContact != NULL) {
+ YAHOO_DebugLog("Temp Buddy found at: %p ", hContact);
+ }
+ return (int)hContact;
+}
+
+int YahooAuthAllow(WPARAM wParam,LPARAM lParam)
+{
+ DBEVENTINFO dbei;
+ char* nick;
+
+ YAHOO_DebugLog("[YahooAuthAllow]");
+ if ( !yahooLoggedIn ) {
+ YAHOO_DebugLog("[YahooAuthAllow] Not Logged In!");
+ return 1;
+ }
+
+
+ memset( &dbei, 0, sizeof( dbei ));
+ dbei.cbSize = sizeof( dbei );
+
+ if (( dbei.cbBlob = YAHOO_CallService( MS_DB_EVENT_GETBLOBSIZE, wParam, 0 )) == -1 )
+ return 1;
+
+ dbei.pBlob = ( PBYTE )_alloca( dbei.cbBlob );
+ if ( YAHOO_CallService( MS_DB_EVENT_GET, wParam, ( LPARAM )&dbei ))
+ return 1;
+
+ if ( dbei.eventType != EVENTTYPE_AUTHREQUEST )
+ return 1;
+
+ if ( strcmp( dbei.szModule, yahooProtocolName ))
+ return 1;
+
+ nick = ( char* )( dbei.pBlob + sizeof( DWORD )*2 );
+
+ YAHOO_DebugLog("Accepting buddy:%s ", nick);
+ //YAHOO_add_buddy(nick, "miranda", NULL);
+ YAHOO_accept(nick);
+
+ return 0;
+}
+
+int YahooAuthDeny(WPARAM wParam,LPARAM lParam)
+{
+ DBEVENTINFO dbei;
+ char* nick;
+ char *handle;
+ char* reason;
+ HANDLE hContact;
+
+ YAHOO_DebugLog("[YahooAuthDeny]");
+ if ( !yahooLoggedIn )
+ return 1;
+
+ memset( &dbei, 0, sizeof( dbei ));
+ dbei.cbSize = sizeof( dbei );
+
+ if (( dbei.cbBlob = YAHOO_CallService( MS_DB_EVENT_GETBLOBSIZE, wParam, 0 )) == -1 ){
+ YAHOO_DebugLog("[YahooAuthDeny] ERROR: Can't get blob size");
+ return 1;
+ }
+
+ dbei.pBlob = ( PBYTE )alloca( dbei.cbBlob );
+ if ( YAHOO_CallService( MS_DB_EVENT_GET, wParam, ( LPARAM )&dbei )){
+ YAHOO_DebugLog("YahooAuthDeny - Can't get db event!");
+ return 1;
+ }
+
+ if ( dbei.eventType != EVENTTYPE_AUTHREQUEST ){
+ YAHOO_DebugLog("YahooAuthDeny - not Authorization event");
+ return 1;
+ }
+
+ if ( strcmp( dbei.szModule, yahooProtocolName )){
+ YAHOO_DebugLog("YahooAuthDeny - wrong module?");
+ return 1;
+ }
+
+ nick = ( char* )( dbei.pBlob + sizeof( DWORD )*2 );
+ handle = ( char* )( dbei.pBlob + sizeof( DWORD ) );
+ reason = (char*)lParam;
+
+ memcpy(&hContact,handle, sizeof(HANDLE));
+
+ /* Need to remove the buddy from our Miranda Lists */
+ YAHOO_DebugLog("Rejecting buddy:%s msg: %s", nick, reason);
+ YAHOO_reject(nick,reason);
+
+ YAHOO_CallService( MS_DB_CONTACT_DELETE, (WPARAM) hContact, 0);
+ return 0;
+}
+
+int YahooRecvAuth(WPARAM wParam,LPARAM lParam)
+{
+ DBEVENTINFO dbei;
+ CCSDATA *ccs=(CCSDATA*)lParam;
+ PROTORECVEVENT *pre=(PROTORECVEVENT*)ccs->lParam;
+
+ YAHOO_DebugLog("[YahooRecvAuth] ");
+ DBDeleteContactSetting(ccs->hContact,"CList","Hidden");
+
+ ZeroMemory(&dbei,sizeof(dbei));
+ dbei.cbSize=sizeof(dbei);
+ dbei.szModule=yahooProtocolName;
+ dbei.timestamp=pre->timestamp;
+ dbei.flags=pre->flags & (PREF_CREATEREAD?DBEF_READ:0);
+ dbei.eventType=EVENTTYPE_AUTHREQUEST;
+
+ /* Just copy the Blob from PSR_AUTH event. */
+ dbei.cbBlob=pre->lParam;
+ dbei.pBlob=(PBYTE)pre->szMessage;
+ CallService(MS_DB_EVENT_ADD,(WPARAM)NULL,(LPARAM)&dbei);
+
+ return 0;
+}
+
+static void __cdecl yahoo_get_statusthread(HANDLE hContact)
+{
+ CCSDATA ccs1;
+ PROTORECVEVENT pre;
+ int status, l;
+ DBVARIANT dbv;
+ char *gm = NULL, *sm = NULL, *fm;
+ status = DBGetContactSettingWord(hContact, yahooProtocolName, "Status", ID_STATUS_OFFLINE);
+
+ if (status == ID_STATUS_OFFLINE)
+ return;
+
+ /* Check Yahoo Games Message */
+ if (! DBGetContactSetting(( HANDLE )hContact, yahooProtocolName, "YGMsg", &dbv )) {
+ gm = strdup(dbv.pszVal);
+
+ DBFreeVariant( &dbv );
+ }
+
+ //if ( DBGetContactSetting(( HANDLE )hContact, yahooProtocolName, "YMsg", &dbv )) {
+ if ( DBGetContactSetting(( HANDLE )hContact, "CList", "StatusMsg", &dbv )) {
+ sm = yahoo_status_code(DBGetContactSettingWord(hContact, yahooProtocolName, "YStatus", YAHOO_STATUS_OFFLINE));
+ } else {
+ if (lstrlen(dbv.pszVal) < 1)
+ sm = yahoo_status_code(DBGetContactSettingWord(hContact, yahooProtocolName, "YStatus", YAHOO_STATUS_OFFLINE));
+ else
+ sm = strdup(dbv.pszVal);
+
+ DBFreeVariant( &dbv );
+ }
+
+ l = 0;
+ if (gm)
+ l += lstrlen(gm) + 3;
+
+ l += lstrlen(sm) + 1;
+ fm = (char *) malloc(l);
+
+ fm[0] ='\0';
+ if (gm && lstrlen(gm) > 0) {
+ /* BAH YAHOO SUCKS! WHAT A PAIN!
+ find first carriage return add status message then add the rest */
+ char *c = strchr(gm, '\r');
+
+ if (c != NULL) {
+ lstrcpyn(fm,gm, c - gm + 1);
+ fm[c - gm + 1] = '\0';
+ } else
+ lstrcpy(fm, gm);
+
+ lstrcat(fm, ": ");
+ lstrcat(fm, sm);
+
+ if (c != NULL)
+ lstrcat(fm, c);
+ } else {
+ lstrcat(fm, sm);
+ }
+ ccs1.szProtoService = PSR_AWAYMSG;
+ ccs1.hContact = hContact;
+ ccs1.wParam = status;
+ ccs1.lParam = (LPARAM)&pre;
+ pre.flags = 0;
+ pre.timestamp = time(NULL);
+ pre.lParam = 1;
+ pre.szMessage = fm;
+
+ CallService(MS_PROTO_CHAINRECV, 0, (LPARAM)&ccs1);
+}
+
+//=======================================================
+//Handle away message
+//=======================================================
+int YahooGetAwayMessage(WPARAM wParam,LPARAM lParam)
+{
+ YAHOO_DebugLog("YahooGetAwayMessage");
+ if (lParam && yahooLoggedIn) {
+ CCSDATA *ccs = (CCSDATA *) lParam;
+ DBVARIANT dbv;
+ int status;
+
+ status = DBGetContactSettingWord(( HANDLE )ccs->hContact, yahooProtocolName, "Status", ID_STATUS_OFFLINE);
+
+ if (status == ID_STATUS_OFFLINE)
+ return 0; /* user offline, what Status message? */
+
+ if ( DBGetContactSetting(( HANDLE )ccs->hContact, yahooProtocolName, YAHOO_LOGINID, &dbv )) {
+ YAHOO_DebugLog("YAHOOGetAwayMessage Can't retrieve buddy id.");
+ return 0;
+ }
+ YAHOO_DebugLog("Buddy %s ", dbv.pszVal);
+
+ DBFreeVariant( &dbv );
+
+ pthread_create(yahoo_get_statusthread, ccs->hContact);
+ return 1; //Success
+
+ }
+
+ return 0; // Failure
+}
+
+int YahooRecvAwayMessage(WPARAM wParam,LPARAM lParam)
+{
+ CCSDATA *ccs;
+ PROTORECVEVENT *pre;
+
+ YAHOO_DebugLog("YahooRecvAwayMessage");
+
+ ccs=(CCSDATA*)lParam;
+ pre=(PROTORECVEVENT*)ccs->lParam;
+
+ YAHOO_DebugLog("Got Msg: %s", pre->szMessage);
+ ProtoBroadcastAck(yahooProtocolName,ccs->hContact,ACKTYPE_AWAYMSG,ACKRESULT_SUCCESS,(HANDLE)pre->lParam,(LPARAM)pre->szMessage);
+ return 0;
+}
+
+//=======================================================
+//SetStatusMessage
+//=======================================================
+int YahooSetAwayMessage(WPARAM wParam, LPARAM lParam)
+{
+ char *c;
+
+ c = (char *) lParam;
+ if (c != NULL)
+ if (*c == '\0')
+ c = NULL;
+
+ YAHOO_DebugLog("[YahooSetAwayMessage] Status: %s, Msg: %s",(char *) CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION, wParam, 0), (char*) c);
+
+ if(!yahooLoggedIn){
+ if (yahooStatus == ID_STATUS_OFFLINE) {
+ YAHOO_DebugLog("[YahooSetAwayMessage] WARNING: WE ARE OFFLINE!");
+ return 1;
+ } else {
+ if (szStartMsg) free(szStartMsg);
+
+ if (c != NULL)
+ szStartMsg = _strdup(c);
+ else
+ szStartMsg = NULL;
+
+ return 0;
+ }
+ }
+
+ /* need to tell ALL plugins that we are changing status */
+ yahoo_util_broadcaststatus(wParam);
+
+ if (szStartMsg) free(szStartMsg);
+
+ /* now decide what we tell the server */
+ if (c != 0) {
+ szStartMsg = _strdup(c);
+ if(wParam == ID_STATUS_ONLINE) {
+ yahoo_set_status(YAHOO_CUSTOM_STATUS, c, 0);
+ } else if(wParam != ID_STATUS_INVISIBLE){
+ yahoo_set_status(YAHOO_CUSTOM_STATUS, c, 1);
+ }
+ } else {
+ yahoo_set_status(wParam, NULL, 0);
+ szStartMsg = NULL;
+ }
+
+
+ return 0;
+}
+
+static void __cdecl yahoo_get_infothread(HANDLE hContact)
+{
+ SleepEx(500, TRUE);
+ ProtoBroadcastAck(yahooProtocolName, hContact, ACKTYPE_GETINFO, ACKRESULT_SUCCESS, (HANDLE) 1, 0);
+}
+
+int YahooGetInfo(WPARAM wParam,LPARAM lParam)
+{
+ CCSDATA *ccs = (CCSDATA *) lParam;
+ pthread_create(yahoo_get_infothread, ccs->hContact);
+ return 0;
+}
+
+//=======================================================
+//Custom status message windows handling
+//=======================================================
+static BOOL CALLBACK DlgProcSetCustStat(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
+{
+// char str[ 4096 ];
+ DBVARIANT dbv;
+
+ switch (msg)
+ {
+ case WM_INITDIALOG:
+ {
+ TranslateDialogDefault( hwndDlg );
+ SendMessage( hwndDlg, WM_SETICON, ICON_BIG, (LPARAM)LoadIcon( hinstance, MAKEINTRESOURCE( IDI_YAHOO )));
+
+ if ( !DBGetContactSetting( NULL, yahooProtocolName, YAHOO_CUSTSTATDB, &dbv ))
+ {
+ SetDlgItemText( hwndDlg, IDC_CUSTSTAT, dbv. pszVal );
+
+ EnableWindow( GetDlgItem( hwndDlg, IDOK ), lstrlen(dbv.pszVal) > 0 );
+ DBFreeVariant( &dbv );
+ }
+ else {
+ SetDlgItemText( hwndDlg, IDC_CUSTSTAT, "" );
+ EnableWindow( GetDlgItem( hwndDlg, IDOK ), FALSE );
+ }
+
+
+ CheckDlgButton( hwndDlg, IDC_CUSTSTATBUSY, YAHOO_GetByte( "BusyCustStat", 0 ));
+ return TRUE;
+ }
+ case WM_COMMAND:
+ switch(wParam)
+ {
+ case IDOK:
+ {
+ char str[ 255 + 1 ];
+
+ /* Get String from dialog */
+ GetDlgItemText( hwndDlg, IDC_CUSTSTAT, str, sizeof( str ));
+
+ /* Save it for later use */
+ YAHOO_SetString( NULL, YAHOO_CUSTSTATDB, str );
+ YAHOO_SetByte("BusyCustStat", ( BYTE )IsDlgButtonChecked( hwndDlg, IDC_CUSTSTATBUSY ));
+
+ /* set for Idle/AA */
+ if (szStartMsg) free(szStartMsg);
+ szStartMsg = _strdup(str);
+
+ /* notify Server about status change */
+ yahoo_set_status(YAHOO_CUSTOM_STATUS, str, ( BYTE )IsDlgButtonChecked( hwndDlg, IDC_CUSTSTATBUSY ));
+
+ /* change local/miranda status */
+ yahoo_util_broadcaststatus(( BYTE )IsDlgButtonChecked( hwndDlg, IDC_CUSTSTATBUSY ) ?
+ ID_STATUS_AWAY : ID_STATUS_ONLINE);
+ }
+ case IDCANCEL:
+ DestroyWindow( hwndDlg );
+ break;
+ }
+
+ if ( HIWORD( wParam ) == EN_CHANGE && ( HWND )lParam == GetFocus()) {
+ if (LOWORD( wParam ) == IDC_CUSTSTAT) {
+ char str[ 255 + 1 ];
+
+ BOOL toSet;
+
+ toSet = GetDlgItemText( hwndDlg, IDC_CUSTSTAT, str, sizeof( str )) != 0;
+
+ EnableWindow( GetDlgItem( hwndDlg, IDOK ), toSet );
+ }
+ }
+ break; /* case WM_COMMAND */
+
+ case WM_CLOSE:
+ DestroyWindow( hwndDlg );
+ break;
+ }
+ return FALSE;
+}
+
+//=======================================================
+//Show custom status windows
+//=======================================================
+static int SetCustomStatCommand( WPARAM wParam, LPARAM lParam )
+{
+ HWND hwndSetCustomStatus;
+
+ if ( !yahooLoggedIn ) {
+ YAHOO_shownotification(Translate("Yahoo Error"), Translate("You need to be connected to set the custom message"), NIIF_ERROR);
+ return 0;
+ }
+
+ hwndSetCustomStatus = CreateDialog(hinstance, MAKEINTRESOURCE( IDD_SETCUSTSTAT ), NULL, DlgProcSetCustStat );
+
+ SetForegroundWindow( hwndSetCustomStatus );
+ SetFocus( hwndSetCustomStatus );
+ ShowWindow( hwndSetCustomStatus, SW_SHOW );
+ return 0;
+}
+
+//=======================================================
+//Open URL
+//=======================================================
+void YahooOpenURL(const char *url, int autoLogin)
+{
+ char tUrl[ 4096 ];
+
+ if (autoLogin && YAHOO_GetByte( "MailAutoLogin", 0 ) && yahooLoggedIn) {
+ int id = 1;
+ char *y, *t, *u;
+
+ y = yahoo_urlencode(yahoo_get_cookie(id, "y"));
+ t = yahoo_urlencode(yahoo_get_cookie(id, "t"));
+ u = yahoo_urlencode(url);
+ _snprintf( tUrl, sizeof( tUrl ),
+ "http://msg.edit.yahoo.com/config/reset_cookies?&.y=Y=%s&.t=T=%s&.ver=2&.done=http%%3a//us.rd.yahoo.com/messenger/client/%%3f%s",
+ y, t, u);
+
+ FREE(y);
+ FREE(t);
+ FREE(u);
+ } else {
+ _snprintf( tUrl, sizeof( tUrl ), url );
+ }
+
+ YAHOO_DebugLog("[YahooOpenURL] url: %s Final URL: %s", url, tUrl);
+
+ CallService( MS_UTILS_OPENURL, TRUE, ( LPARAM )tUrl );
+}
+
+//=======================================================
+//Show buddy profile
+//=======================================================
+static int YahooShowProfileCommand( WPARAM wParam, LPARAM lParam )
+{
+ char tUrl[ 4096 ];
+ DBVARIANT dbv;
+
+ if ( DBGetContactSetting(( HANDLE )wParam, yahooProtocolName, "yahoo_id", &dbv ))
+ return 0;
+
+ _snprintf( tUrl, sizeof( tUrl ), "http://profiles.yahoo.com/%s", dbv.pszVal );
+ DBFreeVariant( &dbv );
+
+ YahooOpenURL(tUrl, 0);
+ return 0;
+}
+
+//=======================================================
+//Show My profile
+//=======================================================
+static int YahooShowMyProfileCommand( WPARAM wParam, LPARAM lParam )
+{
+ char tUrl[ 4096 ];
+ DBVARIANT dbv;
+
+ DBGetContactSetting( NULL, yahooProtocolName, YAHOO_LOGINID, &dbv );
+
+ _snprintf( tUrl, sizeof( tUrl ), "http://profiles.yahoo.com/%s", dbv.pszVal );
+ DBFreeVariant( &dbv );
+
+ YahooOpenURL(tUrl, 0);
+
+ return 0;
+}
+
+//=======================================================
+//Show Goto mailbox
+//=======================================================
+int YahooGotoMailboxCommand( WPARAM wParam, LPARAM lParam )
+{
+ YahooOpenURL("http://mail.yahoo.com/", 1);
+
+ return 0;
+}
+
+static int YahooABCommand( WPARAM wParam, LPARAM lParam )
+{
+ YahooOpenURL("http://address.yahoo.com/yab/", 1);
+
+ return 0;
+}
+
+static int YahooCalendarCommand( WPARAM wParam, LPARAM lParam )
+{
+ YahooOpenURL("http://calendar.yahoo.com/", 1);
+
+ return 0;
+}
+
+//=======================================================
+//Refresh Yahoo
+//=======================================================
+static int YahooRefreshCommand( WPARAM wParam, LPARAM lParam )
+{
+ if ( !yahooLoggedIn ){
+ YAHOO_shownotification(Translate("Yahoo Error"), Translate("You need to be connected to refresh your buddy list"), NIIF_ERROR);
+ return 0;
+ }
+
+ YAHOO_refresh();
+ return 0;
+}
+
+int YAHOOSendTyping(WPARAM wParam, LPARAM lParam)
+{
+ DBVARIANT dbv;
+ char *szProto;
+ HANDLE hContact = (HANDLE)wParam;
+ int state = (int)lParam;
+
+ if (!yahooLoggedIn)
+ return 0;
+
+ szProto = (char *) CallService(MS_PROTO_GETCONTACTBASEPROTO, wParam, 0);
+ if (szProto==NULL || strcmp(szProto, yahooProtocolName)) return 0;
+ if (!DBGetContactSetting(hContact, yahooProtocolName, YAHOO_LOGINID, &dbv)) {
+ if (state==PROTOTYPE_SELFTYPING_OFF || state==PROTOTYPE_SELFTYPING_ON) {
+ YAHOO_sendtyping(dbv.pszVal, state == PROTOTYPE_SELFTYPING_ON?1:0);
+ }
+ DBFreeVariant(&dbv);
+ }
+ return 0;
+}
+
+int YahooIdleEvent(WPARAM wParam, LPARAM lParam)
+{
+ BOOL bIdle = (lParam & IDF_ISIDLE);
+
+ YAHOO_DebugLog("[YAHOO_IDLE_EVENT] Idle: %s", bIdle ?"Yes":"No");
+
+ if ( lParam & IDF_PRIVACY )
+ return 0; /* we support Privacy settings */
+
+ if (yahooLoggedIn) {
+ /* set me to idle or back */
+ if (yahooStatus == ID_STATUS_INVISIBLE)
+ YAHOO_DebugLog("[YAHOO_IDLE_EVENT] WARNING: INVISIBLE! Don't change my status!");
+ else
+ yahoo_set_status(yahooStatus,szStartMsg,(bIdle) ? 2 : (yahooStatus == ID_STATUS_ONLINE) ? 0 : 1);
+ } else {
+ YAHOO_DebugLog("[YAHOO_IDLE_EVENT] WARNING: NOT LOGGED IN???");
+ }
+
+ return 0;
+}
+
+int YahooSetApparentMode(WPARAM wParam, LPARAM lParam)
+{
+ int oldMode;
+ CCSDATA *ccs = (CCSDATA *) lParam;
+
+ if (ccs->wParam && ccs->wParam != ID_STATUS_OFFLINE)
+ return 1;
+
+ oldMode = DBGetContactSettingWord(ccs->hContact, yahooProtocolName, "ApparentMode", 0);
+
+ if ((int) ccs->wParam == oldMode)
+ return 1;
+
+ DBWriteContactSettingWord(ccs->hContact, yahooProtocolName, "ApparentMode", (WORD) ccs->wParam);
+ return 1;
+}
+
+extern HANDLE hHookContactDeleted;
+extern HANDLE hHookIdle;
+
+//=======================================================
+//Load the yahoo service/plugin
+//=======================================================
+int LoadYahooServices( void )
+{
+ if (!YAHOO_GetByte( "DisableMainMenu", 0 ))
+ {
+ char servicefunction[ 100 ];
+ char* tDest;
+ CLISTMENUITEM mi;
+
+ lstrcpy( servicefunction, yahooProtocolName );
+ tDest = servicefunction + lstrlen( servicefunction );
+
+ // Show custom status menu
+ lstrcpy( tDest, YAHOO_SET_CUST_STAT );
+ CreateServiceFunction( servicefunction, SetCustomStatCommand );
+ memset( &mi, 0, sizeof( mi ));
+ mi.pszPopupName = yahooProtocolName;
+ mi.cbSize = sizeof( mi );
+ mi.popupPosition = 500090000;
+ mi.position = 500090000;
+ mi.hIcon = LoadIcon( hinstance, MAKEINTRESOURCE( IDI_SET_STATUS ));
+ mi.pszName = Translate( "Set &Custom Status" );
+ mi.pszService = servicefunction;
+ YahooMenuItems [ 0 ] = ( HANDLE )CallService( MS_CLIST_ADDMAINMENUITEM, 0, (LPARAM)&mi );
+
+ // Show My profile menu
+ lstrcpy( tDest, YAHOO_SHOW_MY_PROFILE );
+ CreateServiceFunction( servicefunction, YahooShowMyProfileCommand );
+ mi.position = 500090005;
+ mi.hIcon = LoadIcon( hinstance, MAKEINTRESOURCE( IDI_PROFILE ));
+ mi.pszName = Translate( "&My Profile" );
+ mi.pszService = servicefunction;
+ YahooMenuItems [ 1 ] = ( HANDLE )CallService( MS_CLIST_ADDMAINMENUITEM, 0, ( LPARAM )&mi );
+
+ // Show Yahoo mail menu
+ strcpy( tDest, YAHOO_YAHOO_MAIL );
+ CreateServiceFunction( servicefunction, YahooGotoMailboxCommand );
+ mi.position = 500090010;
+ mi.hIcon = LoadIcon( hinstance, MAKEINTRESOURCE( IDI_INBOX ));
+ mi.pszName = Translate( "&Yahoo Mail" );
+ mi.pszService = servicefunction;
+ YahooMenuItems [ 2 ] = ( HANDLE )CallService( MS_CLIST_ADDMAINMENUITEM, 0, ( LPARAM )&mi );
+
+ // Show refresh menu
+ strcpy( tDest, YAHOO_AB );
+ CreateServiceFunction( servicefunction, YahooABCommand );
+ mi.position = 500090015;
+ mi.hIcon = LoadIcon( hinstance, MAKEINTRESOURCE( IDI_YAB ));
+ mi.pszName = Translate( "&Address Book" );
+ mi.pszService = servicefunction;
+ YahooMenuItems [ 3 ] = ( HANDLE )CallService( MS_CLIST_ADDMAINMENUITEM, 0, ( LPARAM )&mi );
+
+ // Show refresh menu
+ strcpy( tDest, YAHOO_CALENDAR );
+ CreateServiceFunction( servicefunction, YahooCalendarCommand );
+ mi.position = 500090015;
+ mi.hIcon = LoadIcon( hinstance, MAKEINTRESOURCE( IDI_CALENDAR ));
+ mi.pszName = Translate( "&Calendar" );
+ mi.pszService = servicefunction;
+ YahooMenuItems [ 4 ] = ( HANDLE )CallService( MS_CLIST_ADDMAINMENUITEM, 0, ( LPARAM )&mi );
+
+ // Show refresh menu
+ strcpy( tDest, YAHOO_REFRESH );
+ CreateServiceFunction( servicefunction, YahooRefreshCommand );
+ mi.position = 500090015;
+ mi.hIcon = LoadIcon( hinstance, MAKEINTRESOURCE( IDI_REFRESH ));
+ mi.pszName = Translate( "&Refresh" );
+ mi.pszService = servicefunction;
+ YahooMenuItems [ 5 ] = ( HANDLE )CallService( MS_CLIST_ADDMAINMENUITEM, 0, ( LPARAM )&mi );
+
+ // Show show profile menu
+ strcpy( tDest, YAHOO_SHOW_PROFILE );
+ CreateServiceFunction( servicefunction, YahooShowProfileCommand );
+ mi.position = -2000006000;
+ mi.hIcon = LoadIcon( hinstance, MAKEINTRESOURCE( IDI_PROFILE ));
+ mi.pszName = Translate( "&Show Profile" );
+ mi.pszService = servicefunction;
+ mi.pszContactOwner = yahooProtocolName;
+ YahooMenuItems [ 6 ] = ( HANDLE )CallService( MS_CLIST_ADDCONTACTMENUITEM, 0, ( LPARAM )&mi );
+
+ }
+
+ //----| Service creation |------------------------------------------------------------
+ hHookContactDeleted = HookEvent( ME_DB_CONTACT_DELETED, YahooContactDeleted );
+
+ // Send Nudge
+ YAHOO_CreateProtoServiceFunction( YAHOO_SEND_NUDGE, YahooSendNudge );
+
+ YAHOO_CreateProtoServiceFunction( PS_GETCAPS, GetCaps );
+ YAHOO_CreateProtoServiceFunction( PS_GETNAME, GetName );
+ YAHOO_CreateProtoServiceFunction( PS_LOADICON, YahooLoadIcon );
+ YAHOO_CreateProtoServiceFunction( PS_SETSTATUS, SetStatus );
+ YAHOO_CreateProtoServiceFunction( PS_GETSTATUS, GetStatus );
+
+ YAHOO_CreateProtoServiceFunction( PS_BASICSEARCH, YahooBasicSearch );
+ YAHOO_CreateProtoServiceFunction( PS_ADDTOLIST, YahooAddToList );
+
+ YAHOO_CreateProtoServiceFunction( PS_AUTHALLOW, YahooAuthAllow );
+ YAHOO_CreateProtoServiceFunction( PS_AUTHDENY, YahooAuthDeny );
+ YAHOO_CreateProtoServiceFunction( PS_ADDTOLISTBYEVENT, YahooAddToListByEvent );
+
+ YAHOO_CreateProtoServiceFunction( PS_FILERESUME, YahooFileResume );
+
+
+ YAHOO_CreateProtoServiceFunction( PSR_AUTH, YahooRecvAuth );
+ YAHOO_CreateProtoServiceFunction( PSS_AUTHREQUEST, YahooSendAuthRequest);
+ ///
+ YAHOO_CreateProtoServiceFunction( PSS_MESSAGE, YahooSendMessage );
+ YAHOO_CreateProtoServiceFunction( PSS_MESSAGE"W", YahooSendMessageW );
+
+ YAHOO_CreateProtoServiceFunction( PSR_MESSAGE, YahooRecvMessage );
+
+ YAHOO_CreateProtoServiceFunction( PSS_GETAWAYMSG, YahooGetAwayMessage );
+ YAHOO_CreateProtoServiceFunction( PSR_AWAYMSG, YahooRecvAwayMessage );
+
+ YAHOO_CreateProtoServiceFunction( PS_SETAWAYMSG, YahooSetAwayMessage );
+
+ YAHOO_CreateProtoServiceFunction( PSS_GETINFO, YahooGetInfo );
+
+ YAHOO_CreateProtoServiceFunction( PSS_USERISTYPING, YAHOOSendTyping );
+
+ //Allows a file transfer to begin
+ YAHOO_CreateProtoServiceFunction( PSS_FILEALLOW, YahooFileAllow );
+ //Refuses a file transfer request
+ YAHOO_CreateProtoServiceFunction( PSS_FILEDENY, YahooFileDeny );
+
+ //Cancel an in-progress file transfer
+ YAHOO_CreateProtoServiceFunction( PSS_FILECANCEL, YahooFileCancel );
+ //Initiate a file send
+ YAHOO_CreateProtoServiceFunction( PSS_FILE, YahooSendFile );
+ //File(s) have been received
+ YAHOO_CreateProtoServiceFunction( PSR_FILE, YahooRecvFile );
+
+ YAHOO_CreateProtoServiceFunction( PSS_SETAPPARENTMODE, YahooSetApparentMode);
+
+ YAHOO_CreateProtoServiceFunction( PS_GETAVATARINFO, YahooGetAvatarInfo);
+ YAHOO_CreateProtoServiceFunction( PS_GETMYAVATARMAXSIZE, YahooGetAvatarSize);
+ YAHOO_CreateProtoServiceFunction( PS_GETMYAVATAR, YahooGetMyAvatar);
+ YAHOO_CreateProtoServiceFunction( PS_SETMYAVATAR, YahooSetMyAvatar);
+ YAHOO_CreateProtoServiceFunction( PS_ISAVATARFORMATSUPPORTED, YahooAvatarFormatSupported);
+ return 0;
+}
+
diff --git a/miranda-wine/protocols/Yahoo/util.c b/miranda-wine/protocols/Yahoo/util.c
new file mode 100644
index 0000000..43fc2f2
--- /dev/null
+++ b/miranda-wine/protocols/Yahoo/util.c
@@ -0,0 +1,386 @@
+/*
+ * $Id: util.c 3676 2006-09-01 18:02:28Z gena01 $
+ *
+ * myYahoo Miranda Plugin
+ *
+ * Authors: Gennady Feldman (aka Gena01)
+ * Laurent Marechal (aka Peorth)
+ *
+ * This code is under GPL and is based on AIM, MSN and Miranda source code.
+ * I want to thank Robert Rainwater and George Hazan for their code and support
+ * and for answering some of my questions during development of this plugin.
+ */
+#include <windows.h>
+#include <windowsx.h>
+#include <stdio.h>
+#include <shlwapi.h>
+#include <malloc.h>
+
+#include "yahoo.h"
+#include <m_popup.h>
+#include <m_system.h>
+#include <m_protomod.h>
+#include <m_protosvc.h>
+#include <m_langpack.h>
+#include <m_skin.h>
+#include <m_utils.h>
+#include <m_options.h>
+
+#include "resource.h"
+
+HANDLE __stdcall YAHOO_CreateProtoServiceFunction(
+ const char* szService,
+ MIRANDASERVICE serviceProc )
+{
+ char str[ MAXMODULELABELLENGTH ];
+
+ strcpy( str, yahooProtocolName );
+ strcat( str, szService );
+
+ return CreateServiceFunction( str, serviceProc );
+}
+
+int __stdcall YAHOO_CallService( const char* szSvcName, WPARAM wParam, LPARAM lParam )
+{
+ return CallService( szSvcName, wParam, lParam );
+}
+
+
+int YAHOO_DebugLog( const char *fmt, ... )
+{
+ char str[ 4096 ];
+ va_list vararg;
+ int tBytes;
+
+ va_start( vararg, fmt );
+
+ tBytes = _vsnprintf( str, sizeof( str ), fmt, vararg );
+ if ( tBytes > 0 )
+ str[ tBytes ] = 0;
+
+ va_end( vararg );
+
+ return CallService( MS_NETLIB_LOG, ( WPARAM )hNetlibUser, ( LPARAM )str );
+}
+
+DWORD __stdcall YAHOO_GetByte( const char* valueName, int parDefltValue )
+{
+ return DBGetContactSettingByte( NULL, yahooProtocolName, valueName, parDefltValue );
+}
+
+DWORD __stdcall YAHOO_SetByte( const char* valueName, int parValue )
+{
+ return DBWriteContactSettingByte( NULL, yahooProtocolName, valueName, parValue );
+}
+
+DWORD __stdcall YAHOO_GetDword( const char* valueName, DWORD parDefltValue )
+{
+ return DBGetContactSettingDword( NULL, yahooProtocolName, valueName, parDefltValue );
+}
+
+DWORD __stdcall YAHOO_SetDword( const char* valueName, DWORD parValue )
+{
+ return DBWriteContactSettingDword(NULL, yahooProtocolName, valueName, parValue);
+}
+
+DWORD __stdcall YAHOO_SetWord( HANDLE hContact, const char* valueName, int parValue )
+{
+ return DBWriteContactSettingWord( hContact, yahooProtocolName, valueName, parValue );
+}
+
+WORD __stdcall YAHOO_GetWord( HANDLE hContact, const char* valueName, int parDefltValue )
+{
+ return DBGetContactSettingWord( hContact, yahooProtocolName, valueName, parDefltValue );
+}
+
+int __stdcall YAHOO_SendBroadcast( HANDLE hContact, int type, int result, HANDLE hProcess, LPARAM lParam )
+{
+ ACKDATA ack;
+
+ ZeroMemory(&ack, sizeof(ack) );
+
+ ack.cbSize = sizeof( ACKDATA );
+ ack.szModule = yahooProtocolName;
+ ack.hContact = hContact;
+ ack.type = type;
+ ack.result = result;
+ ack.hProcess = hProcess;
+ ack.lParam = lParam;
+ return YAHOO_CallService( MS_PROTO_BROADCASTACK, 0, ( LPARAM )&ack );
+}
+
+DWORD __stdcall YAHOO_SetString( HANDLE hContact, const char* valueName, const char* parValue )
+{
+ return DBWriteContactSettingString( hContact, yahooProtocolName, valueName, parValue );
+}
+
+DWORD __stdcall YAHOO_SetStringUtf( HANDLE hContact, const char* valueName, const char* parValue )
+{
+ return DBWriteContactSettingStringUtf( hContact, yahooProtocolName, valueName, parValue );
+}
+
+LRESULT CALLBACK PopupWindowProc( HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam )
+{
+ switch( message ) {
+ case WM_COMMAND:
+ YAHOO_DebugLog("[MS_POPUP_ADDPOPUPEX] WM_COMMAND");
+ if ( HIWORD( wParam ) == STN_CLICKED) {
+ char *szURL = (char *)PUGetPluginData( hWnd );
+ if ( szURL != NULL ) {
+ YahooOpenURL(szURL, 1);
+ FREE(szURL);
+ }
+
+ PUDeletePopUp( hWnd );
+ return 0;
+ }
+ break;
+
+ case WM_CONTEXTMENU:
+ YAHOO_DebugLog("[MS_POPUP_ADDPOPUPEX] WM_CONTEXTMENU");
+ PUDeletePopUp( hWnd );
+ break;
+
+ }
+
+ return DefWindowProc(hWnd, message, wParam, lParam);
+}
+
+
+int __stdcall YAHOO_ShowPopup( const char* nickname, const char* msg, const char *szURL )
+{
+ POPUPDATAEX ppd;
+
+ if ( !ServiceExists( MS_POPUP_ADDPOPUPEX ))
+ return 0;
+
+ ZeroMemory(&ppd, sizeof(ppd) );
+ lstrcpy( ppd.lpzContactName, nickname );
+ lstrcpy( ppd.lpzText, msg );
+
+ ppd.PluginWindowProc = ( WNDPROC )PopupWindowProc;
+
+ if (szURL != NULL) {
+ if (lstrcmpi(szURL, "http://mail.yahoo.com") == 0) {
+ ppd.lchIcon = LoadIcon( hinstance, MAKEINTRESOURCE( IDI_INBOX ));
+ } else {
+ ppd.lchIcon = LoadIcon( hinstance, MAKEINTRESOURCE( IDI_CALENDAR ));
+ }
+
+ ppd.PluginData = (void *)strdup( szURL );
+ } else {
+ ppd.lchIcon = LoadIcon( hinstance, MAKEINTRESOURCE( IDI_MAIN ));
+ }
+ YAHOO_DebugLog("[MS_POPUP_ADDPOPUPEX] Generating a popup for %s", nickname);
+ YAHOO_CallService( MS_POPUP_ADDPOPUPEX, (WPARAM)&ppd, 0 );
+
+ return 1;
+}
+
+int YAHOO_shownotification(const char *title, const char *info, DWORD flags)
+{
+ if (ServiceExists(MS_CLIST_SYSTRAY_NOTIFY)) {
+ MIRANDASYSTRAYNOTIFY err;
+ int ret;
+
+ err.szProto = yahooProtocolName;
+ err.cbSize = sizeof(err);
+ err.szInfoTitle = (char *)title;
+ err.szInfo = (char *)info;
+ err.dwInfoFlags = flags;
+ err.uTimeout = 1000 * 3;
+ ret = CallService(MS_CLIST_SYSTRAY_NOTIFY, 0, (LPARAM) & err);
+
+ if (ret == 0)
+ return 1;
+ }
+
+ MessageBox(NULL, info, title, MB_OK | MB_ICONINFORMATION);
+
+ return 0;
+}
+
+void YAHOO_ShowError(const char *title, const char *buff)
+{
+ if (YAHOO_GetByte( "ShowErrors", 1 ))
+ if (!YAHOO_ShowPopup(title, buff, NULL))
+ YAHOO_shownotification(title, buff, NIIF_ERROR);
+}
+
+int YAHOO_util_dbsettingchanged(WPARAM wParam, LPARAM lParam)
+{
+ DBCONTACTWRITESETTING *cws = (DBCONTACTWRITESETTING *) lParam;
+
+ if ((HANDLE) wParam == NULL)
+ return 0;
+ if (!yahooLoggedIn)
+ return 0;
+
+ if (!strcmp(cws->szModule, "CList") && !strcmp(cws->szModule, yahooProtocolName)) {
+ // A temporary contact has been added permanently
+ if (!strcmp(cws->szSetting, "NotOnList")) {
+ if (DBGetContactSettingByte((HANDLE) wParam, "CList", "Hidden", 0))
+ return 0;
+ if (cws->value.type == DBVT_DELETED || (cws->value.type == DBVT_BYTE && cws->value.bVal == 0)) {
+ char *szProto;
+ DBVARIANT dbv;
+
+ szProto = (char *) CallService(MS_PROTO_GETCONTACTBASEPROTO, wParam, 0);
+ if (szProto==NULL || strcmp(szProto, yahooProtocolName)) return 0;
+
+ if ( !DBGetContactSetting( (HANDLE) wParam, yahooProtocolName, YAHOO_LOGINID, &dbv )){
+ YAHOO_DebugLog("Adding Permanently %s to list.", dbv.pszVal);
+ YAHOO_add_buddy(dbv.pszVal, "miranda", NULL);
+ DBFreeVariant(&dbv);
+ }
+
+ }
+ }
+ }else if (!strcmp(cws->szModule, yahooProtocolName) && !strcmp(cws->szSetting, "ApparentMode")) {
+ DBVARIANT dbv;
+
+ YAHOO_DebugLog("DB Setting changed. YAHOO user's visible setting changed.");
+
+ if ( !DBGetContactSetting( (HANDLE) wParam, yahooProtocolName, YAHOO_LOGINID, &dbv )){
+ int iAdd;
+
+
+ iAdd = (ID_STATUS_OFFLINE == DBGetContactSettingWord((HANDLE) wParam, yahooProtocolName, "ApparentMode", 0));
+ yahoo_stealth(dbv.pszVal, iAdd);
+ DBFreeVariant(&dbv);
+ }
+
+ }
+ return 0;
+}
+
+char* YAHOO_GetContactName( HANDLE hContact )
+{
+ return ( char* )YAHOO_CallService( MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM) hContact, 0 );
+}
+
+extern PLUGININFO pluginInfo;
+
+/*
+ * Thanks Robert for the following function. Copied from AIM plugin.
+ */
+void YAHOO_utils_logversion()
+{
+ char str[256];
+
+#ifdef YAHOO_CVSBUILD
+ _snprintf(str, sizeof(str), "Yahoo v%d.%d.%d.%da (%s %s)", (pluginInfo.version >> 24) & 0xFF, (pluginInfo.version >> 16) & 0xFF,
+ (pluginInfo.version >> 8) & 0xFF, pluginInfo.version & 0xFF, __DATE__, __TIME__);
+#else
+ _snprintf(str, sizeof(str), "Yahoo v%d.%d.%d.%d", (pluginInfo.version >> 24) & 0xFF, (pluginInfo.version >> 16) & 0xFF,
+ (pluginInfo.version >> 8) & 0xFF, pluginInfo.version & 0xFF);
+#endif
+ YAHOO_DebugLog(str);
+#ifdef YAHOO_CVSBUILD
+ YAHOO_DebugLog("You are using a development version of Yahoo. Please make sure you are using the latest version before posting bug reports.");
+#endif
+}
+
+//=======================================================================================
+// Utf8Decode - converts UTF8-encoded string to the UCS2/MBCS format
+//=======================================================================================
+
+void __stdcall Utf8Decode( char* str, int maxSize, wchar_t** ucs2 )
+{
+ wchar_t* tempBuf;
+
+ int len = strlen( str );
+ if ( len < 2 ) {
+ if ( ucs2 != NULL ) {
+ *ucs2 = ( wchar_t* )malloc(( len+1 )*sizeof( wchar_t ));
+ MultiByteToWideChar( CP_ACP, 0, str, len, *ucs2, len );
+ ( *ucs2 )[ len ] = 0;
+ }
+ return;
+ }
+
+ tempBuf = ( wchar_t* )alloca(( len+1 )*sizeof( wchar_t ));
+ {
+ wchar_t* d = tempBuf;
+ BYTE* s = ( BYTE* )str;
+
+ while( *s )
+ {
+ if (( *s & 0x80 ) == 0 ) {
+ *d++ = *s++;
+ continue;
+ }
+
+ if (( s[0] & 0xE0 ) == 0xE0 && ( s[1] & 0xC0 ) == 0x80 && ( s[2] & 0xC0 ) == 0x80 ) {
+ *d++ = (( WORD )( s[0] & 0x0F) << 12 ) + ( WORD )(( s[1] & 0x3F ) << 6 ) + ( WORD )( s[2] & 0x3F );
+ s += 3;
+ continue;
+ }
+
+ if (( s[0] & 0xE0 ) == 0xC0 && ( s[1] & 0xC0 ) == 0x80 ) {
+ *d++ = ( WORD )(( s[0] & 0x1F ) << 6 ) + ( WORD )( s[1] & 0x3F );
+ s += 2;
+ continue;
+ }
+
+ *d++ = *s++;
+ }
+
+ *d = 0;
+ }
+
+ if ( ucs2 != NULL ) {
+ int fullLen = ( len+1 )*sizeof( wchar_t );
+ *ucs2 = ( wchar_t* )malloc( fullLen );
+ memcpy( *ucs2, tempBuf, fullLen );
+ }
+
+ if ( maxSize == 0 )
+ maxSize = len;
+
+ WideCharToMultiByte( CP_ACP, 0, tempBuf, -1, str, maxSize, NULL, NULL );
+}
+
+//=======================================================================================
+// Utf8Encode - converts UCS2 string to the UTF8-encoded format
+//=======================================================================================
+
+char* __stdcall Utf8EncodeUcs2( const wchar_t* src )
+{
+ int len = wcslen( src );
+ char* result = ( char* )malloc( len*3 + 1 );
+ if ( result == NULL )
+ return NULL;
+
+ { const wchar_t* s = src;
+ BYTE* d = ( BYTE* )result;
+
+ while( *s ) {
+ int U = *s++;
+
+ if ( U < 0x80 ) {
+ *d++ = ( BYTE )U;
+ }
+ else if ( U < 0x800 ) {
+ *d++ = 0xC0 + (( U >> 6 ) & 0x3F );
+ *d++ = 0x80 + ( U & 0x003F );
+ }
+ else {
+ *d++ = 0xE0 + ( U >> 12 );
+ *d++ = 0x80 + (( U >> 6 ) & 0x3F );
+ *d++ = 0x80 + ( U & 0x3F );
+ } }
+
+ *d = 0;
+ }
+
+ return result;
+}
+
+void SetButtonCheck(HWND hwndDlg, int CtrlID, BOOL bCheck)
+{
+ HWND hwndCtrl = GetDlgItem(hwndDlg, CtrlID);
+
+ Button_SetCheck(hwndCtrl, (bCheck)?BST_CHECKED:BST_UNCHECKED);
+}
+
diff --git a/miranda-wine/protocols/Yahoo/version.h b/miranda-wine/protocols/Yahoo/version.h
new file mode 100644
index 0000000..77d0c4c
--- /dev/null
+++ b/miranda-wine/protocols/Yahoo/version.h
@@ -0,0 +1,3 @@
+#define __FILEVERSION_STRING 0,4,0,1
+#define __VERSION_STRING "0.4.0.1"
+#define __VERSION_DWORD 0x00040001
diff --git a/miranda-wine/protocols/Yahoo/version.rc b/miranda-wine/protocols/Yahoo/version.rc
new file mode 100644
index 0000000..88ea147
--- /dev/null
+++ b/miranda-wine/protocols/Yahoo/version.rc
@@ -0,0 +1,36 @@
+
+#include <windows.h>
+#include "version.h"
+
+VS_VERSION_INFO VERSIONINFO
+ FILEVERSION __FILEVERSION_STRING
+ PRODUCTVERSION __FILEVERSION_STRING
+ FILEFLAGSMASK 0x3fL
+#ifdef _DEBUG
+ FILEFLAGS 0x1L
+#else
+ FILEFLAGS 0x0L
+#endif
+ FILEOS 0x40004L
+ FILETYPE 0x1L
+ FILESUBTYPE 0x0L
+BEGIN
+ BLOCK "StringFileInfo"
+ BEGIN
+ BLOCK "000004b0"
+ BEGIN
+ VALUE "CompanyName", "Gennady Feldman"
+ VALUE "FileDescription", "Miranda Yahoo plugin"
+ VALUE "FileVersion", __VERSION_STRING
+ VALUE "InternalName", "yahoo"
+ VALUE "LegalCopyright", "Copyright (C) 2003-2006 Gennady Feldman"
+ VALUE "OriginalFilename", "yahoo.dll"
+ VALUE "ProductName", "Miranda"
+ VALUE "ProductVersion", __VERSION_STRING
+ END
+ END
+ BLOCK "VarFileInfo"
+ BEGIN
+ VALUE "Translation", 0x0, 1200
+ END
+END
diff --git a/miranda-wine/protocols/Yahoo/webcam.c b/miranda-wine/protocols/Yahoo/webcam.c
new file mode 100644
index 0000000..126a8d8
--- /dev/null
+++ b/miranda-wine/protocols/Yahoo/webcam.c
@@ -0,0 +1,64 @@
+/*
+ * $Id: webcam.c 3659 2006-08-30 19:43:41Z gena01 $
+ *
+ * myYahoo Miranda Plugin
+ *
+ * Authors: Gennady Feldman (aka Gena01)
+ * Laurent Marechal (aka Peorth)
+ *
+ * This code is under GPL and is based on AIM, MSN and Miranda source code.
+ * I want to thank Robert Rainwater and George Hazan for their code and support
+ * and for answering some of my questions during development of this plugin.
+ */
+#include <time.h>
+#include <sys/stat.h>
+#include <malloc.h>
+#include <io.h>
+
+/*
+ * Miranda headers
+ */
+#include "yahoo.h"
+#include <m_protosvc.h>
+#include <m_langpack.h>
+#include <m_message.h>
+
+extern yahoo_local_account * ylad;
+
+void ext_yahoo_got_im(int id, const char *me, const char *who, const char *msg, long tm, int stat, int utf8, int buddy_icon);
+
+/* WEBCAM callbacks */
+void ext_yahoo_got_webcam_image(int id, const char *who,
+ const unsigned char *image, unsigned int image_size, unsigned int real_size,
+ unsigned int timestamp)
+{
+ LOG(("ext_yahoo_got_webcam_image"));
+}
+
+void ext_yahoo_webcam_viewer(int id, const char *who, int connect)
+{
+ LOG(("ext_yahoo_webcam_viewer"));
+}
+
+void ext_yahoo_webcam_closed(int id, const char *who, int reason)
+{
+ LOG(("ext_yahoo_webcam_closed"));
+}
+
+void ext_yahoo_webcam_data_request(int id, int send)
+{
+ LOG(("ext_yahoo_webcam_data_request"));
+}
+
+void ext_yahoo_webcam_invite(int id, const char *me, const char *from)
+{
+ LOG(("ext_yahoo_webcam_invite"));
+
+ ext_yahoo_got_im(id, me, from, Translate("[miranda] Got webcam invite. (not currently supported)"), 0, 0, 0, -1);
+}
+
+void ext_yahoo_webcam_invite_reply(int id, const char *me, const char *from, int accept)
+{
+ LOG(("ext_yahoo_webcam_invite_reply"));
+}
+
diff --git a/miranda-wine/protocols/Yahoo/webcam.h b/miranda-wine/protocols/Yahoo/webcam.h
new file mode 100644
index 0000000..c33b7c5
--- /dev/null
+++ b/miranda-wine/protocols/Yahoo/webcam.h
@@ -0,0 +1,31 @@
+/*
+ * $Id: webcam.h 3627 2006-08-28 16:11:15Z gena01 $
+ *
+ * myYahoo Miranda Plugin
+ *
+ * Authors: Gennady Feldman (aka Gena01)
+ * Laurent Marechal (aka Peorth)
+ *
+ * This code is under GPL and is based on AIM, MSN and Miranda source code.
+ * I want to thank Robert Rainwater and George Hazan for their code and support
+ * and for answering some of my questions during development of this plugin.
+ */
+#ifndef _YAHOO_WEBCAM_H_
+#define _YAHOO_WEBCAM_H_
+
+/* WEBCAM callbacks */
+void ext_yahoo_got_webcam_image(int id, const char *who,
+ const unsigned char *image, unsigned int image_size, unsigned int real_size,
+ unsigned int timestamp);
+
+void ext_yahoo_webcam_viewer(int id, const char *who, int connect);
+
+void ext_yahoo_webcam_closed(int id, const char *who, int reason);
+
+void ext_yahoo_webcam_data_request(int id, int send);
+
+void ext_yahoo_webcam_invite(int id, const char *me, const char *from);
+
+void ext_yahoo_webcam_invite_reply(int id, const char *me, const char *from, int accept);
+
+#endif
diff --git a/miranda-wine/protocols/Yahoo/yahoo.c b/miranda-wine/protocols/Yahoo/yahoo.c
new file mode 100644
index 0000000..07aeb1d
--- /dev/null
+++ b/miranda-wine/protocols/Yahoo/yahoo.c
@@ -0,0 +1,1463 @@
+/*
+ * $Id: yahoo.c 3676 2006-09-01 18:02:28Z gena01 $
+ *
+ * myYahoo Miranda Plugin
+ *
+ * Authors: Gennady Feldman (aka Gena01)
+ * Laurent Marechal (aka Peorth)
+ *
+ * This code is under GPL and is based on AIM, MSN and Miranda source code.
+ * I want to thank Robert Rainwater and George Hazan for their code and support
+ * and for answering some of my questions during development of this plugin.
+ */
+#include <time.h>
+#include <malloc.h>
+#include <io.h>
+
+/*
+ * Miranda headers
+ */
+#include "yahoo.h"
+#include <m_protosvc.h>
+#include <m_langpack.h>
+#include <m_skin.h>
+#include <m_popup.h>
+#include <m_message.h>
+
+#include "avatar.h"
+#include "chat.h"
+#include "webcam.h"
+#include "file_transfer.h"
+#include "im.h"
+#include "search.h"
+
+typedef struct {
+ int id;
+ char *label;
+} yahoo_idlabel;
+
+typedef struct {
+ int id;
+ char *who;
+} yahoo_authorize_data;
+
+yahoo_idlabel yahoo_status_codes[] = {
+ {YAHOO_STATUS_AVAILABLE, "Available"},
+ {YAHOO_STATUS_BRB, "BRB"},
+ {YAHOO_STATUS_BUSY, "Busy"},
+ {YAHOO_STATUS_NOTATHOME, "Not At Home"},
+ {YAHOO_STATUS_NOTATDESK, "Not At my Desk"},
+ {YAHOO_STATUS_NOTINOFFICE, "Not In The Office"},
+ {YAHOO_STATUS_ONPHONE, "On The Phone"},
+ {YAHOO_STATUS_ONVACATION, "On Vacation"},
+ {YAHOO_STATUS_OUTTOLUNCH, "Out To Lunch"},
+ {YAHOO_STATUS_STEPPEDOUT, "Stepped Out"},
+ {YAHOO_STATUS_INVISIBLE, "Invisible"},
+ {YAHOO_STATUS_IDLE, "Idle"},
+ {YAHOO_STATUS_OFFLINE, "Offline"},
+ {YAHOO_STATUS_CUSTOM, "[Custom]"},
+ {YAHOO_STATUS_NOTIFY, "Notify"},
+ {0, NULL}
+};
+
+#define MAX_PREF_LEN 255
+
+yahoo_local_account * ylad = NULL;
+
+int do_yahoo_debug = 0;
+#ifdef HTTP_GATEWAY
+int iHTTPGateway = 0;
+#endif
+extern int poll_loop;
+extern int gStartStatus;
+extern char *szStartMsg;
+
+char * yahoo_status_code(enum yahoo_status s)
+{
+ int i;
+ for(i=0; yahoo_status_codes[i].label; i++)
+ if(yahoo_status_codes[i].id == s)
+ return yahoo_status_codes[i].label;
+ return "Unknown";
+}
+
+int miranda_to_yahoo(int myyahooStatus)
+{
+ int ret = YAHOO_STATUS_OFFLINE;
+ switch (myyahooStatus) {
+ case ID_STATUS_ONLINE:
+ ret = YAHOO_STATUS_AVAILABLE;
+ break;
+ case ID_STATUS_NA:
+ ret = YAHOO_STATUS_BRB;
+ break;
+ case ID_STATUS_OCCUPIED:
+ ret = YAHOO_STATUS_BUSY;
+ break;
+ case ID_STATUS_AWAY:
+ ret = YAHOO_STATUS_NOTATDESK;
+ break;
+ case ID_STATUS_ONTHEPHONE:
+ ret = YAHOO_STATUS_ONPHONE;
+ break;
+ case ID_STATUS_OUTTOLUNCH:
+ ret = YAHOO_STATUS_OUTTOLUNCH;
+ break;
+ case ID_STATUS_INVISIBLE:
+ ret = YAHOO_STATUS_INVISIBLE;
+ break;
+ case ID_STATUS_DND:
+ ret = YAHOO_STATUS_STEPPEDOUT;
+ break;
+ }
+
+ return ret;
+}
+
+void yahoo_set_status(int myyahooStatus, char *msg, int away)
+{
+ //LOG(("yahoo_set_status myyahooStatus: %s (%d), msg: %s, away: %d", (char *) CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION, myyahooStatus, 0), myyahooStatus, msg, away));
+ LOG(("yahoo_set_status myyahooStatus: %d, msg: %s, away: %d", myyahooStatus, msg, away));
+
+ /* Safety check, don't dereference Invalid pointers */
+ if ((ylad != NULL) && (ylad->id > 0) ) {
+
+ if (YAHOO_CUSTOM_STATUS != myyahooStatus)
+ yahoo_set_away(ylad->id, miranda_to_yahoo(myyahooStatus), msg, away);
+ else
+ yahoo_set_away(ylad->id, YAHOO_CUSTOM_STATUS, msg, away);
+ }
+}
+
+void yahoo_stealth(const char *buddy, int add)
+{
+ LOG(("yahoo_stealth buddy: %s, add: %d", buddy, add));
+
+ /* Safety check, don't dereference Invalid pointers */
+ if ((ylad != NULL) && (ylad->id > 0) ) {
+ yahoo_set_stealth(ylad->id, buddy, add);
+ }
+}
+
+
+int yahoo_to_miranda_status(int yahooStatus, int away)
+{
+ int ret = ID_STATUS_OFFLINE;
+ switch (yahooStatus) {
+ case YAHOO_STATUS_AVAILABLE:
+ ret = ID_STATUS_ONLINE;
+ break;
+ case YAHOO_STATUS_BRB:
+ ret = ID_STATUS_NA;
+ break;
+ case YAHOO_STATUS_BUSY:
+ ret = ID_STATUS_OCCUPIED;
+ break;
+ case YAHOO_STATUS_ONPHONE:
+ ret = ID_STATUS_ONTHEPHONE;
+ break;
+ case YAHOO_STATUS_OUTTOLUNCH:
+ ret = ID_STATUS_OUTTOLUNCH;
+ break;
+ case YAHOO_STATUS_INVISIBLE:
+ ret = ID_STATUS_INVISIBLE;
+ break;
+ case YAHOO_STATUS_NOTATHOME:
+ ret = ID_STATUS_AWAY;
+ break;
+ case YAHOO_STATUS_NOTATDESK:
+ ret = ID_STATUS_AWAY;
+ break;
+ case YAHOO_STATUS_NOTINOFFICE:
+ ret = ID_STATUS_AWAY;
+ break;
+ case YAHOO_STATUS_ONVACATION:
+ ret = ID_STATUS_AWAY;
+ break;
+ case YAHOO_STATUS_STEPPEDOUT:
+ ret = ID_STATUS_DND;
+ break;
+ case YAHOO_STATUS_IDLE:
+ ret = ID_STATUS_AWAY;
+ break;
+ case YAHOO_STATUS_CUSTOM:
+ ret = (away ? ID_STATUS_AWAY:ID_STATUS_ONLINE);
+ break;
+ }
+ return ret;
+}
+
+
+const YList* YAHOO_GetIgnoreList(void)
+{
+ if (!ylad)
+ return NULL;
+
+ return yahoo_get_ignorelist(ylad->id);
+}
+
+void YAHOO_IgnoreBuddy(const char *buddy, int ignore)
+{
+ if (!ylad)
+ return;
+
+ yahoo_ignore_buddy(ylad->id, buddy, ignore);
+ //yahoo_get_list(ylad->id);
+}
+
+void YAHOO_remove_buddy(const char *who)
+{
+ HANDLE hContact;
+ DBVARIANT dbv;
+
+ LOG(("YAHOO_remove_buddy '%s'", who));
+
+ hContact = getbuddyH(who);
+
+ //if ( DBGetContactSetting( hContact, "Clist", "Group", &dbv ))
+ // return;
+ if ( DBGetContactSetting( hContact, yahooProtocolName, "YGroup", &dbv )) {
+ LOG(("WARNING NO DATABASE GROUP using 'miranda'!"));
+ yahoo_remove_buddy(ylad->id, who, "miranda");
+ return;
+ }
+
+ yahoo_remove_buddy(ylad->id, who, dbv.pszVal);
+ DBFreeVariant( &dbv );
+}
+
+void YAHOO_sendtyping(const char *who, int stat)
+{
+ LOG(("[Yahoo_sendtyping] Sending Typing Notification to '%s', state: %d", who, stat));
+ yahoo_send_typing(ylad->id, NULL, who, stat);
+}
+
+void YAHOO_accept(const char *who)
+{
+ yahoo_accept_buddy(ylad->id, who);
+}
+
+void YAHOO_reject(const char *who, const char *msg)
+{
+ yahoo_reject_buddy(ylad->id, who, msg);
+ //YAHOO_remove_buddy(who);
+ //yahoo_refresh(ylad->id);
+}
+
+void yahoo_logout()
+{
+ //poll_loop = 0; <- don't kill us before we do full cleanup!!!
+
+ if (ylad == NULL)
+ return;
+
+ if (ylad->id <= 0) {
+ return;
+ }
+
+ if (yahooLoggedIn) {
+ yahoo_logoff(ylad->id);
+ } else {
+ poll_loop = 0; /* we need to trigger server stop */
+ }
+
+ if (ylad)
+ yahoo_close(ylad->id);
+
+ yahooLoggedIn = FALSE;
+
+ FREE(ylad);
+ ylad = NULL;
+
+ //pthread_mutex_lock(&connectionHandleMutex);
+
+
+ //pthread_mutex_unlock(&connectionHandleMutex);
+}
+
+HANDLE getbuddyH(const char *yahoo_id)
+{
+ char *szProto;
+ HANDLE hContact;
+
+ for ( hContact = ( HANDLE )YAHOO_CallService( MS_DB_CONTACT_FINDFIRST, 0, 0 );
+ hContact != NULL;
+ hContact = ( HANDLE )YAHOO_CallService( MS_DB_CONTACT_FINDNEXT, ( WPARAM )hContact, 0 ))
+ {
+ szProto = ( char* )YAHOO_CallService( MS_PROTO_GETCONTACTBASEPROTO, ( WPARAM )hContact, 0 );
+ if ( szProto != NULL && !lstrcmp( szProto, yahooProtocolName ))
+ {
+ DBVARIANT dbv;
+ if ( DBGetContactSetting( hContact, yahooProtocolName, YAHOO_LOGINID, &dbv ))
+ continue;
+
+ {
+ int tCompareResult = lstrcmpi( dbv.pszVal, yahoo_id );
+ DBFreeVariant( &dbv );
+ if ( tCompareResult )
+ continue;
+ }
+
+ return hContact;
+ }
+ }
+
+ return NULL;
+}
+
+HANDLE add_buddy( const char *yahoo_id, const char *yahoo_name, DWORD flags )
+{
+ //char *szProto;
+ HANDLE hContact;
+ //DBVARIANT dbv;
+
+ hContact = getbuddyH(yahoo_id);
+ if (hContact != NULL) {
+ LOG(("[add_buddy] Found buddy id: %s, handle: %lu", yahoo_id, (DWORD)hContact));
+ if ( !( flags & PALF_TEMPORARY ) && DBGetContactSettingByte( hContact, "CList", "NotOnList", 1 ))
+ {
+ LOG(("[add_buddy] Making Perm id: %s, flags: %lu", yahoo_id, flags));
+ DBDeleteContactSetting( hContact, "CList", "NotOnList" );
+ DBDeleteContactSetting( hContact, "CList", "Hidden" );
+
+ }
+ return hContact;
+ }
+
+ //not already there: add
+ LOG(("[add_buddy] Adding buddy id: %s, flags: %lu", yahoo_id, flags));
+ hContact = ( HANDLE )YAHOO_CallService( MS_DB_CONTACT_ADD, 0, 0 );
+ YAHOO_CallService( MS_PROTO_ADDTOCONTACT, ( WPARAM )hContact,( LPARAM )yahooProtocolName );
+ YAHOO_SetString( hContact, YAHOO_LOGINID, yahoo_id );
+ if (lstrlen(yahoo_name) > 0)
+ YAHOO_SetStringUtf( hContact, "Nick", yahoo_name );
+ else
+ YAHOO_SetStringUtf( hContact, "Nick", yahoo_id );
+
+ //DBWriteContactSettingWord(hContact, yahooProtocolName, "Status", ID_STATUS_OFFLINE);
+
+ if (flags & PALF_TEMPORARY ) {
+ DBWriteContactSettingByte( hContact, "CList", "NotOnList", 1 );
+ DBWriteContactSettingByte( hContact, "CList", "Hidden", 1 );
+ }
+ return hContact;
+}
+
+const char *find_buddy( const char *yahoo_id)
+{
+ //char *szProto;
+ static char nick[128];
+ HANDLE hContact;
+ DBVARIANT dbv;
+
+ hContact = getbuddyH(yahoo_id);
+ if (hContact != NULL) {
+ if ( DBGetContactSetting( hContact, yahooProtocolName, "Nick", &dbv ))
+ return NULL;
+
+ strncpy(nick, dbv.pszVal, 128);
+ DBFreeVariant( &dbv );
+ return nick;
+
+ }
+
+ return NULL;
+}
+
+/* Required handlers bellow */
+
+/* Other handlers */
+void ext_yahoo_status_changed(int id, const char *who, int stat, const char *msg, int away, int idle, int mobile)
+{
+ HANDLE hContact = 0;
+ time_t idlets = 0;
+
+ YAHOO_DebugLog("ext_yahoo_status_changed for %s with msg %s (stat: %d, away: %d, idle: %d seconds)", who, msg, stat, away, idle);
+
+ hContact = getbuddyH(who);
+ if (hContact == NULL) {
+ YAHOO_DebugLog("Buddy Not Found. Adding...");
+ hContact = add_buddy(who, who, 0);
+ } else {
+ YAHOO_DebugLog("Buddy Found On My List! Buddy %p", hContact);
+ }
+
+ if (!mobile)
+ YAHOO_SetWord(hContact, "Status", yahoo_to_miranda_status(stat,away));
+ else
+ YAHOO_SetWord(hContact, "Status", ID_STATUS_ONTHEPHONE);
+
+ YAHOO_SetWord(hContact, "YStatus", stat);
+ YAHOO_SetWord(hContact, "YAway", away);
+ YAHOO_SetWord(hContact, "Mobile", mobile);
+
+ if(msg) {
+ LOG(("%s custom message '%s'", who, msg));
+ //YAHOO_SetString(hContact, "YMsg", msg);
+ //DBWriteContactSettingString( hContact, "CList", "StatusMsg", msg);
+ DBWriteContactSettingStringUtf( hContact, "CList", "StatusMsg", msg);
+ } else {
+ //YAHOO_SetString(hContact, "YMsg", "");
+ DBDeleteContactSetting(hContact, "CList", "StatusMsg" );
+ }
+
+ /*if (stat == YAHOO_STATUS_OFFLINE)
+ DBDeleteContactSetting(hContact, yahooProtocolName, "MirVer" );*/
+
+ if ( (away == 2) || (stat == YAHOO_STATUS_IDLE) || (idle > 0)) {
+ if (stat > 0) {
+ LOG(("%s idle for %d:%02d:%02d", who, idle/3600, (idle/60)%60, idle%60));
+
+ time(&idlets);
+ idlets -= idle;
+ }
+ }
+
+ DBWriteContactSettingDword(hContact, yahooProtocolName, "IdleTS", idlets);
+
+ LOG(("[ext_yahoo_status_changed] exiting"));
+}
+
+void ext_yahoo_status_logon(int id, const char *who, int stat, const char *msg, int away, int idle, int mobile, int cksum, int buddy_icon, long client_version)
+{
+ HANDLE hContact = 0;
+ char *s = NULL;
+
+ LOG(("[ext_yahoo_status_logon] %s with msg %s (stat: %d, away: %d, idle: %d seconds, checksum: %d buddy_icon: %d client_version: %ld)", who, msg, stat, away, idle, cksum, buddy_icon, client_version));
+
+ ext_yahoo_status_changed(id, who, stat, msg, away, idle, mobile);
+ hContact = getbuddyH(who);
+ if (hContact == NULL) {
+ YAHOO_DebugLog("[ext_yahoo_status_logon] Can't find handle for %s??? PANIC!!!", who);
+ return;
+ }
+
+ switch (client_version) {
+ case 262651: s = "libyahoo2"; break;
+ case 262655: s = "< Yahoo 6.x (Yahoo 5.x?)"; break;
+ case 278527: s = "Yahoo 6.x"; break;
+ case 524223: s = "Yahoo 7.x"; break;
+ }
+
+ if (s != NULL)
+ DBWriteContactSettingString( hContact, yahooProtocolName, "MirVer", s);
+
+ /* Last thing check the checksum and request new one if we need to */
+ if (buddy_icon == -1) {
+ LOG(("[ext_yahoo_status_logon] No avatar information in this packet? Not touching stuff!"));
+ } else {
+ // we got some avatartype info
+ DBWriteContactSettingByte(hContact, yahooProtocolName, "AvatarType", buddy_icon);
+
+ if (cksum == 0 || cksum == -1){
+ // no avatar
+ DBWriteContactSettingDword(hContact, yahooProtocolName, "PictCK", 0);
+ } else if (DBGetContactSettingDword(hContact, yahooProtocolName,"PictCK", 0) != cksum) {
+ char szFile[MAX_PATH];
+
+ // Save new Checksum
+ DBWriteContactSettingDword(hContact, yahooProtocolName, "PictCK", cksum);
+
+ // Need to delete the Avatar File!!
+ GetAvatarFileName(hContact, szFile, sizeof szFile, 0);
+ DeleteFile(szFile);
+ }
+
+ // Cleanup the type? and reset things...
+ yahoo_reset_avatar(hContact);
+ }
+ LOG(("[ext_yahoo_status_logon] exiting"));
+}
+
+void ext_yahoo_got_audible(int id, const char *me, const char *who, const char *aud, const char *msg, const char *aud_hash)
+{
+ HANDLE hContact = 0;
+ char z[1024];
+
+ /* aud = file class name
+ GAIM: the audible, in foo.bar.baz format
+
+ Actually this is the filename.
+ Full URL:
+
+ http://us.dl1.yimg.com/download.yahoo.com/dl/aud/us/aud.swf
+
+ where aud in foo.bar.baz format
+ */
+
+ LOG(("ext_yahoo_got_audible for %s aud: %s msg:'%s' hash: %s", who, aud, msg, aud_hash));
+
+ hContact = getbuddyH(who);
+ if (hContact == NULL) {
+ LOG(("Buddy Not Found. Skipping avatar update"));
+ return;
+ }
+
+ _snprintf(z, sizeof(z), "[miranda-audible] %s", msg ?msg:"");
+ ext_yahoo_got_im(id, (char*)me, (char*)who, z, 0, 0, 1, -1);
+}
+
+void ext_yahoo_got_calendar(int id, const char *url, int type, const char *msg, int svc)
+{
+ LOG(("[ext_yahoo_got_calendar] URL:%s type: %d msg: %s svc: %d", url, type, msg, svc));
+
+ if (!YAHOO_ShowPopup( Translate("Calendar Reminder"), msg, url))
+ YAHOO_shownotification(Translate("Calendar Reminder"), msg, NIIF_INFO);
+}
+
+void ext_yahoo_got_picture_upload(int id, const char *me, const char *url,unsigned int ts)
+{
+ int cksum = 0;
+ DBVARIANT dbv;
+
+ LOG(("[ext_yahoo_got_picture_upload] url: %s timestamp: %d", url, ts));
+
+ if (!url) {
+ LOG(("[ext_yahoo_got_picture_upload] Problem with upload?"));
+ return;
+ }
+
+ cksum = YAHOO_GetDword("TMPAvatarHash", 0);
+ if (cksum != 0) {
+ LOG(("[ext_yahoo_got_picture_upload] Updating Checksum to: %d", cksum));
+ YAHOO_SetDword("AvatarHash", cksum);
+ DBDeleteContactSetting(NULL, yahooProtocolName, "TMPAvatarHash");
+
+ // This is only meant for message sessions, but we don't got those in miranda yet
+ YAHOO_bcast_picture_checksum(cksum);
+ // need to tell the stupid Yahoo that our icon updated
+ YAHOO_bcast_picture_update(2);
+ }
+
+ YAHOO_SetString(NULL, "AvatarURL", url);
+
+ if (!DBGetContactSetting(NULL, yahooProtocolName, "AvatarInv", &dbv) ){
+ LOG(("[ext_yahoo_got_picture_upload] Buddy: %s told us this is bad??", dbv.pszVal));
+
+ LOG(("[ext_yahoo_got_picture] Sending url: %s checksum: %d to '%s'!", url, cksum, dbv.pszVal));
+ //void yahoo_send_picture_info(int id, const char *me, const char *who, const char *pic_url, int cksum)
+ yahoo_send_picture_info(id, dbv.pszVal, 2, url, cksum);
+
+ DBDeleteContactSetting(NULL, yahooProtocolName, "AvatarInv");
+ DBFreeVariant(&dbv);
+ }
+}
+
+void ext_yahoo_got_avatar_share(int id, int buddy_icon)
+{
+ LOG(("[ext_yahoo_got_avatar_share] buddy icon: %d", buddy_icon));
+
+ YAHOO_SetByte( "ShareAvatar", buddy_icon );
+}
+
+void ext_yahoo_got_stealth(int id, char *stealthlist)
+{
+ char **s;
+ int found = 0;
+ char **stealth = NULL;
+ char *szProto;
+ HANDLE hContact;
+
+ LOG(("[ext_yahoo_got_stealth] list: %s", stealthlist));
+
+ if (stealthlist)
+ stealth = y_strsplit(stealthlist, ",", -1);
+
+
+ for ( hContact = ( HANDLE )YAHOO_CallService( MS_DB_CONTACT_FINDFIRST, 0, 0 );
+ hContact != NULL;
+ hContact = ( HANDLE )YAHOO_CallService( MS_DB_CONTACT_FINDNEXT, ( WPARAM )hContact, 0 ))
+ {
+ szProto = ( char* )YAHOO_CallService( MS_PROTO_GETCONTACTBASEPROTO, ( WPARAM )hContact, 0 );
+ if ( szProto != NULL && !lstrcmp( szProto, yahooProtocolName )) {
+ DBVARIANT dbv;
+ if ( DBGetContactSetting( hContact, yahooProtocolName, YAHOO_LOGINID, &dbv ))
+ continue;
+
+ found = 0;
+
+ for(s = stealth; s && *s; s++) {
+
+ if (lstrcmpi(*s, dbv.pszVal) == 0) {
+ YAHOO_DebugLog("GOT id = %s", dbv.pszVal);
+ found = 1;
+ break;
+ }
+ }
+
+ /* Check the stealth list */
+ if (found) { /* we have him on our Stealth List */
+ YAHOO_DebugLog("Setting STEALTH for id = %s", dbv.pszVal);
+ /* need to set the ApparentMode thingy */
+ if (ID_STATUS_OFFLINE != DBGetContactSettingWord(hContact, yahooProtocolName, "ApparentMode", 0))
+ DBWriteContactSettingWord(hContact, yahooProtocolName, "ApparentMode", (WORD) ID_STATUS_OFFLINE);
+
+ } else { /* he is not on the Stealth List */
+ //LOG(("Resetting STEALTH for id = %s", dbv.pszVal));
+ /* need to delete the ApparentMode thingy */
+ if (DBGetContactSettingWord(hContact, yahooProtocolName, "ApparentMode", 0))
+ DBDeleteContactSetting(hContact, yahooProtocolName, "ApparentMode");
+ }
+
+ DBFreeVariant( &dbv );
+ }
+ }
+}
+
+
+void ext_yahoo_got_buddies(int id, YList * buds)
+{
+ LOG(("ext_yahoo_got_buddies"));
+
+ if (buds == NULL) {
+ LOG(("No Buddies to work on!"));
+ return;
+ }
+
+ LOG(("Walking buddy list..."));
+ for(; buds; buds = buds->next) {
+ HANDLE hContact;
+
+ struct yahoo_buddy *bud = buds->data;
+ if (bud == NULL) {
+ LOG(("EMPTY BUDDY LIST??"));
+ continue;
+ }
+
+ if (bud->real_name)
+ YAHOO_DebugLog("id = %s name = %s", bud->id, bud->real_name);
+
+ hContact = getbuddyH(bud->id);
+ if (hContact == NULL)
+ hContact = add_buddy(bud->id, (bud->real_name != NULL) ? bud->real_name : bud->id, 0);
+
+ if (bud->group)
+ YAHOO_SetString( hContact, "YGroup", bud->group);
+
+ if (bud->yab_entry) {
+ //LOG(("YAB_ENTRY"));
+
+ if (bud->yab_entry->fname)
+ YAHOO_SetStringUtf( hContact, "FirstName", bud->yab_entry->fname);
+
+
+ if (bud->yab_entry->lname)
+ YAHOO_SetStringUtf( hContact, "LastName", bud->yab_entry->lname);
+
+
+ if (bud->yab_entry->nname)
+ YAHOO_SetStringUtf( hContact, "Nick", bud->yab_entry->nname);
+
+
+ if (bud->yab_entry->email)
+ YAHOO_SetString( hContact, "e-mail", bud->yab_entry->email);
+
+ if (bud->yab_entry->mphone)
+ YAHOO_SetString( hContact, "Cellular", bud->yab_entry->mphone);
+
+ if (bud->yab_entry->hphone)
+ YAHOO_SetString( hContact, "Phone", bud->yab_entry->hphone);
+
+ if (bud->yab_entry->wphone)
+ YAHOO_SetString( hContact, "CompanyPhone", bud->yab_entry->wphone);
+
+ YAHOO_SetWord( hContact, "YabID", bud->yab_entry->dbid);
+
+ }
+
+
+ }
+
+}
+
+void ext_yahoo_got_ignore(int id, YList * igns)
+{
+ LOG(("ext_yahoo_got_ignore"));
+}
+
+void ext_yahoo_rejected(int id, const char *who, const char *msg)
+{
+ char buff[1024]={0};
+ HANDLE hContact;
+ LOG(("[ext_yahoo_rejected] who: %s msg: %s", who, msg));
+ snprintf(buff, sizeof(buff), Translate("%s has rejected your request and sent the following message:"), who);
+
+ hContact = getbuddyH(who);
+
+ if (hContact != NULL) {
+ /*
+ * Make sure the contact is temporary so we could delete it w/o extra traffic
+ */
+ DBWriteContactSettingByte( hContact, "CList", "NotOnList", 1 );
+ YAHOO_CallService( MS_DB_CONTACT_DELETE, (WPARAM) hContact, 0);
+ } else {
+ LOG(("[ext_yahoo_rejected] Buddy not on our buddy list"));
+ }
+
+ MessageBox( NULL, msg, buff, MB_OK | MB_ICONINFORMATION );
+
+}
+
+void YAHOO_add_buddy(const char *who, const char *group, const char *msg)
+{
+ /* We adding a buddy to our list.
+ 2 Stages.
+ 1. We send add buddy packet.
+ 2. We get a packet back from the server confirming add.
+
+ No refresh needed. */
+ yahoo_add_buddy(ylad->id, who, group, msg);
+}
+
+void ext_yahoo_buddy_added(int id, char *myid, char *who, char *group, int status, int auth)
+{
+ LOG(("[ext_yahoo_buddy_added] %s authorized you as %s group: %s status: %d auth: %d", who, myid, group, status, auth));
+
+}
+
+void ext_yahoo_buddy_group_changed(int id, char *myid, char *who, char *old_group, char *new_group)
+{
+LOG(("[ext_yahoo_buddy_group_changed] %s has been moved from group: %s to: %s", who, old_group, new_group));
+}
+
+void ext_yahoo_contact_added(int id, char *myid, char *who, char *fname, char *lname, char *msg)
+{
+ char *szBlob,*pCurBlob;
+ char m[1024];
+ HANDLE hContact=NULL;
+ CCSDATA ccs;
+ PROTORECVEVENT pre;
+
+ /* NOTE: Msg is actually in UTF8 unless stated otherwise!! */
+ LOG(("[ext_yahoo_contact_added] %s added you as %s w/ msg '%s'", who, myid, msg));
+
+ hContact = add_buddy(who, who, PALF_TEMPORARY);
+
+ ccs.szProtoService= PSR_AUTH;
+ ccs.hContact=hContact;
+ ccs.wParam=0;
+ ccs.lParam=(LPARAM)&pre;
+ pre.flags=0;
+ pre.timestamp=time(NULL);
+
+ pre.lParam=sizeof(DWORD)*2+lstrlen(who)+lstrlen(who)+5;
+
+ if (fname != NULL)
+ pre.lParam += lstrlen(fname);
+
+ if (lname != NULL)
+ pre.lParam += lstrlen(lname);
+
+ if (msg != NULL)
+ pre.lParam += lstrlen(msg);
+
+ pCurBlob=szBlob=(char *)malloc(pre.lParam);
+ /*
+ Auth blob is: uin(DWORD),hcontact(HANDLE),nick(ASCIIZ),first(ASCIIZ),
+ last(ASCIIZ),email(ASCIIZ),reason(ASCIIZ)
+
+ blob is: 0(DWORD), nick(ASCIIZ), fname (ASCIIZ), lname (ASCIIZ), email(ASCIIZ), msg(ASCIIZ)
+
+ */
+
+ // UIN
+ *( PDWORD )pCurBlob = 0;
+ pCurBlob+=sizeof(DWORD);
+
+ // hContact
+ *( PDWORD )pCurBlob = ( DWORD )hContact;
+ pCurBlob+=sizeof(DWORD);
+
+ // NICK
+ lstrcpy((char *)pCurBlob,who);
+ pCurBlob+=lstrlen((char *)pCurBlob)+1;
+
+ // FIRST
+ if (fname != NULL)
+ lstrcpyn(m, fname, sizeof(m));
+ else
+ m[0] = '\0';
+
+ lstrcpy((char *)pCurBlob,m);
+ pCurBlob+=lstrlen((char *)pCurBlob)+1;
+
+ // LAST
+ if (lname != NULL)
+ lstrcpyn(m, lname, sizeof(m));
+ else
+ m[0] = '\0';
+
+ lstrcpy((char *)pCurBlob,m);
+ pCurBlob+=lstrlen((char *)pCurBlob)+1;
+
+ // E-mail
+ lstrcpy((char *)pCurBlob,who);
+ pCurBlob+=lstrlen((char *)pCurBlob)+1;
+
+ // Reason
+ if (msg != NULL)
+ lstrcpyn(m, msg, sizeof(m));
+ else
+ m[0] = '\0';
+
+ lstrcpy((char *)pCurBlob, m);
+
+ pre.szMessage=(char *)szBlob;
+ CallService(MS_PROTO_CHAINRECV,0,(LPARAM)&ccs);
+}
+
+void ext_yahoo_typing_notify(int id, const char *me, const char *who, int stat)
+{
+ const char *c;
+ HANDLE hContact;
+
+ LOG(("[ext_yahoo_typing_notify] me: '%s' who: '%s' stat: %d ", me, who, stat));
+
+ hContact = getbuddyH(who);
+ if (!hContact) return;
+
+ c = YAHOO_GetContactName(hContact);
+
+ CallService(MS_PROTO_CONTACTISTYPING, (WPARAM)hContact, (LPARAM)stat?10:0);
+}
+
+void ext_yahoo_game_notify(int id, const char *me, const char *who, int stat, const char *msg)
+{
+ HANDLE hContact;
+
+ /* There's also game invite packet:
+ [17:36:44 YAHOO] libyahoo2/libyahoo2.c:3093: debug:
+[17:36:44 YAHOO] Yahoo Service: (null) (0xb7) Status: YAHOO_STATUS_BRB (1)
+[17:36:44 YAHOO]
+[17:36:44 YAHOO] libyahoo2/libyahoo2.c:863: debug:
+[17:36:44 YAHOO] [Reading packet] len: 88
+[17:36:44 YAHOO]
+[17:36:44 YAHOO] Key: From (4) Value: 'xxxxx'
+[17:36:44 YAHOO]
+[17:36:44 YAHOO] Key: To (5) Value: 'zxzxxx'
+[17:36:44 YAHOO]
+[17:36:44 YAHOO] Key: (null) (180) Value: 'pl'
+[17:36:44 YAHOO]
+[17:36:44 YAHOO] Key: (null) (183) Value: ''
+[17:36:44 YAHOO]
+[17:36:44 YAHOO] Key: (null) (181) Value: ''
+[17:36:44 YAHOO]
+[17:36:44 YAHOO] Key: session (11) Value: 'o8114ik_lixyxtdfrxbogw--'
+[17:36:44 YAHOO]
+[17:36:44 YAHOO] Key: stat/location (13) Value: '1'
+[17:36:44 YAHOO]
+[17:36:44 YAHOO] libyahoo2/libyahoo2.c:908: debug:
+[17:36:44 YAHOO] [Reading packet done]
+
+ */
+ LOG(("[ext_yahoo_game_notify] id: %d, me: %s, who: %s, stat: %d, msg: %s", id, me, who, stat, msg));
+ /* FIXME - Not Implemented - this informs you someone else is playing on Yahoo! Games */
+ /* Also Stubbed in Sample Client */
+ hContact = getbuddyH(who);
+ if (!hContact) return;
+
+ if (stat == 2)
+ YAHOO_SetString(hContact, "YGMsg", "");
+ else if (msg) {
+ char z[1024];
+ char *c;
+ const char *l = msg, *u = NULL;
+ int i = 0;
+
+ /* Parse and Set a custom Message
+ *
+ * Format: 1 [09] ygamesp [09] 1 [09] 0 [09] ante?room=yahoo_1078798506&follow=rrrrrrr
+ * [09] Yahoo! Poker\nRoom: Intermediate Lounge 2
+ *
+ * Sign-in:
+ * [17:13:42 YAHOO] [ext_yahoo_game_notify] id: 1, me: xxxxx, who: rrrrrrr,
+ * stat: 1, msg: 1 ygamesa 1 0 ante?room=yahoo_1043183792&follow=lotesdelere
+ * Yahoo! Backgammon Room: Social Lounge 12
+ *
+ * Sign-out:
+ * [17:18:38 YAHOO] [ext_yahoo_game_notify] id: 1, me: xxxxx, who: rrrrr,
+ * stat: 2, msg: 1 ygamesa 2
+ */
+ z[0]='\0';
+ do{
+ c = strchr(l, 0x09);
+ i++;
+ if (c != NULL) {
+ l = c;
+ l++;
+ if (i == 4)
+ u = l;
+ }
+ } while (c != NULL && i < 5);
+
+ if (c != NULL) {
+ // insert \r before \n
+ do{
+ c = strchr(l, '\n');
+
+ if (c != NULL) {
+ (*c) = '\0';
+ lstrcat(z, l);
+ lstrcat(z, "\r\n");
+ l = c + 1;
+ } else {
+ lstrcat(z, l);
+ }
+ } while (c != NULL);
+
+ lstrcat(z, "\r\n\r\nhttp://games.yahoo.com/games/");
+ lstrcat(z, u);
+ c = strchr(z, 0x09);
+ (*c) = '\0';
+ }
+
+ YAHOO_SetString(hContact, "YGMsg", z);
+
+ } else {
+ /* ? no information / reset custom message */
+ YAHOO_SetString(hContact, "YGMsg", "");
+ }
+}
+
+void ext_yahoo_mail_notify(int id, const char *from, const char *subj, int cnt)
+{
+ LOG(("[ext_yahoo_mail_notify] from: %s subject: %s count: %d", from, subj, cnt));
+
+ if (cnt > 0) {
+ SkinPlaySound( Translate( "mail" ) );
+
+ if (!YAHOO_GetByte( "DisableYahoomail", 0)) {
+ char z[MAX_SECONDLINE], title[MAX_CONTACTNAME];
+
+ LOG(("ext_yahoo_mail_notify"));
+
+ if (from == NULL) {
+ lstrcpyn(title, Translate("New Mail"), sizeof(title));
+ snprintf(z, sizeof(z), Translate("You Have %i unread msgs"), cnt);
+ } else {
+ snprintf(title, sizeof(title), Translate("New Mail (%i msgs)"), cnt);
+ snprintf(z, sizeof(z), Translate("From: %s\nSubject: %s"), from, subj);
+ }
+
+ if(!YAHOO_ShowPopup( title, z, "http://mail.yahoo.com" ))
+ YAHOO_shownotification(title, z, NIIF_INFO);
+ }
+ }
+}
+
+void ext_yahoo_system_message(int id, const char *me, const char *who, const char *msg)
+{
+ LOG(("Yahoo System Message to: %s from: %s msg: %s", me, who, msg));
+
+ if (strncmp(msg, "A user on Windows Live", lstrlen("A user on Windows Live")) != 0)
+ YAHOO_ShowPopup( (who != NULL) ? who : "Yahoo System Message", msg, NULL);
+}
+
+void ext_yahoo_got_identities(int id, YList * ids)
+{
+ LOG(("ext_yahoo_got_identities"));
+ /* FIXME - Not implemented - Got list of Yahoo! identities */
+ /* We currently only use the default identity */
+ /* Also Stubbed in Sample Client */
+
+}
+
+void __cdecl yahoo_get_yab_thread(void *psf)
+{
+ int id = (int)psf;
+
+ yahoo_get_yab(id);
+}
+
+char * getcookie(char *rawcookie);
+
+void check_for_update(void)
+{
+ NETLIBHTTPREQUEST nlhr={0},*nlhrReply;
+ NETLIBHTTPHEADER httpHeaders[3];
+
+ nlhr.cbSize=sizeof(nlhr);
+ nlhr.requestType=REQUEST_GET;
+ nlhr.flags=NLHRF_DUMPASTEXT|NLHRF_GENERATEHOST|NLHRF_SMARTAUTHHEADER|NLHRF_HTTP11;
+ nlhr.szUrl="http://update.messenger.yahoo.com/msgrcli7.html";//url.sz;
+ nlhr.headers = httpHeaders;
+ nlhr.headersCount= 3;
+
+ httpHeaders[0].szName="Accept";
+ httpHeaders[0].szValue="*/*";
+ httpHeaders[1].szName="User-Agent";
+ httpHeaders[1].szValue="Mozilla Compatible/2.0 (WinNT; I; NCC/2.0)";
+ httpHeaders[2].szName="Pragma";
+ httpHeaders[2].szValue="no-cache";
+
+ nlhrReply=(NETLIBHTTPREQUEST*)CallService(MS_NETLIB_HTTPTRANSACTION,(WPARAM)hNetlibUser,(LPARAM)&nlhr);
+
+ if(nlhrReply) {
+ int i;
+
+ if (nlhrReply->resultCode != 200) {
+ LOG(("Update server returned '%d' instead of 200. It also sent the following: %s", nlhrReply->resultCode, nlhrReply->szResultDescr));
+ return;
+ }
+
+ LOG(("Got %d headers!", nlhrReply->headersCount));
+
+ for (i=0; i < nlhrReply->headersCount; i++) {
+ LOG(("%s: %s", nlhrReply->headers[i].szName, nlhrReply->headers[i].szValue));
+
+ if (lstrcmpi(nlhrReply->headers[i].szName, "Set-Cookie") == 0) {
+ LOG(("Found Cookie... Yum yum..."));
+
+ if (nlhrReply->headers[i].szValue[0] == 'B' && nlhrReply->headers[i].szValue[1] == '=') {
+ char *b;
+
+ b = getcookie(nlhrReply->headers[i].szValue);
+
+ LOG(("Got B Cookie: %s", b));
+ }
+ }
+ }
+ CallService(MS_NETLIB_FREEHTTPREQUESTSTRUCT,0,(LPARAM)nlhrReply);
+ }
+}
+void ext_yahoo_got_cookies(int id)
+{
+// char z[1024];
+
+ LOG(("ext_yahoo_got_cookies "));
+/* LOG(("Y Cookie: '%s'", yahoo_get_cookie(id, "y")));
+ LOG(("T Cookie: '%s'", yahoo_get_cookie(id, "t")));
+ LOG(("C Cookie: '%s'", yahoo_get_cookie(id, "c")));
+ LOG(("Login Cookie: '%s'", yahoo_get_cookie(id, "login")));
+
+ //wsprintf(z, "Cookie: %s; C=%s; Y=%s; T=%s", Bcookie, yahoo_get_cookie(id, "c"), yahoo_get_cookie(id, "y"), yahoo_get_cookie(id, "t"));
+ //wsprintf(z, "Cookie: %s; Y=%s", Bcookie, yahoo_get_cookie(id, "y"), yahoo_get_cookie(id, "t"));
+ wsprintf(z, "Cookie: Y=%s; T=%s", yahoo_get_cookie(id, "y"), yahoo_get_cookie(id, "t"));
+ LOG(("Our Cookie: '%s'", z));
+ YAHOO_CallService(MS_NETLIB_SETSTICKYHEADERS, (WPARAM)hnuMain, (LPARAM)z);*/
+
+#ifdef HTTP_GATEWAY
+ if (iHTTPGateway) {
+ char z[1024];
+
+ // need to add Cookie header to our requests or we get booted w/ "Bad Cookie" message.
+ mir_snprintf(z, sizeof(z), "Cookie: Y=%s; T=%s; C=%s", yahoo_get_cookie(id, "y"),
+ yahoo_get_cookie(id, "t"), yahoo_get_cookie(id, "c"));
+ LOG(("Our Cookie: '%s'", z));
+ YAHOO_CallService(MS_NETLIB_SETSTICKYHEADERS, (WPARAM)hNetlibUser, (LPARAM)z);
+ }
+#endif
+
+ /*if (YAHOO_GetByte( "UseYAB", 1 )) {
+ LOG(("GET YAB [Before final check] "));
+ if (yahooStatus != ID_STATUS_OFFLINE)
+ //yahoo_get_yab(id);
+ check_for_update();
+ pthread_create(yahoo_get_yab_thread, (void *)id);
+ }*/
+}
+
+void ext_yahoo_got_ping(int id, const char *errormsg)
+{
+ LOG(("[ext_yahoo_got_ping]"));
+
+ if (errormsg) {
+ LOG(("[ext_yahoo_got_ping] Error msg: %s", errormsg));
+ YAHOO_ShowError(Translate("Yahoo Ping Error"), errormsg);
+ return;
+ }
+
+ LOG(("[ext_yahoo_got_ping] Status Check current: %d, CONNECTING: %d ", yahooStatus, ID_STATUS_CONNECTING));
+
+ if (yahooStatus == ID_STATUS_CONNECTING) {
+ LOG(("[ext_yahoo_got_ping] We are connecting. Checking for different status. Start: %d, Current: %d", gStartStatus, yahooStatus));
+ if (gStartStatus != yahooStatus) {
+ LOG(("[COOKIES] Updating Status to %d ", gStartStatus));
+
+ if (gStartStatus != ID_STATUS_INVISIBLE) {// don't generate a bogus packet for Invisible state
+ if (szStartMsg != NULL) {
+ yahoo_set_status(YAHOO_STATUS_CUSTOM, szStartMsg, (gStartStatus != ID_STATUS_ONLINE) ? 1 : 0);
+ } else
+ yahoo_set_status(gStartStatus, NULL, (gStartStatus != ID_STATUS_ONLINE) ? 1 : 0);
+ }
+
+ yahoo_util_broadcaststatus(gStartStatus);
+ yahooLoggedIn=TRUE;
+ }
+ }
+}
+
+void ext_yahoo_login_response(int id, int succ, const char *url)
+{
+ char buff[1024];
+
+ LOG(("ext_yahoo_login_response"));
+
+ if(succ == YAHOO_LOGIN_OK) {
+ ylad->status = yahoo_current_status(id);
+ LOG(("logged in status-> %d", ylad->status));
+
+ if (YAHOO_GetByte( "UseYAB", 1 )) {
+ LOG(("GET YAB [Before final check] "));
+ if (yahooStatus != ID_STATUS_OFFLINE)
+ pthread_create(yahoo_get_yab_thread, (void *)id);
+ }
+
+ return;
+ } else if(succ == YAHOO_LOGIN_UNAME) {
+
+ snprintf(buff, sizeof(buff), Translate("Could not log into Yahoo service - username not recognised. Please verify that your username is correctly typed."));
+ } else if(succ == YAHOO_LOGIN_PASSWD) {
+
+ snprintf(buff, sizeof(buff), Translate("Could not log into Yahoo service - password incorrect. Please verify that your username and password are correctly typed."));
+
+ } else if(succ == YAHOO_LOGIN_LOCK) {
+
+ snprintf(buff, sizeof(buff), Translate("Could not log into Yahoo service. Your account has been locked.\nVisit %s to reactivate it."), url);
+
+ } else if(succ == YAHOO_LOGIN_DUPL) {
+ snprintf(buff, sizeof(buff), Translate("You have been logged out of the yahoo service, possibly due to a duplicate login."));
+ ProtoBroadcastAck(yahooProtocolName, NULL, ACKTYPE_LOGIN, ACKRESULT_FAILED, NULL, LOGINERR_OTHERLOCATION);
+ }else if(succ == YAHOO_LOGIN_LOGOFF) {
+ snprintf(buff, sizeof(buff), Translate("You have been logged out of the yahoo service."));
+ //ProtoBroadcastAck(yahooProtocolName, NULL, ACKTYPE_LOGIN, ACKRESULT_FAILED, NULL, LOGINERR_OTHERLOCATION);
+ }else if(succ == -1) {
+ /// Can't Connect or got disconnected.
+ if (yahooStatus == ID_STATUS_CONNECTING)
+ snprintf(buff, sizeof(buff), Translate("Could not connect to the Yahoo service. Check your server/port and proxy settings."));
+ else
+ return;
+ } else {
+ snprintf(buff, sizeof(buff),Translate("Could not log in, unknown reason: %d."), succ);
+ }
+
+ YAHOO_DebugLog("ERROR: %s", buff);
+
+ /*
+ * Show Error Message
+ */
+ YAHOO_ShowError(Translate("Yahoo Login Error"), buff);
+
+ yahooLoggedIn = FALSE; /* don't send logout message */
+ yahoo_logout();
+}
+
+void ext_yahoo_error(int id, const char *err, int fatal, int num)
+{
+ char buff[1024];
+
+ LOG(("Yahoo Error: id: %d, fatal: %d, num: %d, %s", id, fatal, num, err));
+
+ switch(num) {
+ case E_UNKNOWN:
+ snprintf(buff, sizeof(buff), Translate("Unknown error %s"), err);
+ break;
+ case E_CUSTOM:
+ snprintf(buff, sizeof(buff), Translate("Custom error %s"), err);
+ break;
+ case E_CONFNOTAVAIL:
+ snprintf(buff, sizeof(buff), Translate("%s is not available for the conference"), err);
+ break;
+ case E_IGNOREDUP:
+ snprintf(buff, sizeof(buff), Translate("%s is already ignored"), err);
+ break;
+ case E_IGNORENONE:
+ snprintf(buff, sizeof(buff), Translate("%s is not in the ignore list"), err);
+ break;
+ case E_IGNORECONF:
+ snprintf(buff, sizeof(buff), Translate("%s is in buddy list - cannot ignore "), err);
+ break;
+ case E_SYSTEM:
+ snprintf(buff, sizeof(buff), Translate("System Error: %s"), err);
+ break;
+ case E_CONNECTION:
+ snprintf(buff, sizeof(buff), Translate("Server Connection Error: %s"), err);
+ break;
+ }
+
+ YAHOO_DebugLog("Error: %s", buff);
+
+ /*
+ * Show Error Message
+ */
+ if (yahooStatus != ID_STATUS_OFFLINE) {
+ // Show error only if we are not offline. [manual status changed]
+ YAHOO_ShowError(Translate("Yahoo Error"), buff);
+ }
+
+}
+
+int ext_yahoo_connect(const char *h, int p, int type)
+{
+ NETLIBOPENCONNECTION ncon = {0};
+ HANDLE con;
+
+ LOG(("ext_yahoo_connect %s:%d", h, p));
+
+ ncon.cbSize = sizeof(ncon);
+ ncon.szHost = h;
+ ncon.wPort = p;
+
+ if (type != YAHOO_CONNECTION_PAGER)
+ ncon.flags = NLOCF_HTTP;
+
+
+ con = (HANDLE) CallService(MS_NETLIB_OPENCONNECTION, (WPARAM) hNetlibUser, (LPARAM) & ncon);
+ if (con == NULL) {
+ LOG(("ERROR: Connect Failed!"));
+ return -1;
+ }
+
+ return (int)con;
+}
+
+/*************************************
+ * Callback handling code starts here
+ */
+YList *connections = NULL;
+static int connection_tags=0;
+
+int ext_yahoo_add_handler(int id, int fd, yahoo_input_condition cond, void *data)
+{
+ struct _conn *c = y_new0(struct _conn, 1);
+ c->tag = ++connection_tags;
+ c->id = id;
+ c->fd = fd;
+ c->cond = cond;
+ c->data = data;
+
+ LOG(("Add %d for %d, tag %d", fd, id, c->tag));
+
+ connections = y_list_prepend(connections, c);
+
+ return c->tag;
+}
+
+void ext_yahoo_remove_handler(int id, int tag)
+{
+ YList *l;
+ LOG(("ext_yahoo_remove_handler id:%d tag:%d ", id, tag));
+
+ for(l = connections; l; l = y_list_next(l)) {
+ struct _conn *c = l->data;
+ if(c->tag == tag) {
+ /* don't actually remove it, just mark it for removal */
+ /* we'll remove when we start the next poll cycle */
+ LOG(("Marking id:%d fd:%d tag:%d for removal", c->id, c->fd, c->tag));
+ c->remove = 1;
+ return;
+ }
+ }
+}
+
+struct connect_callback_data {
+ yahoo_connect_callback callback;
+ void * callback_data;
+ int id;
+ int tag;
+};
+
+static void connect_complete(void *data, int source, yahoo_input_condition condition)
+{
+ struct connect_callback_data *ccd = data;
+ int error = 0;//, err_size = sizeof(error);
+ NETLIBSELECT tSelect = {0};
+
+ ext_yahoo_remove_handler(0, ccd->tag);
+
+ // We Need to read the Socket error
+ //getsockopt(source, SOL_SOCKET, SO_ERROR, &error, (socklen_t *)&err_size);
+
+ tSelect.cbSize = sizeof( tSelect );
+ //tSelect.dwTimeout = T->mGatewayTimeout * 1000;
+ tSelect.dwTimeout = 1;
+ tSelect.hReadConns[ 0 ] = ( HANDLE )source;
+ error = YAHOO_CallService( MS_NETLIB_SELECT, 0, ( LPARAM )&tSelect );
+
+ if(error) {
+ //close(source);
+ Netlib_CloseHandle((HANDLE)source);
+ source = -1;
+ }
+
+ LOG(("Connected fd: %d, error: %d", source, error));
+
+ ccd->callback(source, error, ccd->callback_data);
+ FREE(ccd);
+}
+
+void yahoo_callback(struct _conn *c, yahoo_input_condition cond)
+{
+ int ret=1;
+
+ LOG(("[yahoo_callback] id: %d, fd: %d tag: %d", c->id, c->fd, c->tag));
+ if(c->id < 0) {
+ connect_complete(c->data, c->fd, cond);
+ } else if (c->fd > 0) {
+
+ if(cond & YAHOO_INPUT_READ)
+ ret = yahoo_read_ready(c->id, c->fd, c->data);
+ if(ret>0 && cond & YAHOO_INPUT_WRITE)
+ ret = yahoo_write_ready(c->id, c->fd, c->data);
+
+ if (ret == -1) {
+ LOG(("Yahoo read error (%d): %s", errno, strerror(errno)));
+ } else if(ret == 0)
+ LOG(("Yahoo read error: Server closed socket"));
+ }
+
+ LOG(("[yahoo_callback] id: %d exiting...", c->id));
+}
+
+int ext_yahoo_connect_async(int id, const char *host, int port, int type,
+ yahoo_connect_callback callback, void *data)
+{
+ int res;
+
+ LOG(("ext_yahoo_connect_async %s:%d type: %d", host, port, type));
+
+ res = ext_yahoo_connect(host, port, type);
+
+ /*
+ * need to call the callback so we could handle the failure condition!!!
+ * fd = -1 in case of an error
+ */
+ callback(res, 0, data);
+
+ /*
+ * Return proper thing: 0 - ok, -1 - failed, >0 - pending connect
+ */
+ return (res <= 0) ? -1 : 0;
+}
+/*
+ * Callback handling code ends here
+ ***********************************/
+
+void register_callbacks()
+{
+ static struct yahoo_callbacks yc;
+
+ yc.ext_yahoo_login_response = ext_yahoo_login_response;
+ yc.ext_yahoo_got_buddies = ext_yahoo_got_buddies;
+ yc.ext_yahoo_got_ignore = ext_yahoo_got_ignore;
+ yc.ext_yahoo_got_identities = ext_yahoo_got_identities;
+ yc.ext_yahoo_got_cookies = ext_yahoo_got_cookies;
+ yc.ext_yahoo_status_changed = ext_yahoo_status_changed;
+ yc.ext_yahoo_status_logon = ext_yahoo_status_logon;
+ yc.ext_yahoo_got_im = ext_yahoo_got_im;
+ yc.ext_yahoo_got_conf_invite = ext_yahoo_got_conf_invite;
+ yc.ext_yahoo_conf_userdecline = ext_yahoo_conf_userdecline;
+ yc.ext_yahoo_conf_userjoin = ext_yahoo_conf_userjoin;
+ yc.ext_yahoo_conf_userleave = ext_yahoo_conf_userleave;
+ yc.ext_yahoo_conf_message = ext_yahoo_conf_message;
+ yc.ext_yahoo_chat_cat_xml = ext_yahoo_chat_cat_xml;
+ yc.ext_yahoo_chat_join = ext_yahoo_chat_join;
+ yc.ext_yahoo_chat_userjoin = ext_yahoo_chat_userjoin;
+ yc.ext_yahoo_chat_userleave = ext_yahoo_chat_userleave;
+ yc.ext_yahoo_chat_message = ext_yahoo_chat_message;
+ yc.ext_yahoo_chat_yahoologout = ext_yahoo_chat_yahoologout;
+ yc.ext_yahoo_chat_yahooerror = ext_yahoo_chat_yahooerror;
+ yc.ext_yahoo_got_webcam_image = ext_yahoo_got_webcam_image;
+ yc.ext_yahoo_webcam_invite = ext_yahoo_webcam_invite;
+ yc.ext_yahoo_webcam_invite_reply = ext_yahoo_webcam_invite_reply;
+ yc.ext_yahoo_webcam_closed = ext_yahoo_webcam_closed;
+ yc.ext_yahoo_webcam_viewer = ext_yahoo_webcam_viewer;
+ yc.ext_yahoo_webcam_data_request = ext_yahoo_webcam_data_request;
+ yc.ext_yahoo_got_file = ext_yahoo_got_file;
+ yc.ext_yahoo_contact_added = ext_yahoo_contact_added;
+ yc.ext_yahoo_rejected = ext_yahoo_rejected;
+ yc.ext_yahoo_typing_notify = ext_yahoo_typing_notify;
+ yc.ext_yahoo_game_notify = ext_yahoo_game_notify;
+ yc.ext_yahoo_mail_notify = ext_yahoo_mail_notify;
+ yc.ext_yahoo_got_search_result = ext_yahoo_got_search_result;
+ yc.ext_yahoo_system_message = ext_yahoo_system_message;
+ yc.ext_yahoo_error = ext_yahoo_error;
+ yc.ext_yahoo_log = YAHOO_DebugLog;
+ yc.ext_yahoo_add_handler = ext_yahoo_add_handler;
+ yc.ext_yahoo_remove_handler = ext_yahoo_remove_handler;
+ yc.ext_yahoo_connect = ext_yahoo_connect;
+ yc.ext_yahoo_connect_async = ext_yahoo_connect_async;
+
+ yc.ext_yahoo_got_stealthlist = ext_yahoo_got_stealth;
+ yc.ext_yahoo_got_ping = ext_yahoo_got_ping;
+ yc.ext_yahoo_got_picture = ext_yahoo_got_picture;
+ yc.ext_yahoo_got_picture_checksum = ext_yahoo_got_picture_checksum;
+ yc.ext_yahoo_got_picture_update = ext_yahoo_got_picture_update;
+ yc.ext_yahoo_got_avatar_share = ext_yahoo_got_avatar_share;
+
+ yc.ext_yahoo_buddy_added = ext_yahoo_buddy_added;
+ yc.ext_yahoo_got_picture_upload = ext_yahoo_got_picture_upload;
+ yc.ext_yahoo_got_avatar_update = ext_yahoo_got_avatar_update;
+ yc.ext_yahoo_got_audible = ext_yahoo_got_audible;
+ yc.ext_yahoo_got_calendar = ext_yahoo_got_calendar;
+ yc.ext_yahoo_buddy_group_changed = ext_yahoo_buddy_group_changed;
+
+ yahoo_register_callbacks(&yc);
+
+}
+
+void ext_yahoo_login(int login_mode)
+{
+ char host[128], fthost[128];
+ int port=0;
+ DBVARIANT dbv;
+#ifdef HTTP_GATEWAY
+ NETLIBUSERSETTINGS nlus = { 0 };
+#endif
+
+ LOG(("ext_yahoo_login"));
+
+ if (!DBGetContactSetting(NULL, yahooProtocolName, YAHOO_LOGINSERVER, &dbv)) {
+ mir_snprintf(host, sizeof(host), "%s", dbv.pszVal);
+ DBFreeVariant(&dbv);
+ }
+ else {
+ //_snprintf(host, sizeof(host), "%s", pager_host);
+ YAHOO_ShowError(Translate("Yahoo Login Error"), Translate("Please enter Yahoo server to Connect to in Options."));
+
+ return;
+ }
+
+ lstrcpyn(fthost,YAHOO_GetByte("YahooJapan",0)?"filetransfer.msg.yahoo.co.jp":"filetransfer.msg.yahoo.com" , sizeof(fthost));
+ port = DBGetContactSettingWord(NULL, yahooProtocolName, YAHOO_LOGINPORT, 5050);
+
+#ifdef HTTP_GATEWAY
+ nlus.cbSize = sizeof( nlus );
+ if (CallService(MS_NETLIB_GETUSERSETTINGS, (WPARAM) hNetlibUser, (LPARAM) &nlus) == 0) {
+ LOG(("ERROR: Problem retrieving miranda network settings!!!"));
+ }
+
+ iHTTPGateway = (nlus.useProxy && nlus.proxyType == PROXYTYPE_HTTP) ? 1:0;
+ LOG(("Proxy Type: %d HTTP Gateway: %d", nlus.proxyType, iHTTPGateway));
+#endif
+
+ //ylad->id = yahoo_init(ylad->yahoo_id, ylad->password);
+ ylad->id = yahoo_init_with_attributes(ylad->yahoo_id, ylad->password,
+ "pager_host", host,
+ "pager_port", port,
+ "filetransfer_host", fthost,
+ "picture_checksum", YAHOO_GetDword("AvatarHash", -1),
+#ifdef HTTP_GATEWAY
+ "web_messenger", iHTTPGateway,
+#endif
+ NULL);
+
+ ylad->status = YAHOO_STATUS_OFFLINE;
+ yahoo_login(ylad->id, login_mode);
+
+ if (ylad == NULL || ylad->id <= 0) {
+ LOG(("Could not connect to Yahoo server. Please verify that you are connected to the net and the pager host and port are correctly entered."));
+ YAHOO_ShowError(Translate("Yahoo Login Error"), Translate("Could not connect to Yahoo server. Please verify that you are connected to the net and the pager host and port are correctly entered."));
+ return;
+ }
+
+ //rearm(&pingTimer, 600);
+}
+
+void YAHOO_refresh()
+{
+ yahoo_refresh(ylad->id);
+}
+
+
+
diff --git a/miranda-wine/protocols/Yahoo/yahoo.h b/miranda-wine/protocols/Yahoo/yahoo.h
new file mode 100644
index 0000000..15e7c59
--- /dev/null
+++ b/miranda-wine/protocols/Yahoo/yahoo.h
@@ -0,0 +1,208 @@
+/*
+ * $Id: yahoo.h 3676 2006-09-01 18:02:28Z gena01 $
+ *
+ * myYahoo Miranda Plugin
+ *
+ * Authors: Gennady Feldman (aka Gena01)
+ * Laurent Marechal (aka Peorth)
+ *
+ * This code is under GPL and is based on AIM, MSN and Miranda source code.
+ * I want to thank Robert Rainwater and George Hazan for their code and support
+ * and for answering some of my questions during development of this plugin.
+ */
+#ifndef _YAHOO_YAHOO_H_
+#define _YAHOO_YAHOO_H_
+
+#include <windows.h>
+
+/*
+ * Yahoo Services
+ */
+#include "pthread.h"
+
+//#include "libyahoo2/config.h"
+#define USE_STRUCT_CALLBACKS
+
+#include "libyahoo2/yahoo2.h"
+#include "libyahoo2/yahoo2_callbacks.h"
+#include "libyahoo2/yahoo_util.h"
+
+#include <newpluginapi.h>
+#include <m_database.h>
+#include <m_protomod.h>
+#include <m_netlib.h>
+#include <m_clist.h>
+
+//=======================================================
+// Definitions
+//=======================================================
+// Build is a cvs build
+//
+// If defined, the build will add cvs info to the plugin info
+#define YAHOO_CVSBUILD
+
+//#define modname "myYahoo"
+#define YAHOO_LOGINSERVER "LoginServer"
+#define YAHOO_LOGINPORT "LoginPort"
+#define YAHOO_LOGINID "yahoo_id"
+#define YAHOO_PASSWORD "Password"
+#define YAHOO_CHECKMAIL "CheckMail"
+#define YAHOO_TNOTIF "TypeNotif"
+#define YAHOO_CUSTSTATDB "CustomStat"
+#define YAHOO_ALLOW_MSGBOX 1
+#define YAHOO_ALLOW_ENTER 2
+#define YAHOO_MAIL_POPUP 4
+#define YAHOO_NOTIFY_POPUP 8
+#define YAHOO_DEFAULT_PORT 5050
+#define YAHOO_DEFAULT_LOGIN_SERVER "scs.msg.yahoo.com"
+#define YAHOO_DEFAULT_JAPAN_LOGIN_SERVER "cs.yahoo.co.jp"
+#define YAHOO_CUSTOM_STATUS 99
+
+#define YAHOO_DEBUGLOG YAHOO_DebugLog
+
+extern int do_yahoo_debug;
+
+#define LOG(x) if(do_yahoo_debug) { YAHOO_DEBUGLOG("%s:%d: ", __FILE__, __LINE__); \
+ YAHOO_DEBUGLOG x; \
+ YAHOO_DEBUGLOG(" ");}
+
+#define YAHOO_SET_CUST_STAT "/SetCustomStatCommand"
+#define YAHOO_SHOW_PROFILE "/YahooShowProfileCommand"
+#define YAHOO_SHOW_MY_PROFILE "/YahooShowMyProfileCommand"
+#define YAHOO_YAHOO_MAIL "/YahooGotoMailboxCommand"
+#define YAHOO_REFRESH "/YahooRefreshCommand"
+#define YAHOO_AB "/YahooAddressBook"
+#define YAHOO_CALENDAR "/YahooCalendar"
+#define YAHOO_SEND_NUDGE "/SendNudge"
+
+#define STYLE_DEFAULTBGCOLOUR RGB(173,206,247)
+
+#define MENU_ITEMS_COUNT 7
+extern HANDLE YahooMenuItems[ MENU_ITEMS_COUNT ];
+
+#define LocalEventUnhook(hook) if(hook) UnhookEvent(hook)
+#define NEWSTR_ALLOCA(A) (A==NULL)?NULL:strcpy((char*)alloca(strlen(A)+1),A)
+
+struct _conn {
+ int tag;
+ int id;
+ int fd;
+ yahoo_input_condition cond;
+ void *data;
+ int remove;
+};
+
+//=======================================================
+// Defines
+//=======================================================
+//General
+extern HANDLE hNetlibUser;
+extern HINSTANCE hinstance;
+extern int yahooStatus;
+extern char yahooProtocolName[MAX_PATH];
+extern BOOL yahooLoggedIn;
+
+extern HANDLE YahooMenuItems[ MENU_ITEMS_COUNT ];
+extern pthread_mutex_t connectionHandleMutex;
+
+#ifdef HTTP_GATEWAY
+extern int iHTTPGateway;
+#endif
+
+//int ext_yahoo_log(char *fmt,...);
+
+HANDLE __stdcall YAHOO_CreateProtoServiceFunction(
+ const char* szService,
+ MIRANDASERVICE serviceProc );
+
+int __stdcall YAHOO_CallService( const char* szSvcName, WPARAM wParam, LPARAM lParam );
+
+#ifdef __GNUC__
+int YAHOO_DebugLog( const char *fmt, ... ) __attribute__ ((format (printf, 1, 2)));
+#else
+int YAHOO_DebugLog( const char *fmt, ... );
+#endif
+
+DWORD __stdcall YAHOO_GetByte( const char* valueName, int parDefltValue );
+DWORD __stdcall YAHOO_SetByte( const char* valueName, int parValue );
+
+DWORD __stdcall YAHOO_GetDword( const char* valueName, DWORD parDefltValue );
+DWORD __stdcall YAHOO_SetDword( const char* valueName, DWORD parValue );
+
+WORD __stdcall YAHOO_GetWord( HANDLE hContact, const char* valueName, int parDefltValue );
+DWORD __stdcall YAHOO_SetWord( HANDLE hContact, const char* valueName, int parValue );
+
+int __stdcall YAHOO_SendBroadcast( HANDLE hContact, int type, int result, HANDLE hProcess, LPARAM lParam );
+
+DWORD __stdcall YAHOO_SetString( HANDLE hContact, const char* valueName, const char* parValue );
+DWORD __stdcall YAHOO_SetStringUtf( HANDLE hContact, const char* valueName, const char* parValue );
+
+int __stdcall YAHOO_ShowPopup( const char* nickname, const char* msg, const char *szURL );
+
+#define YAHOO_hasnotification() ServiceExists(MS_CLIST_SYSTRAY_NOTIFY)
+
+int YAHOO_shownotification(const char *title, const char *info, DWORD flags);
+int YAHOO_util_dbsettingchanged(WPARAM wParam, LPARAM lParam);
+void YAHOO_utils_logversion();
+void YAHOO_ShowError(const char *title, const char *buff);
+
+//Services.c
+int GetCaps(WPARAM wParam,LPARAM lParam);
+int GetName(WPARAM wParam,LPARAM lParam);
+int SetStatus(WPARAM wParam,LPARAM lParam);
+int GetStatus(WPARAM wParam,LPARAM lParam);
+void yahoo_util_broadcaststatus(int s);
+void __cdecl yahoo_server_main(void *empty);
+const char *find_buddy( const char *yahoo_id);
+HANDLE getbuddyH(const char *yahoo_id);
+
+void yahoo_logoff_buddies();
+void yahoo_set_status(int myyahooStatus, char *msg, int away);
+int miranda_to_yahoo(int myyahooStatus);
+void yahoo_stealth(const char *buddy, int add);
+const YList* YAHOO_GetIgnoreList(void);
+void YAHOO_IgnoreBuddy(const char *buddy, int ignore);
+
+void register_callbacks();
+char* YAHOO_GetContactName(HANDLE hContact);
+
+void YAHOO_remove_buddy(const char *who);
+void YAHOO_reject(const char *who, const char *msg);
+void YAHOO_accept(const char *who);
+void YAHOO_add_buddy(const char *who, const char *group, const char *msg);
+HANDLE add_buddy( const char *yahoo_id, const char *yahoo_name, DWORD flags );
+void YAHOO_sendtyping(const char *who, int stat);
+
+typedef struct {
+ char yahoo_id[255];
+ char name[255];
+ int status;
+ int away;
+ char *msg;
+ char group[255];
+} yahoo_account;
+
+typedef struct {
+ char yahoo_id[255];
+ char password[255];
+ int id;
+ int fd;
+ int status;
+ char *msg;
+ int rpkts;
+} yahoo_local_account;
+
+void SetButtonCheck(HWND hwndDlg, int CtrlID, BOOL bCheck);
+void YahooOpenURL(const char *url, int autoLogin);
+
+char * yahoo_status_code(enum yahoo_status s);
+void YAHOO_refresh();
+int LoadYahooServices(void);
+void yahoo_logout();
+void yahoo_callback(struct _conn *c, yahoo_input_condition cond);
+void ext_yahoo_login(int login_mode);
+void __stdcall Utf8Decode( char* str, int maxSize, wchar_t** ucs2 );
+char* __stdcall Utf8EncodeUcs2( const wchar_t* src );
+int YahooGotoMailboxCommand( WPARAM wParam, LPARAM lParam );
+
+#endif