Merge pull request #996 from seven1240/event-merge

[core] add event::merge
This commit is contained in:
Andrey Volk 2020-12-17 21:28:32 +04:00 committed by GitHub
commit 3a6d1210d7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 19 additions and 0 deletions

View File

@ -176,6 +176,7 @@ SWITCH_DECLARE(bool) email(char *to, char *from, char *headers = NULL, char *bod
SWITCH_DECLARE(bool) addHeader(const char *header_name, const char *value);
SWITCH_DECLARE(bool) delHeader(const char *header_name);
SWITCH_DECLARE(bool) fire(void);
SWITCH_DECLARE(bool) merge(Event *to_merge);
};

View File

@ -520,6 +520,24 @@ SWITCH_DECLARE(const char *)Event::getType(void)
return (char *) "invalid";
}
SWITCH_DECLARE(bool)Event::merge(Event *to_merge)
{
this_check(false);
if (!event) {
switch_log_printf(SWITCH_CHANNEL_LOG,SWITCH_LOG_ERROR, "Trying to merge to an event that does not exist!\n");
return false;
}
if (!to_merge || !to_merge->event) {
switch_log_printf(SWITCH_CHANNEL_LOG,SWITCH_LOG_ERROR, "Trying to merge from an event that does not exist!\n");
return false;
}
switch_event_merge(event, to_merge->event);
return true;
}
SWITCH_DECLARE_CONSTRUCTOR DTMF::DTMF(char idigit, uint32_t iduration)
{