예제 #1
0
void sipmsg_parse_p_asserted_identity(const gchar *header, gchar **sip_uri,
				      gchar **tel_uri) {
	gchar **parts, **p;

	*sip_uri = NULL;
	*tel_uri = NULL;

	if (g_ascii_strncasecmp(header, "tel:", 4) == 0) {
		*tel_uri = g_strdup(header);
		return;
	}

	parts = g_strsplit(header, ",", 0);
	
	for (p = parts; *p; p++) {
		gchar *uri = sipmsg_find_part_of_header(*p, "<", ">", NULL);
		if (!uri)
			continue;

		if (g_ascii_strncasecmp(uri, "sip:", 4) == 0) {
			if (*sip_uri) {
				SIPE_DEBUG_WARNING_NOFORMAT("More than one "
					"sip: URI found in P-Asserted-Identity!");
			} else {
				*sip_uri = uri;
				uri = NULL;
			}
		} else if (g_ascii_strncasecmp(uri, "tel:", 4) == 0){
			if (*tel_uri) {
				SIPE_DEBUG_WARNING_NOFORMAT("More than one "
					"tel: URI found in P-Asserted-Identity!");
			} else {
				*tel_uri = uri;
				uri = NULL;
			}
		}

		g_free(uri);
	}

	g_strfreev(parts);
}
예제 #2
0
void sipe_backend_chat_operator(struct sipe_backend_chat_session *backend_session,
				const gchar *uri)
{
	SIPPROTO *pr;
	GCEVENT gce = {0};
	GCDEST gcd = {0};
	HANDLE hContact;
	gchar *nick;
	struct sipe_core_public *sipe_public;

	if (!backend_session)
	{
		SIPE_DEBUG_WARNING_NOFORMAT("Attempted to set operator on NULL backend_session");
		return;
	}

	pr = backend_session->pr;
	sipe_public = pr->sip;

	hContact = sipe_backend_buddy_find( sipe_public, uri, NULL );
	nick = sipe_miranda_getContactString(pr, hContact, "Nick");

	gce.cbSize = sizeof(gce);
	gce.pDest = &gcd;
	gce.pszNick = nick;
	gce.pszUID = uri;
	gce.pszText = "Presenter";
	gce.pszStatus = "Presenter";

	gcd.pszModule = pr->proto.m_szModuleName;
	gcd.pszID = backend_session->conv;
	gcd.iType = GC_EVENT_ADDSTATUS;

	if (CallServiceSync( MS_GC_EVENT, 0, (LPARAM)&gce ))
	{
		SIPE_DEBUG_WARNING_NOFORMAT("Failed to set presenter status");
	}
	mir_free(nick);
}
예제 #3
0
static void callback_serror(void *user_data, xmlErrorPtr error)
{
	struct _parser_data *pd = user_data;

	if (error && (error->level == XML_ERR_ERROR ||
	              error->level == XML_ERR_FATAL)) {
		pd->error = TRUE;
		SIPE_DEBUG_ERROR("XML parser error: Domain %i, code %i, level %i: %s",
				 error->domain, error->code, error->level,
				 error->message ? error->message : "(null)");
	} else if (error) {
		SIPE_DEBUG_WARNING("XML parser error: Domain %i, code %i, level %i: %s",
		                   error->domain, error->code, error->level,
				   error->message ? error->message : "(null)");
	} else {
		/* *sigh* macro expects at least two parameters */
		SIPE_DEBUG_WARNING_NOFORMAT("XML parser error");
	}
}
예제 #4
0
void sipe_backend_chat_close(struct sipe_backend_chat_session *backend_session)
{
	SIPPROTO *pr;
	GCEVENT gce = {0};
	GCDEST gcd = {0};
	struct sipe_chat_session *session;

	if (!backend_session)
	{
		SIPE_DEBUG_WARNING_NOFORMAT("Attempted to close NULL backend_session");
		return;
	}

	pr = backend_session->pr;

	gce.cbSize = sizeof(gce);
	gce.pDest = &gcd;

	gcd.pszModule = pr->proto.m_szModuleName;
	gcd.pszID = backend_session->conv;
	gcd.iType = GC_EVENT_CONTROL;

	session = (struct sipe_chat_session*)CallServiceSync( MS_GC_EVENT, SESSION_TERMINATE, (LPARAM)&gce );
}
예제 #5
0
struct sipe_backend_chat_session *sipe_backend_chat_create(struct sipe_core_public *sipe_public,
							   struct sipe_chat_session *session,
							   const gchar *title,
							   const gchar *nick)
{
	SIPPROTO *pr = sipe_public->backend_private;
	GCSESSION gs;
	GCDEST gcd = {0};
	GCEVENT gce = {0};
	gchar *id = g_strdup(title); /* FIXME: Generate ID */
	struct sipe_backend_chat_session *conv = g_new0(struct sipe_backend_chat_session,1);

	gs.cbSize = sizeof(gs);
	gs.iType = GCW_CHATROOM;
	gs.pszModule = pr->proto.m_szModuleName;
	gs.pszName = title;
	gs.pszID = id;
	gs.pszStatusbarText = NULL;
	gs.dwFlags = 0;
	gs.dwItemData = (DWORD)session;

	if (CallServiceSync( MS_GC_NEWSESSION, 0, (LPARAM)&gs ))
	{
		SIPE_DEBUG_ERROR("Failed to create chat session <%d> <%s>", id, title);
	}

	gcd.pszModule = pr->proto.m_szModuleName;
	gcd.pszID = id;

	gce.cbSize = sizeof(gce);
	gce.pDest = &gcd;

	gcd.iType = GC_EVENT_ADDGROUP;
	gce.pszStatus = "Normal";
	if (CallService( MS_GC_EVENT, 0, (LPARAM)&gce ))
	{
		SIPE_DEBUG_WARNING_NOFORMAT("Failed to add normal status to chat session");
	}

	gce.pszStatus = "Presenter";
	if (CallService( MS_GC_EVENT, 0, (LPARAM)&gce ))
	{
		SIPE_DEBUG_WARNING_NOFORMAT("Failed to add presenter status to chat session");
	}


	gcd.iType = GC_EVENT_CONTROL;

	if (CallServiceSync( MS_GC_EVENT, SESSION_INITDONE, (LPARAM)&gce ))
	{
		SIPE_DEBUG_WARNING_NOFORMAT("Failed to initdone chat session");
	}
	if (CallServiceSync( MS_GC_EVENT, SESSION_ONLINE, (LPARAM)&gce ))
	{
		SIPE_DEBUG_ERROR_NOFORMAT("Failed to set chat session online");
	}

	conv->conv = id;
	conv->pr = pr;

	return conv;
}