libpurple/protocols/gg/message-prpl.c

Wed, 06 Feb 2013 13:39:48 +0100

author
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
date
Wed, 06 Feb 2013 13:39:48 +0100
changeset 34418
c27e31267e8d
parent 34413
a578366cd35e
child 34430
15639e15839e
permissions
-rw-r--r--

Gadu-Gadu: fix compilation on 64-bit targets

34356
5d59fd4d5b2d Gadu-Gadu: reimplementation of receiving messages
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
1 #include "message-prpl.h"
5d59fd4d5b2d Gadu-Gadu: reimplementation of receiving messages
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
2
5d59fd4d5b2d Gadu-Gadu: reimplementation of receiving messages
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
3 #include <debug.h>
5d59fd4d5b2d Gadu-Gadu: reimplementation of receiving messages
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
4
34357
74dff2310289 Gadu-Gadu: reimplementation of sending messages
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34356
diff changeset
5 #include "gg.h"
34356
5d59fd4d5b2d Gadu-Gadu: reimplementation of receiving messages
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
6 #include "chat.h"
5d59fd4d5b2d Gadu-Gadu: reimplementation of receiving messages
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
7 #include "utils.h"
34358
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
8 #include "html.h"
34356
5d59fd4d5b2d Gadu-Gadu: reimplementation of receiving messages
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
9
5d59fd4d5b2d Gadu-Gadu: reimplementation of receiving messages
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
10 #define GGP_GG10_DEFAULT_FORMAT "<span style=\"color:#000000; " \
5d59fd4d5b2d Gadu-Gadu: reimplementation of receiving messages
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
11 "font-family:'MS Shell Dlg 2'; font-size:9pt; \">"
5d59fd4d5b2d Gadu-Gadu: reimplementation of receiving messages
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
12 #define GGP_GG10_DEFAULT_FORMAT_REPLACEMENT "<span>"
34358
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
13 #define GGP_GG11_FORCE_COMPAT FALSE
34356
5d59fd4d5b2d Gadu-Gadu: reimplementation of receiving messages
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
14
34418
c27e31267e8d Gadu-Gadu: fix compilation on 64-bit targets
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34413
diff changeset
15 #define GGP_IMAGE_REPLACEMENT "<img id=\"gg-pending-image-" GGP_IMAGE_ID_FORMAT "\">"
34361
ddcc82637afa Gadu-Gadu: incoming images works again
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34360
diff changeset
16 #define GGP_IMAGE_DESTINATION "<img src=\"" PURPLE_STORED_IMAGE_PROTOCOL "%u\">"
ddcc82637afa Gadu-Gadu: incoming images works again
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34360
diff changeset
17
34356
5d59fd4d5b2d Gadu-Gadu: reimplementation of receiving messages
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
18 typedef struct
5d59fd4d5b2d Gadu-Gadu: reimplementation of receiving messages
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
19 {
5d59fd4d5b2d Gadu-Gadu: reimplementation of receiving messages
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
20 enum
5d59fd4d5b2d Gadu-Gadu: reimplementation of receiving messages
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
21 {
5d59fd4d5b2d Gadu-Gadu: reimplementation of receiving messages
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
22 GGP_MESSAGE_GOT_TYPE_IM,
5d59fd4d5b2d Gadu-Gadu: reimplementation of receiving messages
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
23 GGP_MESSAGE_GOT_TYPE_CHAT,
5d59fd4d5b2d Gadu-Gadu: reimplementation of receiving messages
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
24 GGP_MESSAGE_GOT_TYPE_MULTILOGON
5d59fd4d5b2d Gadu-Gadu: reimplementation of receiving messages
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
25 } type;
5d59fd4d5b2d Gadu-Gadu: reimplementation of receiving messages
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
26
5d59fd4d5b2d Gadu-Gadu: reimplementation of receiving messages
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
27 uin_t user;
5d59fd4d5b2d Gadu-Gadu: reimplementation of receiving messages
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
28 gchar *text;
5d59fd4d5b2d Gadu-Gadu: reimplementation of receiving messages
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
29 time_t time;
5d59fd4d5b2d Gadu-Gadu: reimplementation of receiving messages
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
30 uint64_t chat_id;
34361
ddcc82637afa Gadu-Gadu: incoming images works again
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34360
diff changeset
31 GList *pending_images;
34362
758e72362ca4 Gadu-Gadu: code polishing
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34361
diff changeset
32
758e72362ca4 Gadu-Gadu: code polishing
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34361
diff changeset
33 PurpleConnection *gc;
34356
5d59fd4d5b2d Gadu-Gadu: reimplementation of receiving messages
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
34 } ggp_message_got_data;
5d59fd4d5b2d Gadu-Gadu: reimplementation of receiving messages
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
35
34359
7cf367cc1141 Gadu-Gadu: compile regular expressions only once per plugin load
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34358
diff changeset
36 typedef struct
34358
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
37 {
34359
7cf367cc1141 Gadu-Gadu: compile regular expressions only once per plugin load
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34358
diff changeset
38 GRegex *re_html_tag;
34361
ddcc82637afa Gadu-Gadu: incoming images works again
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34360
diff changeset
39 GRegex *re_gg_img;
34359
7cf367cc1141 Gadu-Gadu: compile regular expressions only once per plugin load
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34358
diff changeset
40 } ggp_message_global_data;
7cf367cc1141 Gadu-Gadu: compile regular expressions only once per plugin load
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34358
diff changeset
41
7cf367cc1141 Gadu-Gadu: compile regular expressions only once per plugin load
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34358
diff changeset
42 static ggp_message_global_data global_data;
34358
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
43
34361
ddcc82637afa Gadu-Gadu: incoming images works again
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34360
diff changeset
44 struct _ggp_message_session_data
ddcc82637afa Gadu-Gadu: incoming images works again
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34360
diff changeset
45 {
ddcc82637afa Gadu-Gadu: incoming images works again
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34360
diff changeset
46 GList *pending_messages;
ddcc82637afa Gadu-Gadu: incoming images works again
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34360
diff changeset
47 };
ddcc82637afa Gadu-Gadu: incoming images works again
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34360
diff changeset
48
34358
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
49 typedef struct
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
50 {
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
51 int size;
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
52 gchar *face;
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
53 int color, bgcolor;
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
54 gboolean b, i, u, s;
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
55 } ggp_font;
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
56
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
57 static ggp_font * ggp_font_new(void);
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
58 static ggp_font * ggp_font_clone(ggp_font *font);
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
59 static void ggp_font_free(gpointer font);
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
60
34356
5d59fd4d5b2d Gadu-Gadu: reimplementation of receiving messages
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
61 static PurpleConversation * ggp_message_get_conv(PurpleConnection *gc,
5d59fd4d5b2d Gadu-Gadu: reimplementation of receiving messages
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
62 uin_t uin);
5d59fd4d5b2d Gadu-Gadu: reimplementation of receiving messages
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
63 static void ggp_message_got_data_free(ggp_message_got_data *msg);
34361
ddcc82637afa Gadu-Gadu: incoming images works again
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34360
diff changeset
64 static gboolean ggp_message_request_images(PurpleConnection *gc,
ddcc82637afa Gadu-Gadu: incoming images works again
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34360
diff changeset
65 ggp_message_got_data *msg);
34356
5d59fd4d5b2d Gadu-Gadu: reimplementation of receiving messages
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
66 static void ggp_message_got_display(PurpleConnection *gc,
5d59fd4d5b2d Gadu-Gadu: reimplementation of receiving messages
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
67 ggp_message_got_data *msg);
5d59fd4d5b2d Gadu-Gadu: reimplementation of receiving messages
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
68 static void ggp_message_format_from_gg(ggp_message_got_data *msg,
5d59fd4d5b2d Gadu-Gadu: reimplementation of receiving messages
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
69 const gchar *text);
5d59fd4d5b2d Gadu-Gadu: reimplementation of receiving messages
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
70
5d59fd4d5b2d Gadu-Gadu: reimplementation of receiving messages
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
71 /**************/
5d59fd4d5b2d Gadu-Gadu: reimplementation of receiving messages
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
72
34359
7cf367cc1141 Gadu-Gadu: compile regular expressions only once per plugin load
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34358
diff changeset
73 void ggp_message_setup_global(void)
7cf367cc1141 Gadu-Gadu: compile regular expressions only once per plugin load
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34358
diff changeset
74 {
7cf367cc1141 Gadu-Gadu: compile regular expressions only once per plugin load
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34358
diff changeset
75 global_data.re_html_tag = g_regex_new(
34413
a578366cd35e Gadu-Gadu: fix sending links
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34370
diff changeset
76 "<(/)?([a-zA-Z]+)( [^>]+)?>",
34359
7cf367cc1141 Gadu-Gadu: compile regular expressions only once per plugin load
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34358
diff changeset
77 G_REGEX_OPTIMIZE, 0, NULL);
34361
ddcc82637afa Gadu-Gadu: incoming images works again
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34360
diff changeset
78 global_data.re_gg_img = g_regex_new(
ddcc82637afa Gadu-Gadu: incoming images works again
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34360
diff changeset
79 "<img name=\"([0-9a-fA-F]+)\"/?>",
ddcc82637afa Gadu-Gadu: incoming images works again
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34360
diff changeset
80 G_REGEX_OPTIMIZE, 0, NULL);
34359
7cf367cc1141 Gadu-Gadu: compile regular expressions only once per plugin load
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34358
diff changeset
81 }
7cf367cc1141 Gadu-Gadu: compile regular expressions only once per plugin load
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34358
diff changeset
82
7cf367cc1141 Gadu-Gadu: compile regular expressions only once per plugin load
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34358
diff changeset
83 void ggp_message_cleanup_global(void)
7cf367cc1141 Gadu-Gadu: compile regular expressions only once per plugin load
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34358
diff changeset
84 {
7cf367cc1141 Gadu-Gadu: compile regular expressions only once per plugin load
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34358
diff changeset
85 g_regex_unref(global_data.re_html_tag);
34361
ddcc82637afa Gadu-Gadu: incoming images works again
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34360
diff changeset
86 g_regex_unref(global_data.re_gg_img);
ddcc82637afa Gadu-Gadu: incoming images works again
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34360
diff changeset
87 }
ddcc82637afa Gadu-Gadu: incoming images works again
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34360
diff changeset
88
ddcc82637afa Gadu-Gadu: incoming images works again
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34360
diff changeset
89 static inline ggp_message_session_data *
ddcc82637afa Gadu-Gadu: incoming images works again
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34360
diff changeset
90 ggp_message_get_sdata(PurpleConnection *gc)
ddcc82637afa Gadu-Gadu: incoming images works again
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34360
diff changeset
91 {
ddcc82637afa Gadu-Gadu: incoming images works again
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34360
diff changeset
92 GGPInfo *accdata = purple_connection_get_protocol_data(gc);
ddcc82637afa Gadu-Gadu: incoming images works again
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34360
diff changeset
93 return accdata->message_data;
ddcc82637afa Gadu-Gadu: incoming images works again
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34360
diff changeset
94 }
ddcc82637afa Gadu-Gadu: incoming images works again
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34360
diff changeset
95
ddcc82637afa Gadu-Gadu: incoming images works again
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34360
diff changeset
96 void ggp_message_setup(PurpleConnection *gc)
ddcc82637afa Gadu-Gadu: incoming images works again
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34360
diff changeset
97 {
ddcc82637afa Gadu-Gadu: incoming images works again
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34360
diff changeset
98 GGPInfo *accdata = purple_connection_get_protocol_data(gc);
ddcc82637afa Gadu-Gadu: incoming images works again
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34360
diff changeset
99 ggp_message_session_data *sdata = g_new0(ggp_message_session_data, 1);
ddcc82637afa Gadu-Gadu: incoming images works again
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34360
diff changeset
100
ddcc82637afa Gadu-Gadu: incoming images works again
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34360
diff changeset
101 accdata->message_data = sdata;
ddcc82637afa Gadu-Gadu: incoming images works again
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34360
diff changeset
102 }
ddcc82637afa Gadu-Gadu: incoming images works again
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34360
diff changeset
103
ddcc82637afa Gadu-Gadu: incoming images works again
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34360
diff changeset
104 void ggp_message_cleanup(PurpleConnection *gc)
ddcc82637afa Gadu-Gadu: incoming images works again
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34360
diff changeset
105 {
ddcc82637afa Gadu-Gadu: incoming images works again
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34360
diff changeset
106 ggp_message_session_data *sdata = ggp_message_get_sdata(gc);
ddcc82637afa Gadu-Gadu: incoming images works again
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34360
diff changeset
107
ddcc82637afa Gadu-Gadu: incoming images works again
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34360
diff changeset
108 g_list_free_full(sdata->pending_messages,
ddcc82637afa Gadu-Gadu: incoming images works again
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34360
diff changeset
109 (GDestroyNotify)ggp_message_got_data_free);
ddcc82637afa Gadu-Gadu: incoming images works again
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34360
diff changeset
110 g_free(sdata);
34359
7cf367cc1141 Gadu-Gadu: compile regular expressions only once per plugin load
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34358
diff changeset
111 }
7cf367cc1141 Gadu-Gadu: compile regular expressions only once per plugin load
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34358
diff changeset
112
34358
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
113 static ggp_font * ggp_font_new(void)
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
114 {
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
115 ggp_font *font;
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
116
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
117 font = g_new0(ggp_font, 1);
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
118 font->color = -1;
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
119 font->bgcolor = -1;
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
120
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
121 return font;
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
122 }
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
123
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
124 static ggp_font * ggp_font_clone(ggp_font * font)
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
125 {
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
126 ggp_font *clone = g_new0(ggp_font, 1);
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
127
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
128 *clone = *font;
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
129 clone->face = g_strdup(font->face);
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
130
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
131 return clone;
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
132 }
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
133
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
134 static void ggp_font_free(gpointer _font)
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
135 {
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
136 ggp_font *font = _font;
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
137
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
138 g_free(font->face);
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
139 g_free(font);
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
140 }
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
141
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
142 /**/
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
143
34356
5d59fd4d5b2d Gadu-Gadu: reimplementation of receiving messages
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
144 static PurpleConversation * ggp_message_get_conv(PurpleConnection *gc,
5d59fd4d5b2d Gadu-Gadu: reimplementation of receiving messages
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
145 uin_t uin)
5d59fd4d5b2d Gadu-Gadu: reimplementation of receiving messages
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
146 {
5d59fd4d5b2d Gadu-Gadu: reimplementation of receiving messages
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
147 PurpleAccount *account = purple_connection_get_account(gc);
5d59fd4d5b2d Gadu-Gadu: reimplementation of receiving messages
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
148 PurpleConversation *conv;
5d59fd4d5b2d Gadu-Gadu: reimplementation of receiving messages
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
149 const gchar *who = ggp_uin_to_str(uin);
5d59fd4d5b2d Gadu-Gadu: reimplementation of receiving messages
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
150
5d59fd4d5b2d Gadu-Gadu: reimplementation of receiving messages
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
151 conv = purple_find_conversation_with_account(
5d59fd4d5b2d Gadu-Gadu: reimplementation of receiving messages
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
152 PURPLE_CONV_TYPE_IM, who, account);
5d59fd4d5b2d Gadu-Gadu: reimplementation of receiving messages
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
153 if (conv)
5d59fd4d5b2d Gadu-Gadu: reimplementation of receiving messages
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
154 return conv;
5d59fd4d5b2d Gadu-Gadu: reimplementation of receiving messages
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
155 conv = purple_conversation_new(PURPLE_CONV_TYPE_IM, account, who);
5d59fd4d5b2d Gadu-Gadu: reimplementation of receiving messages
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
156 return conv;
5d59fd4d5b2d Gadu-Gadu: reimplementation of receiving messages
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
157 }
5d59fd4d5b2d Gadu-Gadu: reimplementation of receiving messages
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
158
5d59fd4d5b2d Gadu-Gadu: reimplementation of receiving messages
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
159 static void ggp_message_got_data_free(ggp_message_got_data *msg)
5d59fd4d5b2d Gadu-Gadu: reimplementation of receiving messages
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
160 {
34361
ddcc82637afa Gadu-Gadu: incoming images works again
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34360
diff changeset
161 g_list_free_full(msg->pending_images, g_free);
34356
5d59fd4d5b2d Gadu-Gadu: reimplementation of receiving messages
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
162 g_free(msg->text);
5d59fd4d5b2d Gadu-Gadu: reimplementation of receiving messages
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
163 g_free(msg);
5d59fd4d5b2d Gadu-Gadu: reimplementation of receiving messages
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
164 }
5d59fd4d5b2d Gadu-Gadu: reimplementation of receiving messages
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
165
34361
ddcc82637afa Gadu-Gadu: incoming images works again
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34360
diff changeset
166 static void ggp_message_request_images_got(PurpleConnection *gc, uint64_t id,
ddcc82637afa Gadu-Gadu: incoming images works again
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34360
diff changeset
167 int stored_id, gpointer _msg)
ddcc82637afa Gadu-Gadu: incoming images works again
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34360
diff changeset
168 {
ddcc82637afa Gadu-Gadu: incoming images works again
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34360
diff changeset
169 ggp_message_session_data *sdata = ggp_message_get_sdata(gc);
ddcc82637afa Gadu-Gadu: incoming images works again
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34360
diff changeset
170 ggp_message_got_data *msg = _msg;
ddcc82637afa Gadu-Gadu: incoming images works again
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34360
diff changeset
171 GList *m_it, *i_it;
ddcc82637afa Gadu-Gadu: incoming images works again
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34360
diff changeset
172 gchar *tmp, *tag_search, *tag_replace;
ddcc82637afa Gadu-Gadu: incoming images works again
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34360
diff changeset
173
ddcc82637afa Gadu-Gadu: incoming images works again
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34360
diff changeset
174 m_it = g_list_find(sdata->pending_messages, msg);
ddcc82637afa Gadu-Gadu: incoming images works again
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34360
diff changeset
175 if (!m_it)
ddcc82637afa Gadu-Gadu: incoming images works again
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34360
diff changeset
176 {
ddcc82637afa Gadu-Gadu: incoming images works again
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34360
diff changeset
177 purple_debug_error("gg", "ggp_message_request_images_got: "
ddcc82637afa Gadu-Gadu: incoming images works again
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34360
diff changeset
178 "message %p is not in queue\n", msg);
ddcc82637afa Gadu-Gadu: incoming images works again
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34360
diff changeset
179 return;
ddcc82637afa Gadu-Gadu: incoming images works again
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34360
diff changeset
180 }
ddcc82637afa Gadu-Gadu: incoming images works again
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34360
diff changeset
181
ddcc82637afa Gadu-Gadu: incoming images works again
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34360
diff changeset
182 i_it = g_list_find_custom(msg->pending_images, &id, ggp_int64_compare);
ddcc82637afa Gadu-Gadu: incoming images works again
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34360
diff changeset
183 if (!i_it)
ddcc82637afa Gadu-Gadu: incoming images works again
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34360
diff changeset
184 {
ddcc82637afa Gadu-Gadu: incoming images works again
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34360
diff changeset
185 purple_debug_error("gg", "ggp_message_request_images_got: "
34418
c27e31267e8d Gadu-Gadu: fix compilation on 64-bit targets
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34413
diff changeset
186 "image " GGP_IMAGE_ID_FORMAT " is not present in this "
c27e31267e8d Gadu-Gadu: fix compilation on 64-bit targets
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34413
diff changeset
187 "message\n", id);
34361
ddcc82637afa Gadu-Gadu: incoming images works again
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34360
diff changeset
188 return;
ddcc82637afa Gadu-Gadu: incoming images works again
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34360
diff changeset
189 }
ddcc82637afa Gadu-Gadu: incoming images works again
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34360
diff changeset
190
ddcc82637afa Gadu-Gadu: incoming images works again
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34360
diff changeset
191 tag_search = g_strdup_printf(GGP_IMAGE_REPLACEMENT, id);
ddcc82637afa Gadu-Gadu: incoming images works again
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34360
diff changeset
192 tag_replace = g_strdup_printf(GGP_IMAGE_DESTINATION, stored_id);
ddcc82637afa Gadu-Gadu: incoming images works again
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34360
diff changeset
193
ddcc82637afa Gadu-Gadu: incoming images works again
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34360
diff changeset
194 tmp = msg->text;
ddcc82637afa Gadu-Gadu: incoming images works again
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34360
diff changeset
195 msg->text = purple_strreplace(msg->text, tag_search, tag_replace);
ddcc82637afa Gadu-Gadu: incoming images works again
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34360
diff changeset
196 g_free(tmp);
ddcc82637afa Gadu-Gadu: incoming images works again
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34360
diff changeset
197
ddcc82637afa Gadu-Gadu: incoming images works again
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34360
diff changeset
198 g_free(tag_search);
ddcc82637afa Gadu-Gadu: incoming images works again
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34360
diff changeset
199 g_free(tag_replace);
ddcc82637afa Gadu-Gadu: incoming images works again
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34360
diff changeset
200
ddcc82637afa Gadu-Gadu: incoming images works again
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34360
diff changeset
201 g_free(i_it->data);
ddcc82637afa Gadu-Gadu: incoming images works again
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34360
diff changeset
202 msg->pending_images = g_list_delete_link(msg->pending_images, i_it);
ddcc82637afa Gadu-Gadu: incoming images works again
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34360
diff changeset
203 if (msg->pending_images != NULL)
ddcc82637afa Gadu-Gadu: incoming images works again
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34360
diff changeset
204 {
ddcc82637afa Gadu-Gadu: incoming images works again
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34360
diff changeset
205 purple_debug_info("gg", "ggp_message_request_images_got: "
34418
c27e31267e8d Gadu-Gadu: fix compilation on 64-bit targets
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34413
diff changeset
206 "got image " GGP_IMAGE_ID_FORMAT ", but the message "
c27e31267e8d Gadu-Gadu: fix compilation on 64-bit targets
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34413
diff changeset
207 "contains more of them\n", id);
34361
ddcc82637afa Gadu-Gadu: incoming images works again
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34360
diff changeset
208 return;
ddcc82637afa Gadu-Gadu: incoming images works again
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34360
diff changeset
209 }
ddcc82637afa Gadu-Gadu: incoming images works again
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34360
diff changeset
210
ddcc82637afa Gadu-Gadu: incoming images works again
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34360
diff changeset
211 ggp_message_got_display(gc, msg);
ddcc82637afa Gadu-Gadu: incoming images works again
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34360
diff changeset
212 ggp_message_got_data_free(msg);
ddcc82637afa Gadu-Gadu: incoming images works again
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34360
diff changeset
213 sdata->pending_messages = g_list_delete_link(sdata->pending_messages,
ddcc82637afa Gadu-Gadu: incoming images works again
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34360
diff changeset
214 m_it);
ddcc82637afa Gadu-Gadu: incoming images works again
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34360
diff changeset
215 }
ddcc82637afa Gadu-Gadu: incoming images works again
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34360
diff changeset
216
ddcc82637afa Gadu-Gadu: incoming images works again
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34360
diff changeset
217 static gboolean ggp_message_request_images(PurpleConnection *gc,
ddcc82637afa Gadu-Gadu: incoming images works again
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34360
diff changeset
218 ggp_message_got_data *msg)
ddcc82637afa Gadu-Gadu: incoming images works again
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34360
diff changeset
219 {
ddcc82637afa Gadu-Gadu: incoming images works again
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34360
diff changeset
220 ggp_message_session_data *sdata = ggp_message_get_sdata(gc);
ddcc82637afa Gadu-Gadu: incoming images works again
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34360
diff changeset
221 GList *it;
ddcc82637afa Gadu-Gadu: incoming images works again
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34360
diff changeset
222 if (msg->pending_images == NULL)
ddcc82637afa Gadu-Gadu: incoming images works again
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34360
diff changeset
223 return FALSE;
ddcc82637afa Gadu-Gadu: incoming images works again
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34360
diff changeset
224
ddcc82637afa Gadu-Gadu: incoming images works again
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34360
diff changeset
225 it = msg->pending_images;
ddcc82637afa Gadu-Gadu: incoming images works again
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34360
diff changeset
226 while (it)
ddcc82637afa Gadu-Gadu: incoming images works again
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34360
diff changeset
227 {
34362
758e72362ca4 Gadu-Gadu: code polishing
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34361
diff changeset
228 ggp_image_request(gc, msg->user, *(uint64_t*)it->data,
34361
ddcc82637afa Gadu-Gadu: incoming images works again
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34360
diff changeset
229 ggp_message_request_images_got, msg);
ddcc82637afa Gadu-Gadu: incoming images works again
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34360
diff changeset
230 it = g_list_next(it);
ddcc82637afa Gadu-Gadu: incoming images works again
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34360
diff changeset
231 }
ddcc82637afa Gadu-Gadu: incoming images works again
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34360
diff changeset
232
ddcc82637afa Gadu-Gadu: incoming images works again
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34360
diff changeset
233 sdata->pending_messages = g_list_append(sdata->pending_messages, msg);
ddcc82637afa Gadu-Gadu: incoming images works again
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34360
diff changeset
234
ddcc82637afa Gadu-Gadu: incoming images works again
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34360
diff changeset
235 return TRUE;
ddcc82637afa Gadu-Gadu: incoming images works again
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34360
diff changeset
236 }
ddcc82637afa Gadu-Gadu: incoming images works again
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34360
diff changeset
237
34356
5d59fd4d5b2d Gadu-Gadu: reimplementation of receiving messages
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
238 void ggp_message_got(PurpleConnection *gc, const struct gg_event_msg *ev)
5d59fd4d5b2d Gadu-Gadu: reimplementation of receiving messages
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
239 {
34361
ddcc82637afa Gadu-Gadu: incoming images works again
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34360
diff changeset
240 ggp_message_got_data *msg = g_new0(ggp_message_got_data, 1);
34356
5d59fd4d5b2d Gadu-Gadu: reimplementation of receiving messages
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
241
34362
758e72362ca4 Gadu-Gadu: code polishing
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34361
diff changeset
242 msg->gc = gc;
34356
5d59fd4d5b2d Gadu-Gadu: reimplementation of receiving messages
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
243 msg->time = ev->time;
5d59fd4d5b2d Gadu-Gadu: reimplementation of receiving messages
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
244 msg->user = ev->sender;
5d59fd4d5b2d Gadu-Gadu: reimplementation of receiving messages
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
245
5d59fd4d5b2d Gadu-Gadu: reimplementation of receiving messages
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
246 if (ev->chat_id != 0)
5d59fd4d5b2d Gadu-Gadu: reimplementation of receiving messages
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
247 {
5d59fd4d5b2d Gadu-Gadu: reimplementation of receiving messages
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
248 msg->type = GGP_MESSAGE_GOT_TYPE_CHAT;
5d59fd4d5b2d Gadu-Gadu: reimplementation of receiving messages
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
249 msg->chat_id = ev->chat_id;
5d59fd4d5b2d Gadu-Gadu: reimplementation of receiving messages
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
250 }
5d59fd4d5b2d Gadu-Gadu: reimplementation of receiving messages
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
251 else
5d59fd4d5b2d Gadu-Gadu: reimplementation of receiving messages
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
252 {
5d59fd4d5b2d Gadu-Gadu: reimplementation of receiving messages
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
253 msg->type = GGP_MESSAGE_GOT_TYPE_IM;
5d59fd4d5b2d Gadu-Gadu: reimplementation of receiving messages
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
254 }
5d59fd4d5b2d Gadu-Gadu: reimplementation of receiving messages
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
255
34362
758e72362ca4 Gadu-Gadu: code polishing
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34361
diff changeset
256 ggp_message_format_from_gg(msg, ev->xhtml_message);
34361
ddcc82637afa Gadu-Gadu: incoming images works again
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34360
diff changeset
257 if (ggp_message_request_images(gc, msg))
ddcc82637afa Gadu-Gadu: incoming images works again
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34360
diff changeset
258 return;
ddcc82637afa Gadu-Gadu: incoming images works again
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34360
diff changeset
259
34356
5d59fd4d5b2d Gadu-Gadu: reimplementation of receiving messages
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
260 ggp_message_got_display(gc, msg);
5d59fd4d5b2d Gadu-Gadu: reimplementation of receiving messages
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
261 ggp_message_got_data_free(msg);
5d59fd4d5b2d Gadu-Gadu: reimplementation of receiving messages
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
262 }
5d59fd4d5b2d Gadu-Gadu: reimplementation of receiving messages
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
263
34360
c6bd55f526f9 Gadu-Gadu: code polishing for messages
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34359
diff changeset
264 void ggp_message_got_multilogon(PurpleConnection *gc,
c6bd55f526f9 Gadu-Gadu: code polishing for messages
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34359
diff changeset
265 const struct gg_event_msg *ev)
34356
5d59fd4d5b2d Gadu-Gadu: reimplementation of receiving messages
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
266 {
34361
ddcc82637afa Gadu-Gadu: incoming images works again
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34360
diff changeset
267 ggp_message_got_data *msg = g_new0(ggp_message_got_data, 1);
34356
5d59fd4d5b2d Gadu-Gadu: reimplementation of receiving messages
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
268
34362
758e72362ca4 Gadu-Gadu: code polishing
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34361
diff changeset
269 msg->gc = gc;
34356
5d59fd4d5b2d Gadu-Gadu: reimplementation of receiving messages
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
270 msg->time = ev->time;
5d59fd4d5b2d Gadu-Gadu: reimplementation of receiving messages
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
271 msg->user = ev->sender; /* not really a sender*/
34368
b5341ea06a72 Gadu-Gadu: fix conferences used together with multilogon
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34365
diff changeset
272
b5341ea06a72 Gadu-Gadu: fix conferences used together with multilogon
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34365
diff changeset
273 if (ev->chat_id != 0)
b5341ea06a72 Gadu-Gadu: fix conferences used together with multilogon
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34365
diff changeset
274 {
b5341ea06a72 Gadu-Gadu: fix conferences used together with multilogon
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34365
diff changeset
275 msg->type = GGP_MESSAGE_GOT_TYPE_CHAT;
b5341ea06a72 Gadu-Gadu: fix conferences used together with multilogon
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34365
diff changeset
276 msg->chat_id = ev->chat_id;
b5341ea06a72 Gadu-Gadu: fix conferences used together with multilogon
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34365
diff changeset
277 }
b5341ea06a72 Gadu-Gadu: fix conferences used together with multilogon
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34365
diff changeset
278 else
b5341ea06a72 Gadu-Gadu: fix conferences used together with multilogon
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34365
diff changeset
279 {
b5341ea06a72 Gadu-Gadu: fix conferences used together with multilogon
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34365
diff changeset
280 msg->type = GGP_MESSAGE_GOT_TYPE_MULTILOGON;
b5341ea06a72 Gadu-Gadu: fix conferences used together with multilogon
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34365
diff changeset
281 }
34356
5d59fd4d5b2d Gadu-Gadu: reimplementation of receiving messages
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
282
34362
758e72362ca4 Gadu-Gadu: code polishing
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34361
diff changeset
283 ggp_message_format_from_gg(msg, ev->xhtml_message);
34361
ddcc82637afa Gadu-Gadu: incoming images works again
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34360
diff changeset
284 if (ggp_message_request_images(gc, msg))
ddcc82637afa Gadu-Gadu: incoming images works again
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34360
diff changeset
285 return;
ddcc82637afa Gadu-Gadu: incoming images works again
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34360
diff changeset
286
34356
5d59fd4d5b2d Gadu-Gadu: reimplementation of receiving messages
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
287 ggp_message_got_display(gc, msg);
5d59fd4d5b2d Gadu-Gadu: reimplementation of receiving messages
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
288 ggp_message_got_data_free(msg);
5d59fd4d5b2d Gadu-Gadu: reimplementation of receiving messages
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
289 }
5d59fd4d5b2d Gadu-Gadu: reimplementation of receiving messages
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
290
5d59fd4d5b2d Gadu-Gadu: reimplementation of receiving messages
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
291 static void ggp_message_got_display(PurpleConnection *gc,
5d59fd4d5b2d Gadu-Gadu: reimplementation of receiving messages
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
292 ggp_message_got_data *msg)
5d59fd4d5b2d Gadu-Gadu: reimplementation of receiving messages
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
293 {
5d59fd4d5b2d Gadu-Gadu: reimplementation of receiving messages
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
294 if (msg->type == GGP_MESSAGE_GOT_TYPE_IM)
5d59fd4d5b2d Gadu-Gadu: reimplementation of receiving messages
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
295 {
5d59fd4d5b2d Gadu-Gadu: reimplementation of receiving messages
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
296 serv_got_im(gc, ggp_uin_to_str(msg->user), msg->text,
5d59fd4d5b2d Gadu-Gadu: reimplementation of receiving messages
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
297 PURPLE_MESSAGE_RECV, msg->time);
5d59fd4d5b2d Gadu-Gadu: reimplementation of receiving messages
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
298 }
5d59fd4d5b2d Gadu-Gadu: reimplementation of receiving messages
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
299 else if (msg->type == GGP_MESSAGE_GOT_TYPE_CHAT)
5d59fd4d5b2d Gadu-Gadu: reimplementation of receiving messages
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
300 {
5d59fd4d5b2d Gadu-Gadu: reimplementation of receiving messages
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
301 ggp_chat_got_message(gc, msg->chat_id, msg->text, msg->time,
5d59fd4d5b2d Gadu-Gadu: reimplementation of receiving messages
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
302 msg->user);
5d59fd4d5b2d Gadu-Gadu: reimplementation of receiving messages
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
303 }
5d59fd4d5b2d Gadu-Gadu: reimplementation of receiving messages
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
304 else if (msg->type == GGP_MESSAGE_GOT_TYPE_MULTILOGON)
5d59fd4d5b2d Gadu-Gadu: reimplementation of receiving messages
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
305 {
5d59fd4d5b2d Gadu-Gadu: reimplementation of receiving messages
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
306 PurpleConversation *conv = ggp_message_get_conv(gc, msg->user);
5d59fd4d5b2d Gadu-Gadu: reimplementation of receiving messages
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
307 const gchar *me = purple_account_get_username(
5d59fd4d5b2d Gadu-Gadu: reimplementation of receiving messages
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
308 purple_connection_get_account(gc));
5d59fd4d5b2d Gadu-Gadu: reimplementation of receiving messages
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
309
5d59fd4d5b2d Gadu-Gadu: reimplementation of receiving messages
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
310 purple_conversation_write(conv, me, msg->text,
5d59fd4d5b2d Gadu-Gadu: reimplementation of receiving messages
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
311 PURPLE_MESSAGE_SEND, msg->time);
5d59fd4d5b2d Gadu-Gadu: reimplementation of receiving messages
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
312 }
5d59fd4d5b2d Gadu-Gadu: reimplementation of receiving messages
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
313 else
5d59fd4d5b2d Gadu-Gadu: reimplementation of receiving messages
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
314 purple_debug_error("gg", "ggp_message_got_display: "
5d59fd4d5b2d Gadu-Gadu: reimplementation of receiving messages
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
315 "unexpected message type: %d\n", msg->type);
5d59fd4d5b2d Gadu-Gadu: reimplementation of receiving messages
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
316 }
5d59fd4d5b2d Gadu-Gadu: reimplementation of receiving messages
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
317
34361
ddcc82637afa Gadu-Gadu: incoming images works again
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34360
diff changeset
318 static gboolean ggp_message_format_from_gg_found_img(const GMatchInfo *info,
ddcc82637afa Gadu-Gadu: incoming images works again
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34360
diff changeset
319 GString *res, gpointer data)
ddcc82637afa Gadu-Gadu: incoming images works again
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34360
diff changeset
320 {
34362
758e72362ca4 Gadu-Gadu: code polishing
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34361
diff changeset
321 ggp_message_got_data *msg = data;
34361
ddcc82637afa Gadu-Gadu: incoming images works again
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34360
diff changeset
322 gchar *name, *replacement;
ddcc82637afa Gadu-Gadu: incoming images works again
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34360
diff changeset
323 int64_t id;
34362
758e72362ca4 Gadu-Gadu: code polishing
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34361
diff changeset
324 int stored_id;
34361
ddcc82637afa Gadu-Gadu: incoming images works again
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34360
diff changeset
325
ddcc82637afa Gadu-Gadu: incoming images works again
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34360
diff changeset
326 name = g_match_info_fetch(info, 1);
34418
c27e31267e8d Gadu-Gadu: fix compilation on 64-bit targets
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34413
diff changeset
327 if (sscanf(name, "%" G_GINT64_MODIFIER "x", &id) != 1)
34362
758e72362ca4 Gadu-Gadu: code polishing
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34361
diff changeset
328 id = 0;
758e72362ca4 Gadu-Gadu: code polishing
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34361
diff changeset
329 g_free(name);
758e72362ca4 Gadu-Gadu: code polishing
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34361
diff changeset
330 if (!id)
34361
ddcc82637afa Gadu-Gadu: incoming images works again
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34360
diff changeset
331 {
ddcc82637afa Gadu-Gadu: incoming images works again
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34360
diff changeset
332 g_string_append(res, "[");
ddcc82637afa Gadu-Gadu: incoming images works again
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34360
diff changeset
333 g_string_append(res, _("broken image"));
ddcc82637afa Gadu-Gadu: incoming images works again
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34360
diff changeset
334 g_string_append(res, "]");
34362
758e72362ca4 Gadu-Gadu: code polishing
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34361
diff changeset
335 return FALSE;
34361
ddcc82637afa Gadu-Gadu: incoming images works again
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34360
diff changeset
336 }
34362
758e72362ca4 Gadu-Gadu: code polishing
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34361
diff changeset
337
758e72362ca4 Gadu-Gadu: code polishing
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34361
diff changeset
338 stored_id = ggp_image_get_cached(msg->gc, id);
758e72362ca4 Gadu-Gadu: code polishing
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34361
diff changeset
339
758e72362ca4 Gadu-Gadu: code polishing
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34361
diff changeset
340 if (stored_id > 0)
758e72362ca4 Gadu-Gadu: code polishing
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34361
diff changeset
341 {
758e72362ca4 Gadu-Gadu: code polishing
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34361
diff changeset
342 purple_debug_info("gg", "ggp_message_format_from_gg_found_img: "
34418
c27e31267e8d Gadu-Gadu: fix compilation on 64-bit targets
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34413
diff changeset
343 "getting image " GGP_IMAGE_ID_FORMAT " from cache\n",
c27e31267e8d Gadu-Gadu: fix compilation on 64-bit targets
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34413
diff changeset
344 id);
34362
758e72362ca4 Gadu-Gadu: code polishing
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34361
diff changeset
345 replacement = g_strdup_printf(GGP_IMAGE_DESTINATION, stored_id);
758e72362ca4 Gadu-Gadu: code polishing
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34361
diff changeset
346 g_string_append(res, replacement);
758e72362ca4 Gadu-Gadu: code polishing
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34361
diff changeset
347 g_free(replacement);
758e72362ca4 Gadu-Gadu: code polishing
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34361
diff changeset
348 return FALSE;
758e72362ca4 Gadu-Gadu: code polishing
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34361
diff changeset
349 }
758e72362ca4 Gadu-Gadu: code polishing
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34361
diff changeset
350
758e72362ca4 Gadu-Gadu: code polishing
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34361
diff changeset
351 if (NULL == g_list_find_custom(msg->pending_images, &id,
758e72362ca4 Gadu-Gadu: code polishing
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34361
diff changeset
352 ggp_int64_compare))
758e72362ca4 Gadu-Gadu: code polishing
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34361
diff changeset
353 {
758e72362ca4 Gadu-Gadu: code polishing
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34361
diff changeset
354 msg->pending_images = g_list_append(msg->pending_images,
758e72362ca4 Gadu-Gadu: code polishing
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34361
diff changeset
355 ggp_uint64dup(id));
758e72362ca4 Gadu-Gadu: code polishing
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34361
diff changeset
356 }
758e72362ca4 Gadu-Gadu: code polishing
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34361
diff changeset
357
758e72362ca4 Gadu-Gadu: code polishing
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34361
diff changeset
358 replacement = g_strdup_printf(GGP_IMAGE_REPLACEMENT, id);
758e72362ca4 Gadu-Gadu: code polishing
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34361
diff changeset
359 g_string_append(res, replacement);
758e72362ca4 Gadu-Gadu: code polishing
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34361
diff changeset
360 g_free(replacement);
34361
ddcc82637afa Gadu-Gadu: incoming images works again
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34360
diff changeset
361
ddcc82637afa Gadu-Gadu: incoming images works again
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34360
diff changeset
362 return FALSE;
ddcc82637afa Gadu-Gadu: incoming images works again
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34360
diff changeset
363 }
ddcc82637afa Gadu-Gadu: incoming images works again
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34360
diff changeset
364
34356
5d59fd4d5b2d Gadu-Gadu: reimplementation of receiving messages
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
365 static void ggp_message_format_from_gg(ggp_message_got_data *msg,
5d59fd4d5b2d Gadu-Gadu: reimplementation of receiving messages
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
366 const gchar *text)
5d59fd4d5b2d Gadu-Gadu: reimplementation of receiving messages
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
367 {
5d59fd4d5b2d Gadu-Gadu: reimplementation of receiving messages
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
368 gchar *text_new, *tmp;
5d59fd4d5b2d Gadu-Gadu: reimplementation of receiving messages
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
369
5d59fd4d5b2d Gadu-Gadu: reimplementation of receiving messages
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
370 if (text == NULL)
5d59fd4d5b2d Gadu-Gadu: reimplementation of receiving messages
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
371 {
5d59fd4d5b2d Gadu-Gadu: reimplementation of receiving messages
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
372 msg->text = g_strdup("");
5d59fd4d5b2d Gadu-Gadu: reimplementation of receiving messages
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
373 return;
5d59fd4d5b2d Gadu-Gadu: reimplementation of receiving messages
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
374 }
5d59fd4d5b2d Gadu-Gadu: reimplementation of receiving messages
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
375
5d59fd4d5b2d Gadu-Gadu: reimplementation of receiving messages
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
376 text_new = g_strdup(text);
5d59fd4d5b2d Gadu-Gadu: reimplementation of receiving messages
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
377 purple_str_strip_char(text_new, '\r');
5d59fd4d5b2d Gadu-Gadu: reimplementation of receiving messages
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
378
5d59fd4d5b2d Gadu-Gadu: reimplementation of receiving messages
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
379 tmp = text_new;
5d59fd4d5b2d Gadu-Gadu: reimplementation of receiving messages
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
380 text_new = purple_strreplace(text_new, GGP_GG10_DEFAULT_FORMAT,
5d59fd4d5b2d Gadu-Gadu: reimplementation of receiving messages
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
381 GGP_GG10_DEFAULT_FORMAT_REPLACEMENT);
5d59fd4d5b2d Gadu-Gadu: reimplementation of receiving messages
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
382 g_free(tmp);
5d59fd4d5b2d Gadu-Gadu: reimplementation of receiving messages
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
383
34361
ddcc82637afa Gadu-Gadu: incoming images works again
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34360
diff changeset
384 tmp = text_new;
ddcc82637afa Gadu-Gadu: incoming images works again
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34360
diff changeset
385 text_new = g_regex_replace_eval(global_data.re_gg_img, text_new, -1, 0,
ddcc82637afa Gadu-Gadu: incoming images works again
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34360
diff changeset
386 0, ggp_message_format_from_gg_found_img, msg, NULL);
ddcc82637afa Gadu-Gadu: incoming images works again
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34360
diff changeset
387 g_free(tmp);
ddcc82637afa Gadu-Gadu: incoming images works again
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34360
diff changeset
388
34356
5d59fd4d5b2d Gadu-Gadu: reimplementation of receiving messages
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
389 msg->text = text_new;
5d59fd4d5b2d Gadu-Gadu: reimplementation of receiving messages
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff changeset
390 }
34357
74dff2310289 Gadu-Gadu: reimplementation of sending messages
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34356
diff changeset
391
34369
6ae053435538 Gadu-Gadu: enable inline images and GG11 formatting for conferences
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34368
diff changeset
392 gchar * ggp_message_format_to_gg(PurpleConversation *conv, const gchar *text)
34357
74dff2310289 Gadu-Gadu: reimplementation of sending messages
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34356
diff changeset
393 {
74dff2310289 Gadu-Gadu: reimplementation of sending messages
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34356
diff changeset
394 gchar *text_new, *tmp;
34358
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
395 GList *rt = NULL; /* reformatted text */
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
396 GMatchInfo *match;
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
397 int pos = 0;
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
398 GList *pending_objects = NULL;
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
399 GList *font_stack = NULL;
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
400 static int html_sizes_pt[7] = { 7, 8, 9, 10, 12, 14, 16 };
34357
74dff2310289 Gadu-Gadu: reimplementation of sending messages
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34356
diff changeset
401
34358
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
402 ggp_font *font_new, *font_current, *font_base;
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
403 gboolean font_changed = FALSE;
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
404 gboolean in_any_tag = FALSE;
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
405
34360
c6bd55f526f9 Gadu-Gadu: code polishing for messages
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34359
diff changeset
406 /* TODO: verbose
c6bd55f526f9 Gadu-Gadu: code polishing for messages
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34359
diff changeset
407 * purple_debug_info("gg", "ggp formatting text: [%s]\n", text);
c6bd55f526f9 Gadu-Gadu: code polishing for messages
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34359
diff changeset
408 */
34357
74dff2310289 Gadu-Gadu: reimplementation of sending messages
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34356
diff changeset
409
34358
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
410 /* default font */
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
411 font_base = ggp_font_new();
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
412 font_current = ggp_font_new();
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
413 font_new = ggp_font_new();
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
414
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
415 /* GG11 doesn't use nbsp, it just print spaces */
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
416 text_new = purple_strreplace(text, "&nbsp;", " ");
34357
74dff2310289 Gadu-Gadu: reimplementation of sending messages
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34356
diff changeset
417
34358
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
418 /* add end-of-message tag */
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
419 if (strstr(text_new, "<eom>") != NULL)
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
420 {
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
421 tmp = text_new;
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
422 text_new = purple_strreplace(text_new, "<eom>", "");
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
423 g_free(tmp);
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
424 purple_debug_warning("gg", "ggp_message_format_to_gg: "
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
425 "unexpected <eom> tag\n");
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
426 }
34357
74dff2310289 Gadu-Gadu: reimplementation of sending messages
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34356
diff changeset
427 tmp = text_new;
34358
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
428 text_new = g_strdup_printf("%s<eom></eom>", text_new);
34357
74dff2310289 Gadu-Gadu: reimplementation of sending messages
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34356
diff changeset
429 g_free(tmp);
74dff2310289 Gadu-Gadu: reimplementation of sending messages
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34356
diff changeset
430
34359
7cf367cc1141 Gadu-Gadu: compile regular expressions only once per plugin load
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34358
diff changeset
431 g_regex_match(global_data.re_html_tag, text_new, 0, &match);
34358
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
432 while (g_match_info_matches(match))
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
433 {
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
434 int m_start, m_end, m_pos;
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
435 gboolean tag_close;
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
436 gchar *tag_str, *attribs_str;
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
437 ggp_html_tag tag;
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
438 gboolean text_before;
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
439
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
440 /* reading tag and its contents */
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
441 g_match_info_fetch_pos(match, 0, &m_start, &m_end);
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
442 g_assert(m_start >= 0 && m_end >= 0);
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
443 text_before = (m_start > pos);
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
444 g_match_info_fetch_pos(match, 1, &m_pos, NULL);
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
445 tag_close = (m_pos >= 0);
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
446 tag_str = g_match_info_fetch(match, 2);
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
447 tag = ggp_html_parse_tag(tag_str);
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
448 attribs_str = g_match_info_fetch(match, 3);
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
449 g_match_info_next(match, NULL);
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
450
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
451 if (tag == GGP_HTML_TAG_UNKNOWN)
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
452 purple_debug_warning("gg", "ggp_message_format_to_gg: "
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
453 "uknown tag %s\n", tag_str);
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
454
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
455 /* closing *all* formatting-related tags (GG11 weirness)
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
456 * and adding pending objects */
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
457 if ((text_before && (font_changed || pending_objects)) ||
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
458 (tag == GGP_HTML_TAG_EOM && tag_close))
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
459 {
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
460 font_changed = FALSE;
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
461 if (in_any_tag)
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
462 {
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
463 in_any_tag = FALSE;
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
464 if (font_current->s && !GGP_GG11_FORCE_COMPAT)
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
465 rt = g_list_prepend(rt,
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
466 g_strdup("</s>"));
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
467 if (font_current->u)
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
468 rt = g_list_prepend(rt,
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
469 g_strdup("</u>"));
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
470 if (font_current->i)
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
471 rt = g_list_prepend(rt,
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
472 g_strdup("</i>"));
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
473 if (font_current->b)
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
474 rt = g_list_prepend(rt,
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
475 g_strdup("</b>"));
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
476 rt = g_list_prepend(rt, g_strdup("</span>"));
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
477 }
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
478 if (pending_objects)
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
479 {
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
480 rt = g_list_concat(pending_objects, rt);
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
481 pending_objects = NULL;
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
482 }
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
483 }
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
484
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
485 /* opening formatting-related tags again */
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
486 if (text_before && !in_any_tag)
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
487 {
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
488 gchar *style;
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
489 GList *styles = NULL;
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
490 gboolean has_size = (font_new->size > 0 &&
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
491 font_new->size <= 7 && font_new->size != 3);
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
492
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
493 if (has_size)
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
494 styles = g_list_append(styles, g_strdup_printf(
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
495 "font-size:%dpt;",
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
496 html_sizes_pt[font_new->size - 1]));
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
497 if (font_new->face)
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
498 styles = g_list_append(styles, g_strdup_printf(
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
499 "font-family:%s;", font_new->face));
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
500 if (font_new->bgcolor >= 0 && !GGP_GG11_FORCE_COMPAT)
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
501 styles = g_list_append(styles, g_strdup_printf(
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
502 "background-color:#%06x;",
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
503 font_new->bgcolor));
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
504 if (font_new->color >= 0)
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
505 styles = g_list_append(styles, g_strdup_printf(
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
506 "color:#%06x;", font_new->color));
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
507
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
508 if (styles)
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
509 {
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
510 gchar *combined = ggp_strjoin_list(" ", styles);
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
511 g_list_free_full(styles, g_free);
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
512 style = g_strdup_printf(" style=\"%s\"",
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
513 combined);
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
514 g_free(combined);
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
515 }
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
516 else
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
517 style = g_strdup("");
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
518 rt = g_list_prepend(rt, g_strdup_printf("<span%s>",
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
519 style));
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
520 g_free(style);
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
521
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
522 if (font_new->b)
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
523 rt = g_list_prepend(rt, g_strdup("<b>"));
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
524 if (font_new->i)
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
525 rt = g_list_prepend(rt, g_strdup("<i>"));
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
526 if (font_new->u)
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
527 rt = g_list_prepend(rt, g_strdup("<u>"));
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
528 if (font_new->s && !GGP_GG11_FORCE_COMPAT)
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
529 rt = g_list_prepend(rt, g_strdup("<s>"));
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
530
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
531 ggp_font_free(font_current);
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
532 font_current = font_new;
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
533 font_new = ggp_font_clone(font_current);
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
534
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
535 in_any_tag = TRUE;
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
536 }
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
537 if (text_before)
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
538 {
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
539 rt = g_list_prepend(rt,
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
540 g_strndup(text_new + pos, m_start - pos));
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
541 }
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
542
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
543 /* set formatting of a following text */
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
544 if (tag == GGP_HTML_TAG_B)
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
545 {
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
546 font_changed |= (font_new->b != !tag_close);
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
547 font_new->b = !tag_close;
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
548 }
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
549 else if (tag == GGP_HTML_TAG_I)
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
550 {
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
551 font_changed |= (font_new->i != !tag_close);
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
552 font_new->i = !tag_close;
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
553 }
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
554 else if (tag == GGP_HTML_TAG_U)
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
555 {
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
556 font_changed |= (font_new->u != !tag_close);
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
557 font_new->u = !tag_close;
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
558 }
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
559 else if (tag == GGP_HTML_TAG_S)
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
560 {
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
561 font_changed |= (font_new->s != !tag_close);
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
562 font_new->s = !tag_close;
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
563 }
34365
25e4187ea5a7 Gadu-Gadu: outgoing images works again (not in conferences, yet)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34362
diff changeset
564 else if (tag == GGP_HTML_TAG_IMG && !tag_close)
25e4187ea5a7 Gadu-Gadu: outgoing images works again (not in conferences, yet)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34362
diff changeset
565 {
25e4187ea5a7 Gadu-Gadu: outgoing images works again (not in conferences, yet)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34362
diff changeset
566 GHashTable *attribs = ggp_html_tag_attribs(attribs_str);
25e4187ea5a7 Gadu-Gadu: outgoing images works again (not in conferences, yet)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34362
diff changeset
567 gchar *val = NULL;
25e4187ea5a7 Gadu-Gadu: outgoing images works again (not in conferences, yet)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34362
diff changeset
568 uint64_t id;
25e4187ea5a7 Gadu-Gadu: outgoing images works again (not in conferences, yet)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34362
diff changeset
569 int stored_id = -1;
25e4187ea5a7 Gadu-Gadu: outgoing images works again (not in conferences, yet)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34362
diff changeset
570 ggp_image_prepare_result res = -1;
25e4187ea5a7 Gadu-Gadu: outgoing images works again (not in conferences, yet)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34362
diff changeset
571
25e4187ea5a7 Gadu-Gadu: outgoing images works again (not in conferences, yet)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34362
diff changeset
572 if ((val = g_hash_table_lookup(attribs, "src")) != NULL
25e4187ea5a7 Gadu-Gadu: outgoing images works again (not in conferences, yet)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34362
diff changeset
573 && g_str_has_prefix(val,
25e4187ea5a7 Gadu-Gadu: outgoing images works again (not in conferences, yet)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34362
diff changeset
574 PURPLE_STORED_IMAGE_PROTOCOL))
25e4187ea5a7 Gadu-Gadu: outgoing images works again (not in conferences, yet)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34362
diff changeset
575 {
25e4187ea5a7 Gadu-Gadu: outgoing images works again (not in conferences, yet)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34362
diff changeset
576 val += strlen(PURPLE_STORED_IMAGE_PROTOCOL);
25e4187ea5a7 Gadu-Gadu: outgoing images works again (not in conferences, yet)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34362
diff changeset
577 if (sscanf(val, "%u", &stored_id) != 1)
25e4187ea5a7 Gadu-Gadu: outgoing images works again (not in conferences, yet)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34362
diff changeset
578 stored_id = -1;
25e4187ea5a7 Gadu-Gadu: outgoing images works again (not in conferences, yet)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34362
diff changeset
579 }
25e4187ea5a7 Gadu-Gadu: outgoing images works again (not in conferences, yet)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34362
diff changeset
580
25e4187ea5a7 Gadu-Gadu: outgoing images works again (not in conferences, yet)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34362
diff changeset
581 if (stored_id >= 0)
25e4187ea5a7 Gadu-Gadu: outgoing images works again (not in conferences, yet)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34362
diff changeset
582 res = ggp_image_prepare(conv, stored_id, &id);
25e4187ea5a7 Gadu-Gadu: outgoing images works again (not in conferences, yet)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34362
diff changeset
583
25e4187ea5a7 Gadu-Gadu: outgoing images works again (not in conferences, yet)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34362
diff changeset
584 if (res == GGP_IMAGE_PREPARE_OK)
25e4187ea5a7 Gadu-Gadu: outgoing images works again (not in conferences, yet)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34362
diff changeset
585 {
25e4187ea5a7 Gadu-Gadu: outgoing images works again (not in conferences, yet)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34362
diff changeset
586 pending_objects = g_list_prepend(
25e4187ea5a7 Gadu-Gadu: outgoing images works again (not in conferences, yet)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34362
diff changeset
587 pending_objects, g_strdup_printf(
34418
c27e31267e8d Gadu-Gadu: fix compilation on 64-bit targets
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34413
diff changeset
588 "<img name=\"" GGP_IMAGE_ID_FORMAT
c27e31267e8d Gadu-Gadu: fix compilation on 64-bit targets
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34413
diff changeset
589 "\">", id));
34365
25e4187ea5a7 Gadu-Gadu: outgoing images works again (not in conferences, yet)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34362
diff changeset
590 }
25e4187ea5a7 Gadu-Gadu: outgoing images works again (not in conferences, yet)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34362
diff changeset
591 else if (res == GGP_IMAGE_PREPARE_TOO_BIG)
25e4187ea5a7 Gadu-Gadu: outgoing images works again (not in conferences, yet)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34362
diff changeset
592 {
25e4187ea5a7 Gadu-Gadu: outgoing images works again (not in conferences, yet)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34362
diff changeset
593 purple_conversation_write(conv, "",
25e4187ea5a7 Gadu-Gadu: outgoing images works again (not in conferences, yet)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34362
diff changeset
594 _("Image is too large, please try "
25e4187ea5a7 Gadu-Gadu: outgoing images works again (not in conferences, yet)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34362
diff changeset
595 "smaller one."), PURPLE_MESSAGE_ERROR,
25e4187ea5a7 Gadu-Gadu: outgoing images works again (not in conferences, yet)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34362
diff changeset
596 time(NULL));
25e4187ea5a7 Gadu-Gadu: outgoing images works again (not in conferences, yet)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34362
diff changeset
597 }
25e4187ea5a7 Gadu-Gadu: outgoing images works again (not in conferences, yet)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34362
diff changeset
598 else
25e4187ea5a7 Gadu-Gadu: outgoing images works again (not in conferences, yet)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34362
diff changeset
599 {
25e4187ea5a7 Gadu-Gadu: outgoing images works again (not in conferences, yet)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34362
diff changeset
600 purple_conversation_write(conv, "",
25e4187ea5a7 Gadu-Gadu: outgoing images works again (not in conferences, yet)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34362
diff changeset
601 _("Image cannot be sent."),
25e4187ea5a7 Gadu-Gadu: outgoing images works again (not in conferences, yet)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34362
diff changeset
602 PURPLE_MESSAGE_ERROR, time(NULL));
25e4187ea5a7 Gadu-Gadu: outgoing images works again (not in conferences, yet)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34362
diff changeset
603 }
25e4187ea5a7 Gadu-Gadu: outgoing images works again (not in conferences, yet)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34362
diff changeset
604
25e4187ea5a7 Gadu-Gadu: outgoing images works again (not in conferences, yet)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34362
diff changeset
605 g_hash_table_destroy(attribs);
25e4187ea5a7 Gadu-Gadu: outgoing images works again (not in conferences, yet)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34362
diff changeset
606 }
34358
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
607 else if (tag == GGP_HTML_TAG_FONT && !tag_close)
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
608 {
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
609 GHashTable *attribs = ggp_html_tag_attribs(attribs_str);
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
610 gchar *val = NULL;
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
611
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
612 font_stack = g_list_prepend(font_stack,
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
613 ggp_font_clone(font_new));
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
614
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
615 if ((val = g_hash_table_lookup(attribs, "size")) != NULL
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
616 && val[0] >= '1' && val[0] <= '7' &&
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
617 val[1] == '\0')
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
618 {
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
619 int size = val[0] - '0';
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
620 font_changed |= (font_new->size != size);
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
621 font_new->size = size;
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
622 }
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
623
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
624 if ((val = g_hash_table_lookup(attribs, "face"))
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
625 != NULL)
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
626 {
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
627 font_changed |=
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
628 (g_strcmp0(font_new->face, val) != 0);
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
629 g_free(font_new->face);
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
630 font_new->face = g_strdup(val);
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
631 }
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
632
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
633 if ((val = g_hash_table_lookup(attribs, "color"))
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
634 != NULL && val[0] == '#' && strlen(val) == 7)
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
635 {
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
636 int color = ggp_html_decode_color(val);
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
637 font_changed |= (font_new->color != color);
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
638 font_new->color = color;
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
639 }
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
640
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
641 g_hash_table_destroy(attribs);
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
642 }
34360
c6bd55f526f9 Gadu-Gadu: code polishing for messages
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34359
diff changeset
643 else if ((tag == GGP_HTML_TAG_SPAN || tag == GGP_HTML_TAG_DIV)
c6bd55f526f9 Gadu-Gadu: code polishing for messages
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34359
diff changeset
644 && !tag_close)
34358
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
645 {
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
646 GHashTable *attribs, *styles = NULL;
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
647 gchar *style = NULL;
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
648 gchar *val = NULL;
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
649
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
650 attribs = ggp_html_tag_attribs(attribs_str);
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
651
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
652 font_stack = g_list_prepend(font_stack,
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
653 ggp_font_clone(font_new));
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
654 if (tag == GGP_HTML_TAG_DIV)
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
655 pending_objects = g_list_prepend(
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
656 pending_objects, g_strdup("<br>"));
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
657
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
658 style = g_hash_table_lookup(attribs, "style");
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
659 if (style)
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
660 styles = ggp_html_css_attribs(style);
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
661
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
662 if ((val = g_hash_table_lookup(styles,
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
663 "background-color")) != NULL)
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
664 {
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
665 int color = ggp_html_decode_color(val);
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
666 font_changed |= (font_new->bgcolor != color);
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
667 font_new->bgcolor = color;
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
668 }
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
669
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
670 if ((val = g_hash_table_lookup(styles,
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
671 "color")) != NULL)
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
672 {
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
673 int color = ggp_html_decode_color(val);
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
674 font_changed |= (font_new->color != color);
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
675 font_new->color = color;
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
676 }
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
677
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
678 if (styles)
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
679 g_hash_table_destroy(styles);
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
680 g_hash_table_destroy(attribs);
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
681 }
34360
c6bd55f526f9 Gadu-Gadu: code polishing for messages
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34359
diff changeset
682 else if ((tag == GGP_HTML_TAG_FONT || tag == GGP_HTML_TAG_SPAN
c6bd55f526f9 Gadu-Gadu: code polishing for messages
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34359
diff changeset
683 || tag == GGP_HTML_TAG_DIV) && tag_close)
34358
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
684 {
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
685 font_changed = TRUE;
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
686
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
687 ggp_font_free(font_new);
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
688 if (font_stack)
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
689 {
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
690 font_new = (ggp_font*)font_stack->data;
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
691 font_stack = g_list_delete_link(
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
692 font_stack, font_stack);
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
693 }
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
694 else
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
695 font_new = ggp_font_clone(font_base);
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
696 }
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
697 else if (tag == GGP_HTML_TAG_BR)
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
698 {
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
699 pending_objects = g_list_prepend(pending_objects,
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
700 g_strdup("<br>"));
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
701 }
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
702 else if (tag == GGP_HTML_TAG_HR)
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
703 {
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
704 pending_objects = g_list_prepend(pending_objects,
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
705 g_strdup("<br><span>---</span><br>"));
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
706 }
34360
c6bd55f526f9 Gadu-Gadu: code polishing for messages
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34359
diff changeset
707 else if (tag == GGP_HTML_TAG_A || tag == GGP_HTML_TAG_EOM)
34358
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
708 {
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
709 /* do nothing */
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
710 }
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
711 else if (tag == GGP_HTML_TAG_UNKNOWN)
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
712 {
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
713 purple_debug_warning("gg", "ggp_message_format_to_gg: "
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
714 "uknown tag %s\n", tag_str);
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
715 }
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
716 else
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
717 {
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
718 purple_debug_error("gg", "ggp_message_format_to_gg: "
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
719 "not handled tag %s\n", tag_str);
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
720 }
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
721
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
722 pos = m_end;
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
723 g_free(tag_str);
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
724 g_free(attribs_str);
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
725 }
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
726 g_match_info_free(match);
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
727
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
728 if (pos < strlen(text_new) || in_any_tag)
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
729 {
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
730 purple_debug_fatal("gg", "ggp_message_format_to_gg: "
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
731 "end of message not reached\n");
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
732 }
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
733
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
734 /* releasing fonts recources */
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
735 ggp_font_free(font_new);
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
736 ggp_font_free(font_current);
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
737 ggp_font_free(font_base);
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
738 g_list_free_full(font_stack, ggp_font_free);
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
739
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
740 /* combining reformatted text info one string */
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
741 rt = g_list_reverse(rt);
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
742 g_free(text_new);
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
743 text_new = ggp_strjoin_list("", rt);
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
744 g_list_free_full(rt, g_free);
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
745
34360
c6bd55f526f9 Gadu-Gadu: code polishing for messages
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34359
diff changeset
746 /* TODO: verbose
c6bd55f526f9 Gadu-Gadu: code polishing for messages
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34359
diff changeset
747 * purple_debug_info("gg", "reformatted text: [%s]\n", text_new);
c6bd55f526f9 Gadu-Gadu: code polishing for messages
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34359
diff changeset
748 */
34358
845e66c9a20d Gadu-Gadu: sent messages reformatting, as in GG11
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34357
diff changeset
749
34357
74dff2310289 Gadu-Gadu: reimplementation of sending messages
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34356
diff changeset
750 return text_new;
74dff2310289 Gadu-Gadu: reimplementation of sending messages
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34356
diff changeset
751 }
74dff2310289 Gadu-Gadu: reimplementation of sending messages
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34356
diff changeset
752
74dff2310289 Gadu-Gadu: reimplementation of sending messages
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34356
diff changeset
753 int ggp_message_send_im(PurpleConnection *gc, const char *who,
74dff2310289 Gadu-Gadu: reimplementation of sending messages
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34356
diff changeset
754 const char *message, PurpleMessageFlags flags)
74dff2310289 Gadu-Gadu: reimplementation of sending messages
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34356
diff changeset
755 {
74dff2310289 Gadu-Gadu: reimplementation of sending messages
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34356
diff changeset
756 GGPInfo *info = purple_connection_get_protocol_data(gc);
34365
25e4187ea5a7 Gadu-Gadu: outgoing images works again (not in conferences, yet)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34362
diff changeset
757 PurpleConversation *conv;
34357
74dff2310289 Gadu-Gadu: reimplementation of sending messages
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34356
diff changeset
758 ggp_buddy_data *buddy_data;
74dff2310289 Gadu-Gadu: reimplementation of sending messages
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34356
diff changeset
759 gchar *gg_msg;
74dff2310289 Gadu-Gadu: reimplementation of sending messages
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34356
diff changeset
760 gboolean succ;
74dff2310289 Gadu-Gadu: reimplementation of sending messages
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34356
diff changeset
761
74dff2310289 Gadu-Gadu: reimplementation of sending messages
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34356
diff changeset
762 /* TODO: return -ENOTCONN, if not connected */
74dff2310289 Gadu-Gadu: reimplementation of sending messages
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34356
diff changeset
763
74dff2310289 Gadu-Gadu: reimplementation of sending messages
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34356
diff changeset
764 if (message == NULL || message[0] == '\0')
74dff2310289 Gadu-Gadu: reimplementation of sending messages
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34356
diff changeset
765 return 0;
74dff2310289 Gadu-Gadu: reimplementation of sending messages
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34356
diff changeset
766
74dff2310289 Gadu-Gadu: reimplementation of sending messages
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34356
diff changeset
767 buddy_data = ggp_buddy_get_data(purple_find_buddy(
74dff2310289 Gadu-Gadu: reimplementation of sending messages
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34356
diff changeset
768 purple_connection_get_account(gc), who));
74dff2310289 Gadu-Gadu: reimplementation of sending messages
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34356
diff changeset
769
74dff2310289 Gadu-Gadu: reimplementation of sending messages
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34356
diff changeset
770 if (buddy_data->blocked)
74dff2310289 Gadu-Gadu: reimplementation of sending messages
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34356
diff changeset
771 return -1;
74dff2310289 Gadu-Gadu: reimplementation of sending messages
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34356
diff changeset
772
34365
25e4187ea5a7 Gadu-Gadu: outgoing images works again (not in conferences, yet)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34362
diff changeset
773 conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM,
25e4187ea5a7 Gadu-Gadu: outgoing images works again (not in conferences, yet)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34362
diff changeset
774 who, purple_connection_get_account(gc));
25e4187ea5a7 Gadu-Gadu: outgoing images works again (not in conferences, yet)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34362
diff changeset
775
25e4187ea5a7 Gadu-Gadu: outgoing images works again (not in conferences, yet)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34362
diff changeset
776 gg_msg = ggp_message_format_to_gg(conv, message);
34357
74dff2310289 Gadu-Gadu: reimplementation of sending messages
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34356
diff changeset
777
74dff2310289 Gadu-Gadu: reimplementation of sending messages
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34356
diff changeset
778 /* TODO: splitting messages */
74dff2310289 Gadu-Gadu: reimplementation of sending messages
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34356
diff changeset
779 if (strlen(gg_msg) > GG_MSG_MAXSIZE)
74dff2310289 Gadu-Gadu: reimplementation of sending messages
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34356
diff changeset
780 {
74dff2310289 Gadu-Gadu: reimplementation of sending messages
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34356
diff changeset
781 g_free(gg_msg);
74dff2310289 Gadu-Gadu: reimplementation of sending messages
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34356
diff changeset
782 return -E2BIG;
74dff2310289 Gadu-Gadu: reimplementation of sending messages
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34356
diff changeset
783 }
74dff2310289 Gadu-Gadu: reimplementation of sending messages
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34356
diff changeset
784
74dff2310289 Gadu-Gadu: reimplementation of sending messages
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34356
diff changeset
785 succ = (gg_send_message_html(info->session, GG_CLASS_CHAT,
74dff2310289 Gadu-Gadu: reimplementation of sending messages
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34356
diff changeset
786 ggp_str_to_uin(who), (unsigned char *)gg_msg) >= 0);
74dff2310289 Gadu-Gadu: reimplementation of sending messages
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34356
diff changeset
787
74dff2310289 Gadu-Gadu: reimplementation of sending messages
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34356
diff changeset
788 g_free(gg_msg);
74dff2310289 Gadu-Gadu: reimplementation of sending messages
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34356
diff changeset
789
74dff2310289 Gadu-Gadu: reimplementation of sending messages
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34356
diff changeset
790 return succ ? 1 : -1;
74dff2310289 Gadu-Gadu: reimplementation of sending messages
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34356
diff changeset
791 }

mercurial