/soc/2013/ashmew2/filetransferY: 1b9b916dd7fa: Tomasz' patch for...
Ashish Gupta
ashmew2 at gmail.com
Wed Feb 26 12:55:34 EST 2014
Changeset: 1b9b916dd7fa1981af1d78a7d93bc844be216439
Author: Ashish Gupta <ashmew2 at gmail.com>
Date: 2014-02-26 23:25 +0530
Branch: default
URL: https://hg.pidgin.im/soc/2013/ashmew2/filetransferY/rev/1b9b916dd7fa
Description:
Tomasz' patch for code style
diffstat:
libpurple/protocols/jabber/Makefile.am | 1 +
libpurple/protocols/jabber/google/google_session.c | 64 ++++----
libpurple/protocols/jabber/google/google_session.h | 48 +++---
libpurple/protocols/jabber/google/google_share.c | 147 +++++++++-----------
libpurple/protocols/jabber/jabber.c | 4 +-
libpurple/protocols/jabber/jabber.h | 2 +-
libpurple/protocols/jabber/namespaces.h | 1 +
libpurple/protocols/jabber/si.c | 8 +-
libpurple/protocols/yahoo/yahoo_filexfer.c | 2 +-
libpurple/xfer.c | 11 +-
10 files changed, 143 insertions(+), 145 deletions(-)
diffs (truncated from 787 to 300 lines):
diff --git a/libpurple/protocols/jabber/Makefile.am b/libpurple/protocols/jabber/Makefile.am
--- a/libpurple/protocols/jabber/Makefile.am
+++ b/libpurple/protocols/jabber/Makefile.am
@@ -118,6 +118,7 @@ libjabber_la_LIBADD = $(GLIB_LIBS) $(SA
$(FARSTREAM_LIBS) \
$(GSTREAMER_LIBS) \
$(LIBNICE_LIBS)
+
libfacebook_la_SOURCES = libfacebook.c
libfacebook_la_LIBADD = libjabber.la
diff --git a/libpurple/protocols/jabber/google/google_session.c b/libpurple/protocols/jabber/google/google_session.c
--- a/libpurple/protocols/jabber/google/google_session.c
+++ b/libpurple/protocols/jabber/google/google_session.c
@@ -462,8 +462,7 @@ jabber_google_relay_response_session_ini
return;
}
return;
- }
- else {
+ } else {
GParameter *params;
guint num_params;
@@ -478,28 +477,27 @@ jabber_google_relay_response_session_ini
purple_media_set_prpl_data(session_data->media, session);
g_signal_connect_swapped(G_OBJECT(session_data->media),
- "candidates-prepared",
- G_CALLBACK(google_session_ready), session);
+ "candidates-prepared",
+ G_CALLBACK(google_session_ready), session);
g_signal_connect_swapped(G_OBJECT(session_data->media), "codecs-changed",
- G_CALLBACK(google_session_ready), session);
+ G_CALLBACK(google_session_ready), session);
g_signal_connect(G_OBJECT(session_data->media), "state-changed",
- G_CALLBACK(google_session_state_changed_cb), session);
+ G_CALLBACK(google_session_state_changed_cb), session);
g_signal_connect(G_OBJECT(session_data->media), "stream-info",
- G_CALLBACK(google_session_stream_info_cb), session);
+ G_CALLBACK(google_session_stream_info_cb), session);
- params =
- jabber_google_session_get_params(js, relay_ip, relay_udp,
- relay_tcp, relay_ssltcp,
- relay_username, relay_password,
- &num_params);
+ params = jabber_google_session_get_params(js, relay_ip,
+ relay_udp, relay_tcp, relay_ssltcp, relay_username,
+ relay_password, &num_params);
if (purple_media_add_stream(session_data->media, "google-voice",
- session->remote_jid, PURPLE_MEDIA_AUDIO,
- TRUE, "nice", num_params, params) == FALSE ||
- (session_data->video && purple_media_add_stream(
+ session->remote_jid, PURPLE_MEDIA_AUDIO, TRUE, "nice",
+ num_params, params) == FALSE ||
+ (session_data->video && purple_media_add_stream(
session_data->media, "google-video",
session->remote_jid, PURPLE_MEDIA_VIDEO,
- TRUE, "nice", num_params, params) == FALSE)) {
+ TRUE, "nice", num_params, params) == FALSE))
+ {
purple_media_error(session_data->media, "Error adding stream.");
purple_media_end(session_data->media, NULL, NULL);
} else
@@ -713,14 +711,14 @@ google_session_handle_initiate(JabberStr
purple_media_set_prpl_data(session_data->media, session);
g_signal_connect_swapped(G_OBJECT(session_data->media),
- "candidates-prepared",
- G_CALLBACK(google_session_ready), session);
+ "candidates-prepared",
+ G_CALLBACK(google_session_ready), session);
g_signal_connect_swapped(G_OBJECT(session_data->media), "codecs-changed",
- G_CALLBACK(google_session_ready), session);
+ G_CALLBACK(google_session_ready), session);
g_signal_connect(G_OBJECT(session_data->media), "state-changed",
- G_CALLBACK(google_session_state_changed_cb), session);
+ G_CALLBACK(google_session_state_changed_cb), session);
g_signal_connect(G_OBJECT(session_data->media), "stream-info",
- G_CALLBACK(google_session_stream_info_cb), session);
+ G_CALLBACK(google_session_stream_info_cb), session);
session->iq_id = g_strdup(iq_id);
@@ -728,8 +726,8 @@ google_session_handle_initiate(JabberStr
jabber_google_do_relay_request(js, session,
jabber_google_relay_response_session_handle_initiate_cb);
} else {
- jabber_google_relay_response_session_handle_initiate_cb(session,
- NULL, 0, 0, 0, NULL, NULL);
+ jabber_google_relay_response_session_handle_initiate_cb(
+ session, NULL, 0, 0, 0, NULL, NULL);
}
}
else
@@ -769,7 +767,7 @@ google_session_handle_candidates(JabberS
const gchar *address = purple_xmlnode_get_attrib(cand, "address");
const gchar *port = purple_xmlnode_get_attrib(cand, "port");
const gchar *preference = purple_xmlnode_get_attrib(cand,
- "preference");
+ "preference");
guint component_id;
if (cname && type && address && port) {
@@ -791,9 +789,10 @@ google_session_handle_candidates(JabberS
candidate_type = PURPLE_MEDIA_CANDIDATE_TYPE_HOST;
if (purple_strequal(cname, "rtcp") ||
- purple_strequal(cname, "video_rtcp"))
+ purple_strequal(cname, "video_rtcp"))
+ {
component_id = PURPLE_MEDIA_COMPONENT_RTCP;
- else
+ } else
component_id = PURPLE_MEDIA_COMPONENT_RTP;
info = purple_media_candidate_new(n, component_id,
@@ -873,23 +872,25 @@ google_session_handle_candidates(JabberS
g_list_append(video_list, info);
} else {
session_data->remote_video_candidates =
- g_list_append(session_data->remote_video_candidates,
- info);
+ g_list_append(session_data->
+ remote_video_candidates,
+ info);
}
} else {
if (session_data->added_streams) {
list = g_list_append(list, info);
} else {
session_data->remote_audio_candidates =
- g_list_append(session_data->remote_audio_candidates,
- info);
+ g_list_append(session_data->
+ remote_audio_candidates,
+ info);
}
}
}
}
else {
purple_debug_info("google_session",
- "cname && port && address && type FAILED!\n");
+ "cname && port && address && type FAILED!");
}
}
@@ -1087,6 +1088,7 @@ jabber_google_session_parse(JabberStream
{
GoogleSession *session = NULL;
GoogleSessionId id;
+
PurpleXmlNode *desc_node;
GList *iter = NULL;
diff --git a/libpurple/protocols/jabber/google/google_session.h b/libpurple/protocols/jabber/google/google_session.h
--- a/libpurple/protocols/jabber/google/google_session.h
+++ b/libpurple/protocols/jabber/google/google_session.h
@@ -39,29 +39,31 @@ typedef enum {
} GoogleXferChannelState;
typedef struct {
- gchar *filename; /*File Details*/
+ gchar *filename; /*File Details*/
guint64 filesize;
gchar *preview_url;
gchar *source_url;
PurpleXfer *xfer;
- NiceAgent *share_agent; /* Needs to have a manifest
- * Entry for Directory Sharing
- */
+
+ /* Needs to have a manifest Entry for Directory Sharing */
+ NiceAgent *share_agent;
+
gchar *channel_name;
NiceComponentState agent_state;
PurpleCircularBuffer *buffer;
GoogleXferChannelState channel_state;
gint stream_id;
gboolean candidates_gathered;
- gboolean file_opened; /* Stuff for using file buffer
- * for sending Gtalk Files
- */
+
+ /* Stuff for using file buffer for sending Gtalk Files */
+ gboolean file_opened;
+
FILE *file_to_send;
char *file_buf;
int file_buf_current_size;
int file_buf_sent;
- /*Lists of NiceCandidates*/
+ /* Lists of NiceCandidates */
GSList *remote_share_candidates;
GSList *local_share_candidates;
@@ -89,43 +91,42 @@ typedef struct {
PurpleXmlNode *description; /* store incoming description through
relay credential fetching */
gboolean relay_processing;
- gboolean share; /*FileXfer session flag*/
+ gboolean share; /* FileXfer session flag */
gboolean session_should_die;
gpointer session_data;
} GoogleSession;
void
cb_new_selected_pair(NiceAgent *agent, guint stream_id, guint component_id,
- gchar *lfoundation, gchar *rfoundation, gpointer user_data);
+ gchar *lfoundation, gchar *rfoundation, gpointer user_data);
void
cb_nice_component_state_changed(NiceAgent *agent,guint stream_id,
- guint component_id, guint state, gpointer user_data);
+ guint component_id, guint state, gpointer user_data);
void
cb_nice_component_writable(NiceAgent *agent, guint stream_id,
- guint component_id, gpointer user_data);
+ guint component_id, gpointer user_data);
void
gtalk_xfer_handle_initiate(JabberStream *js, GoogleSession *session, PurpleXmlNode*sess,
- const char *iq_id);
+ const char *iq_id);
void
gtalk_xfer_handle_candidates(JabberStream *js, GoogleSession *session,
- PurpleXmlNode*sess, const char *iq_id);
+ PurpleXmlNode*sess, const char *iq_id);
void
gtalk_xfer_handle_info(JabberStream *js, GoogleSession *session, PurpleXmlNode*sess,
- const char *iq_id);
+ const char *iq_id);
void
gtalk_xfer_handle_accept(JabberStream *js, GoogleSession *session,
- const char *iq_id);
+ const char *iq_id);
void
gtalk_xfer_handle_reject(JabberStream *js, GoogleSession *session,
- const char *iq_id);
+ const char *iq_id);
gint
gtalk_xfer_init_agent(GoogleSession *session);
void
jabber_google_relay_response_session_initiate_cb(GoogleSession *session,
- const gchar *relay_ip, guint relay_udp,
- guint relay_tcp, guint relay_ssltcp,
- const gchar *relay_username,
- const gchar *relay_password);
+ const gchar *relay_ip, guint relay_udp, guint relay_tcp,
+ guint relay_ssltcp, const gchar *relay_username,
+ const gchar *relay_password);
PurpleXmlNode*
google_session_create_xmlnode(GoogleSession *session, const char *type);
void
@@ -133,10 +134,9 @@ gtalk_xfer_send(PurpleConnection *gc, co
void
cb_candidate_gathering_done(NiceAgent *agent, guint stream_id, gpointer user_data);
gboolean jabber_google_session_initiate(JabberStream *js, const gchar *who,
- PurpleMediaSessionType type);
+ PurpleMediaSessionType type);
void jabber_google_session_parse(JabberStream *js, const char *from,
- JabberIqType type, const char *iq,
- PurpleXmlNode *session);
+ JabberIqType type, const char *iq, PurpleXmlNode *session);
void google_session_destroy(GoogleSession *session);
#endif /* PURPLE_JABBER_GOOGLE_SESSION_H_ */
diff --git a/libpurple/protocols/jabber/google/google_share.c b/libpurple/protocols/jabber/google/google_share.c
--- a/libpurple/protocols/jabber/google/google_share.c
+++ b/libpurple/protocols/jabber/google/google_share.c
@@ -36,7 +36,7 @@ gtalk_get_temporary_url(void)
/*According to GTalk data, the length of temporary URL must be 44.*/
static int z = - 1;
char *temporary_url = g_malloc(45);
- int i = 11;
+ int i;
char *alpha = "abcdefghijklmnopqrstuvwxyz";
char *num = "0123456789";
srandom(time(NULL));
@@ -46,13 +46,13 @@ gtalk_get_temporary_url(void)
z++;
strcpy(temporary_url, "/temporary/");
- for(;i<43;i++) {
- int j=random()%2;
- if(j==0)
+ for (i = 11; i < 43; i++) {
+ int j = random() % 2;
+ if (j == 0)
temporary_url[i] = alpha[random()%(26-z)];
else
temporary_url[i] = num[random()%(10-z)];
- }
+ }
temporary_url[i]='/';
++i;
temporary_url[i]='\0';
More information about the Commits
mailing list