Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-1.1
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc-1.1
Commits
0b4f577d
Commit
0b4f577d
authored
Mar 28, 2010
by
Rémi Duraffort
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Growl: do not get the configuration for every item (get if at opening time only).
parent
1f3432f3
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
39 additions
and
18 deletions
+39
-18
modules/misc/notify/growl_udp.c
modules/misc/notify/growl_udp.c
+39
-18
No files found.
modules/misc/notify/growl_udp.c
View file @
0b4f577d
...
@@ -37,6 +37,16 @@
...
@@ -37,6 +37,16 @@
#include <vlc_network.h>
#include <vlc_network.h>
#include <vlc_md5.h>
#include <vlc_md5.h>
/*****************************************************************************
* intf_sys_t: description
*****************************************************************************/
struct
intf_sys_t
{
char
*
psz_password
;
char
*
psz_server
;
int
i_port
;
};
/*****************************************************************************
/*****************************************************************************
* Local prototypes
* Local prototypes
*****************************************************************************/
*****************************************************************************/
...
@@ -87,6 +97,23 @@ vlc_module_end ()
...
@@ -87,6 +97,23 @@ vlc_module_end ()
*****************************************************************************/
*****************************************************************************/
static
int
Open
(
vlc_object_t
*
p_this
)
static
int
Open
(
vlc_object_t
*
p_this
)
{
{
intf_thread_t
*
p_intf
=
(
intf_thread_t
*
)
p_this
;
intf_sys_t
*
p_sys
=
p_intf
->
p_sys
=
malloc
(
sizeof
(
intf_sys_t
)
);
if
(
!
p_sys
)
return
VLC_ENOMEM
;
p_sys
->
psz_password
=
var_InheritString
(
p_this
,
"growl-password"
);
p_sys
->
psz_server
=
var_InheritString
(
p_this
,
"growl-server"
);
p_sys
->
i_port
=
var_InheritInteger
(
p_this
,
"growl-port"
);
if
(
!
p_sys
->
psz_password
||
!
p_sys
->
psz_server
)
{
free
(
p_sys
->
psz_password
);
free
(
p_sys
->
psz_server
);
free
(
p_sys
);
return
VLC_EGENERIC
;
}
var_AddCallback
(
pl_Get
(
p_this
),
"item-current"
,
ItemChange
,
p_this
);
var_AddCallback
(
pl_Get
(
p_this
),
"item-current"
,
ItemChange
,
p_this
);
RegisterToGrowl
(
p_this
);
RegisterToGrowl
(
p_this
);
return
VLC_SUCCESS
;
return
VLC_SUCCESS
;
...
@@ -97,7 +124,13 @@ static int Open( vlc_object_t *p_this )
...
@@ -97,7 +124,13 @@ static int Open( vlc_object_t *p_this )
*****************************************************************************/
*****************************************************************************/
static
void
Close
(
vlc_object_t
*
p_this
)
static
void
Close
(
vlc_object_t
*
p_this
)
{
{
intf_sys_t
*
p_sys
=
((
intf_thread_t
*
)
p_this
)
->
p_sys
;
var_DelCallback
(
pl_Get
(
p_this
),
"item-current"
,
ItemChange
,
p_this
);
var_DelCallback
(
pl_Get
(
p_this
),
"item-current"
,
ItemChange
,
p_this
);
free
(
p_sys
->
psz_password
);
free
(
p_sys
->
psz_server
);
free
(
p_sys
);
}
}
/*****************************************************************************
/*****************************************************************************
...
@@ -262,21 +295,16 @@ static int NotifyToGrowl( vlc_object_t *p_this, const char *psz_desc )
...
@@ -262,21 +295,16 @@ static int NotifyToGrowl( vlc_object_t *p_this, const char *psz_desc )
static
int
CheckAndSend
(
vlc_object_t
*
p_this
,
uint8_t
*
p_data
,
int
i_offset
,
size_t
i_size
)
static
int
CheckAndSend
(
vlc_object_t
*
p_this
,
uint8_t
*
p_data
,
int
i_offset
,
size_t
i_size
)
{
{
intf_sys_t
*
p_sys
=
((
intf_thread_t
*
)
p_this
)
->
p_sys
;
int
i_handle
;
int
i_handle
;
struct
md5_s
md5
;
struct
md5_s
md5
;
char
*
psz_password
=
var_InheritString
(
p_this
,
"growl-password"
);
char
*
psz_server
=
var_InheritString
(
p_this
,
"growl-server"
);
int
i_port
=
var_InheritInteger
(
p_this
,
"growl-port"
);
if
(
!
psz_password
||
!
psz_server
)
goto
error
;
int
i_password_length
=
strlen
(
psz_password
);
int
i_password_length
=
strlen
(
p
_sys
->
p
sz_password
);
// Check that the buffer is larger enought for the string and the md5
// Check that the buffer is larger enought for the string and the md5
if
(
i_offset
+
i_password_length
+
4
*
4
>=
i_size
)
if
(
i_offset
+
i_password_length
+
4
*
4
>=
i_size
)
goto
error
;
return
VLC_EGENERIC
;
strcpy
(
(
char
*
)(
p_data
+
i_offset
),
psz_password
);
strcpy
(
(
char
*
)(
p_data
+
i_offset
),
p
_sys
->
p
sz_password
);
InitMD5
(
&
md5
);
InitMD5
(
&
md5
);
AddMD5
(
&
md5
,
p_data
,
i_offset
+
i_password_length
);
AddMD5
(
&
md5
,
p_data
,
i_offset
+
i_password_length
);
...
@@ -290,11 +318,11 @@ static int CheckAndSend( vlc_object_t *p_this, uint8_t* p_data, int i_offset, si
...
@@ -290,11 +318,11 @@ static int CheckAndSend( vlc_object_t *p_this, uint8_t* p_data, int i_offset, si
p_data
[
i_offset
++
]
=
(
md5
.
p_digest
[
i
]
>>
24
)
&
0xFF
;
p_data
[
i_offset
++
]
=
(
md5
.
p_digest
[
i
]
>>
24
)
&
0xFF
;
}
}
i_handle
=
net_ConnectUDP
(
p_this
,
p
sz_server
,
i_port
,
-
1
);
i_handle
=
net_ConnectUDP
(
p_this
,
p
_sys
->
psz_server
,
p_sys
->
i_port
,
-
1
);
if
(
i_handle
==
-
1
)
if
(
i_handle
==
-
1
)
{
{
msg_Err
(
p_this
,
"failed to open a connection (udp)"
);
msg_Err
(
p_this
,
"failed to open a connection (udp)"
);
goto
error
;
return
VLC_EGENERIC
;
}
}
shutdown
(
i_handle
,
SHUT_RD
);
shutdown
(
i_handle
,
SHUT_RD
);
...
@@ -304,14 +332,7 @@ static int CheckAndSend( vlc_object_t *p_this, uint8_t* p_data, int i_offset, si
...
@@ -304,14 +332,7 @@ static int CheckAndSend( vlc_object_t *p_this, uint8_t* p_data, int i_offset, si
}
}
net_Close
(
i_handle
);
net_Close
(
i_handle
);
free
(
psz_password
);
free
(
psz_server
);
return
VLC_SUCCESS
;
return
VLC_SUCCESS
;
error:
free
(
psz_password
);
free
(
psz_server
);
return
VLC_EGENERIC
;
}
}
#undef GROWL_PROTOCOL_VERSION
#undef GROWL_PROTOCOL_VERSION
...
...
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