Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mpd
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Иван Мажукин
mpd
Commits
cb35d6e6
Commit
cb35d6e6
authored
Apr 01, 2009
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
sticker_print: new library for sending stickers to a client
parent
efcf40f5
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
90 additions
and
11 deletions
+90
-11
Makefile.am
Makefile.am
+5
-1
command.c
src/command.c
+3
-10
sticker_print.c
src/sticker_print.c
+43
-0
sticker_print.h
src/sticker_print.h
+39
-0
No files found.
Makefile.am
View file @
cb35d6e6
...
@@ -134,6 +134,7 @@ mpd_headers = \
...
@@ -134,6 +134,7 @@ mpd_headers = \
src/state_file.h
\
src/state_file.h
\
src/stats.h
\
src/stats.h
\
src/sticker.h
\
src/sticker.h
\
src/sticker_print.h
\
src/tag.h
\
src/tag.h
\
src/tag_internal.h
\
src/tag_internal.h
\
src/tag_pool.h
\
src/tag_pool.h
\
...
@@ -243,7 +244,10 @@ src_mpd_SOURCES = \
...
@@ -243,7 +244,10 @@ src_mpd_SOURCES = \
src/timer.c
src/timer.c
if
ENABLE_SQLITE
if
ENABLE_SQLITE
src_mpd_SOURCES
+=
src/sticker.c src/song_sticker.c
src_mpd_SOURCES
+=
\
src/sticker.c
\
src/sticker_print.c
\
src/song_sticker.c
endif
endif
FILTER_CFLAGS
=
\
FILTER_CFLAGS
=
\
...
...
src/command.c
View file @
cb35d6e6
...
@@ -48,6 +48,7 @@
...
@@ -48,6 +48,7 @@
#ifdef ENABLE_SQLITE
#ifdef ENABLE_SQLITE
#include "sticker.h"
#include "sticker.h"
#include "sticker_print.h"
#include "song_sticker.h"
#include "song_sticker.h"
#endif
#endif
...
@@ -1506,14 +1507,6 @@ handle_idle(struct client *client,
...
@@ -1506,14 +1507,6 @@ handle_idle(struct client *client,
}
}
#ifdef ENABLE_SQLITE
#ifdef ENABLE_SQLITE
static
void
print_sticker
(
const
char
*
name
,
const
char
*
value
,
gpointer
data
)
{
struct
client
*
client
=
data
;
client_printf
(
client
,
"sticker: %s=%s
\n
"
,
name
,
value
);
}
static
enum
command_return
static
enum
command_return
handle_sticker_song
(
struct
client
*
client
,
int
argc
,
char
*
argv
[])
handle_sticker_song
(
struct
client
*
client
,
int
argc
,
char
*
argv
[])
{
{
...
@@ -1535,7 +1528,7 @@ handle_sticker_song(struct client *client, int argc, char *argv[])
...
@@ -1535,7 +1528,7 @@ handle_sticker_song(struct client *client, int argc, char *argv[])
return
COMMAND_RETURN_ERROR
;
return
COMMAND_RETURN_ERROR
;
}
}
client_printf
(
client
,
"sticker: %s=%s
\n
"
,
argv
[
4
],
value
);
sticker_print_value
(
client
,
argv
[
4
],
value
);
g_free
(
value
);
g_free
(
value
);
return
COMMAND_RETURN_OK
;
return
COMMAND_RETURN_OK
;
...
@@ -1547,7 +1540,7 @@ handle_sticker_song(struct client *client, int argc, char *argv[])
...
@@ -1547,7 +1540,7 @@ handle_sticker_song(struct client *client, int argc, char *argv[])
return
COMMAND_RETURN_ERROR
;
return
COMMAND_RETURN_ERROR
;
}
}
sticker_
foreach
(
sticker
,
print_sticker
,
client
);
sticker_
print
(
client
,
sticker
);
sticker_free
(
sticker
);
sticker_free
(
sticker
);
return
COMMAND_RETURN_OK
;
return
COMMAND_RETURN_OK
;
...
...
src/sticker_print.c
0 → 100644
View file @
cb35d6e6
/*
* Copyright (C) 2003-2009 The Music Player Daemon Project
* http://www.musicpd.org
*
* 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.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include "sticker_print.h"
#include "sticker.h"
#include "client.h"
void
sticker_print_value
(
struct
client
*
client
,
const
char
*
name
,
const
char
*
value
)
{
client_printf
(
client
,
"sticker: %s=%s
\n
"
,
name
,
value
);
}
static
void
print_sticker_cb
(
const
char
*
name
,
const
char
*
value
,
gpointer
data
)
{
struct
client
*
client
=
data
;
sticker_print_value
(
client
,
name
,
value
);
}
void
sticker_print
(
struct
client
*
client
,
const
struct
sticker
*
sticker
)
{
sticker_foreach
(
sticker
,
print_sticker_cb
,
client
);
}
src/sticker_print.h
0 → 100644
View file @
cb35d6e6
/*
* Copyright (C) 2003-2009 The Music Player Daemon Project
* http://www.musicpd.org
*
* 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.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#ifndef MPD_STICKER_PRINT_H
#define MPD_STICKER_PRINT_H
struct
sticker
;
struct
client
;
/**
* Sends one sticker value to the client.
*/
void
sticker_print_value
(
struct
client
*
client
,
const
char
*
name
,
const
char
*
value
);
/**
* Sends all sticker values to the client.
*/
void
sticker_print
(
struct
client
*
client
,
const
struct
sticker
*
sticker
);
#endif
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment