winamp: Clean up formatting

This commit is contained in:
TingPing 2015-04-13 16:21:14 -04:00
parent 72d7f64f8b
commit a8392c7f95
1 changed files with 96 additions and 109 deletions

View File

@ -50,7 +50,6 @@ song_strcpy (char *dest, char *src)
static int static int
winamp(char *word[], char *word_eol[], void *userdata) winamp(char *word[], char *word_eol[], void *userdata)
{ {
wchar_t wcurrent_play[2048]; wchar_t wcurrent_play[2048];
char *current_play, *p; char *current_play, *p;
char p_esc[2048]; char p_esc[2048];
@ -59,7 +58,6 @@ char truc[2048];
HWND hwndWinamp = FindWindowW(L"Winamp v1.x",NULL); HWND hwndWinamp = FindWindowW(L"Winamp v1.x",NULL);
if (hwndWinamp) if (hwndWinamp)
{
{ {
if (!stricmp("PAUSE", word[2])) if (!stricmp("PAUSE", word[2]))
{ {
@ -73,43 +71,32 @@ HWND hwndWinamp = FindWindowW(L"Winamp v1.x",NULL);
hexchat_printf(ph, "Winamp: paused"); hexchat_printf(ph, "Winamp: paused");
} }
} }
else else if (!stricmp("STOP", word[2]))
if (!stricmp("STOP", word[2]))
{ {
SendMessage(hwndWinamp, WM_COMMAND, 40047, 0); SendMessage(hwndWinamp, WM_COMMAND, 40047, 0);
hexchat_printf(ph, "Winamp: stopped"); hexchat_printf(ph, "Winamp: stopped");
} }
else else if (!stricmp("PLAY", word[2]))
if (!stricmp("PLAY", word[2]))
{ {
SendMessage(hwndWinamp, WM_COMMAND, 40045, 0); SendMessage(hwndWinamp, WM_COMMAND, 40045, 0);
hexchat_printf(ph, "Winamp: playing"); hexchat_printf(ph, "Winamp: playing");
} }
else else if (!stricmp("NEXT", word[2]))
if (!stricmp("NEXT", word[2]))
{ {
SendMessage(hwndWinamp, WM_COMMAND, 40048, 0); SendMessage(hwndWinamp, WM_COMMAND, 40048, 0);
hexchat_printf(ph, "Winamp: next playlist entry"); hexchat_printf(ph, "Winamp: next playlist entry");
} }
else else if (!stricmp("PREV", word[2]))
if (!stricmp("PREV", word[2]))
{ {
SendMessage(hwndWinamp, WM_COMMAND, 40044, 0); SendMessage(hwndWinamp, WM_COMMAND, 40044, 0);
hexchat_printf(ph, "Winamp: previous playlist entry"); hexchat_printf(ph, "Winamp: previous playlist entry");
} }
else else if (!stricmp("START", word[2]))
if (!stricmp("START", word[2]))
{ {
SendMessage(hwndWinamp, WM_COMMAND, 40154, 0); SendMessage(hwndWinamp, WM_COMMAND, 40154, 0);
hexchat_printf(ph, "Winamp: playlist start"); hexchat_printf(ph, "Winamp: playlist start");
} }
else if (!word_eol[2][0])
else
if (!word_eol[2][0])
{ {
int len = GetWindowTextW(hwndWinamp, wcurrent_play, sizeof(wcurrent_play)); int len = GetWindowTextW(hwndWinamp, wcurrent_play, sizeof(wcurrent_play));
@ -130,12 +117,13 @@ HWND hwndWinamp = FindWindowW(L"Winamp v1.x",NULL);
p--; p--;
} }
if (p >= current_play) p--; if (p >= current_play)
p--;
while (p >= current_play && *p == ' ') p--; while (p >= current_play && *p == ' ')
p--;
*++p=0; *++p=0;
p = strchr(current_play, '.') + 1; p = strchr(current_play, '.') + 1;
song_strcpy(p_esc, p); song_strcpy(p_esc, p);
@ -153,13 +141,12 @@ HWND hwndWinamp = FindWindowW(L"Winamp v1.x",NULL);
hexchat_commandf(ph, truc); hexchat_commandf(ph, truc);
g_free (current_play); g_free (current_play);
} }
else hexchat_print(ph, "Winamp: Nothing being played."); else
hexchat_print(ph, "Winamp: Nothing being played.");
} }
else else
hexchat_printf(ph, "Usage: /WINAMP [PAUSE|PLAY|STOP|NEXT|PREV|START]\n"); hexchat_printf(ph, "Usage: /WINAMP [PAUSE|PLAY|STOP|NEXT|PREV|START]\n");
} }
}
else else
{ {
hexchat_print(ph, "Winamp not found.\n"); hexchat_print(ph, "Winamp not found.\n");