Mercurial > pidgin
comparison src/conversation.c @ 4032:2b3a9d8f168e
[gaim-migrate @ 4238]
Smileys. These are just the default smileys--I'm adding the prpl-specific smileys right now.
If you want to help by creating some png's, IM me.
committer: Tailor Script <tailor@pidgin.im>
author | Sean Egan <seanegan@gmail.com> |
---|---|
date | Tue, 03 Dec 2002 02:02:16 +0000 |
parents | ab831dca298a |
children | 6e383852ad4e |
comparison
equal
deleted
inserted
replaced
4031:ec7e8c93c2ee | 4032:2b3a9d8f168e |
---|---|
52 #include <process.h> /* for getpid() */ | 52 #include <process.h> /* for getpid() */ |
53 #include <io.h> | 53 #include <io.h> |
54 #include "win32dep.h" | 54 #include "win32dep.h" |
55 #endif | 55 #endif |
56 | 56 |
57 /*#include "pixmaps/save_small.xpm"*/ | |
58 | |
59 #include "pixmaps/luke03.xpm" | |
60 #include "pixmaps/oneeye.xpm" | |
61 #include "pixmaps/crazy4.xpm" | |
62 #include "pixmaps/mrt.xpm" | |
63 #include "pixmaps/download.xpm" | |
64 #include "pixmaps/farted.xpm" | |
65 | |
66 int state_lock = 0; | 57 int state_lock = 0; |
67 | 58 |
68 GdkPixmap *dark_icon_pm = NULL; | 59 GdkPixmap *dark_icon_pm = NULL; |
69 GdkBitmap *dark_icon_bm = NULL; | 60 GdkBitmap *dark_icon_bm = NULL; |
70 | 61 |
96 /*------------------------------------------------------------------------*/ | 87 /*------------------------------------------------------------------------*/ |
97 | 88 |
98 | 89 |
99 void gaim_setup_imhtml_smileys(GtkWidget *imhtml) | 90 void gaim_setup_imhtml_smileys(GtkWidget *imhtml) |
100 { | 91 { |
101 gtk_imhtml_associate_smiley(GTK_IMHTML(imhtml), "C:)", luke03_xpm); | 92 /* This is ugly right now--it will get better when the themable smileys come */ |
102 gtk_imhtml_associate_smiley(GTK_IMHTML(imhtml), "C:-)", luke03_xpm); | 93 |
103 gtk_imhtml_associate_smiley(GTK_IMHTML(imhtml), "O-)", oneeye_xpm); | 94 |
104 gtk_imhtml_associate_smiley(GTK_IMHTML(imhtml), ">:)", crazy4_xpm); | 95 char *filename; |
105 gtk_imhtml_associate_smiley(GTK_IMHTML(imhtml), ">:-)", crazy4_xpm); | 96 filename = g_build_filename(DATADIR, "pixmaps", "gaim", "smileys", "default", "smile.png", NULL); |
106 gtk_imhtml_associate_smiley(GTK_IMHTML(imhtml), ":-o)))", mrt_xpm); | 97 gtk_imhtml_associate_smiley(GTK_IMHTML(imhtml), ":)", NULL, filename); |
107 gtk_imhtml_associate_smiley(GTK_IMHTML(imhtml), ":-O)))", mrt_xpm); | 98 gtk_imhtml_associate_smiley(GTK_IMHTML(imhtml), ":-)", NULL, filename); |
108 gtk_imhtml_associate_smiley(GTK_IMHTML(imhtml), "8-|)", download_xpm); | 99 |
109 gtk_imhtml_associate_smiley(GTK_IMHTML(imhtml), ":-]", farted_xpm); | 100 filename = g_build_filename(DATADIR, "pixmaps", "gaim", "smileys", "default", "sad.png", NULL); |
101 gtk_imhtml_associate_smiley(GTK_IMHTML(imhtml), ":(", NULL, filename); | |
102 gtk_imhtml_associate_smiley(GTK_IMHTML(imhtml), ":-(", NULL, filename); | |
103 | |
104 filename = g_build_filename(DATADIR, "pixmaps", "gaim", "smileys", "default", "wink.png", NULL); | |
105 gtk_imhtml_associate_smiley(GTK_IMHTML(imhtml), ";)", NULL, filename); | |
106 gtk_imhtml_associate_smiley(GTK_IMHTML(imhtml), ";-)", NULL, filename); | |
107 | |
108 filename = g_build_filename(DATADIR, "pixmaps", "gaim", "smileys", "default", "tounge.png", NULL); | |
109 gtk_imhtml_associate_smiley(GTK_IMHTML(imhtml), ":-p", NULL, filename); | |
110 gtk_imhtml_associate_smiley(GTK_IMHTML(imhtml), ":-P", NULL, filename); | |
111 | |
112 filename = g_build_filename(DATADIR, "pixmaps", "gaim", "smileys", "default", "scream.png", NULL); | |
113 gtk_imhtml_associate_smiley(GTK_IMHTML(imhtml), "=-O", NULL, filename); | |
114 gtk_imhtml_associate_smiley(GTK_IMHTML(imhtml), "=-o", NULL, filename); | |
115 | |
116 filename = g_build_filename(DATADIR, "pixmaps", "gaim", "smileys", "default", "kiss.png", NULL); | |
117 gtk_imhtml_associate_smiley(GTK_IMHTML(imhtml), ":-*", NULL, filename); | |
118 | |
119 filename = g_build_filename(DATADIR, "pixmaps", "gaim", "smileys", "default", "yell.png", NULL); | |
120 gtk_imhtml_associate_smiley(GTK_IMHTML(imhtml), ">:o", NULL, filename); | |
121 gtk_imhtml_associate_smiley(GTK_IMHTML(imhtml), ">:O", NULL, filename); | |
122 | |
123 filename = g_build_filename(DATADIR, "pixmaps", "gaim", "smileys", "default", "cool.png", NULL); | |
124 gtk_imhtml_associate_smiley(GTK_IMHTML(imhtml), "8-)", NULL, filename); | |
125 | |
126 filename = g_build_filename(DATADIR, "pixmaps", "gaim", "smileys", "default", "moneymouth.png", NULL); | |
127 gtk_imhtml_associate_smiley(GTK_IMHTML(imhtml), ":-$", NULL, filename); | |
128 | |
129 filename = g_build_filename(DATADIR, "pixmaps", "gaim", "smileys", "default", "burp.png", NULL); | |
130 gtk_imhtml_associate_smiley(GTK_IMHTML(imhtml), ":-!", NULL, filename); | |
131 | |
132 filename = g_build_filename(DATADIR, "pixmaps", "gaim", "smileys", "default", "embarrassed.png", NULL); | |
133 gtk_imhtml_associate_smiley(GTK_IMHTML(imhtml), ":-[", NULL, filename); | |
134 | |
135 filename = g_build_filename(DATADIR, "pixmaps", "gaim", "smileys", "default", "cry.png", NULL); | |
136 gtk_imhtml_associate_smiley(GTK_IMHTML(imhtml), ":'(", NULL, filename); | |
137 | |
138 filename = g_build_filename(DATADIR, "pixmaps", "gaim", "smileys", "default", "think.png", NULL); | |
139 gtk_imhtml_associate_smiley(GTK_IMHTML(imhtml), ":-/", NULL, filename); | |
140 gtk_imhtml_associate_smiley(GTK_IMHTML(imhtml), ":-\\", NULL, filename); | |
141 | |
142 filename = g_build_filename(DATADIR, "pixmaps", "gaim", "smileys", "default", "crossedlips.png", NULL); | |
143 gtk_imhtml_associate_smiley(GTK_IMHTML(imhtml), ":-x", NULL, filename); | |
144 gtk_imhtml_associate_smiley(GTK_IMHTML(imhtml), ":-X", NULL, filename); | |
145 | |
146 filename = g_build_filename(DATADIR, "pixmaps", "gaim", "smileys", "default", "bigsmile.png", NULL); | |
147 gtk_imhtml_associate_smiley(GTK_IMHTML(imhtml), ":-d", NULL, filename); | |
148 gtk_imhtml_associate_smiley(GTK_IMHTML(imhtml), ":-D", NULL, filename); | |
149 | |
150 filename = g_build_filename(DATADIR, "pixmaps", "gaim", "smileys", "default", "angel.png", NULL); | |
151 gtk_imhtml_associate_smiley(GTK_IMHTML(imhtml), "O:-)", NULL, filename); | |
152 | |
153 | |
154 /* "Secret" smileys */ | |
155 filename = g_build_filename(DATADIR, "pixmaps", "gaim", "smileys", "default", "luke.png", NULL); | |
156 gtk_imhtml_associate_smiley(GTK_IMHTML(imhtml), "C:)", NULL, filename); | |
157 gtk_imhtml_associate_smiley(GTK_IMHTML(imhtml), "C:-)", NULL, filename); | |
158 | |
159 filename = g_build_filename(DATADIR, "pixmaps", "gaim", "smileys", "default", "oneeye.png", NULL); | |
160 gtk_imhtml_associate_smiley(GTK_IMHTML(imhtml), "O-)", NULL, filename); | |
161 | |
162 filename = g_build_filename(DATADIR, "pixmaps", "gaim", "smileys", "default", "crazy.png", NULL); | |
163 gtk_imhtml_associate_smiley(GTK_IMHTML(imhtml), ">:)", NULL, filename); | |
164 gtk_imhtml_associate_smiley(GTK_IMHTML(imhtml), ">:-)", NULL, filename); | |
165 | |
166 filename = g_build_filename(DATADIR, "pixmaps", "gaim", "smileys", "default", "mrt.png", NULL); | |
167 gtk_imhtml_associate_smiley(GTK_IMHTML(imhtml), ":-o)))", NULL, filename); | |
168 gtk_imhtml_associate_smiley(GTK_IMHTML(imhtml), ":-O)))", NULL, filename); | |
169 | |
170 filename = g_build_filename(DATADIR, "pixmaps", "gaim", "smileys", "default", "download.png", NULL); | |
171 gtk_imhtml_associate_smiley(GTK_IMHTML(imhtml), "8-|)", NULL, filename); | |
172 | |
173 filename = g_build_filename(DATADIR, "pixmaps", "gaim", "smileys", "default", "farted.png", NULL); | |
174 gtk_imhtml_associate_smiley(GTK_IMHTML(imhtml), ":-]", NULL, filename); | |
110 } | 175 } |
111 | 176 |
112 void gaim_setup_imhtml(GtkWidget *imhtml) | 177 void gaim_setup_imhtml(GtkWidget *imhtml) |
113 { | 178 { |
114 g_return_if_fail(imhtml != NULL); | 179 g_return_if_fail(imhtml != NULL); |
1795 int gtk_font_options = 0; | 1860 int gtk_font_options = 0; |
1796 GString *logstr; | 1861 GString *logstr; |
1797 char buf2[BUF_LONG]; | 1862 char buf2[BUF_LONG]; |
1798 char mdate[64]; | 1863 char mdate[64]; |
1799 int unhighlight = 0; | 1864 int unhighlight = 0; |
1865 char *withfonttag; | |
1800 | 1866 |
1801 if (c->is_chat && (!c->gc || !g_slist_find(c->gc->buddy_chats, c))) | 1867 if (c->is_chat && (!c->gc || !g_slist_find(c->gc->buddy_chats, c))) |
1802 return; | 1868 return; |
1803 | 1869 |
1804 if (!c->is_chat && !g_list_find(conversations, c)) | 1870 if (!c->is_chat && !g_list_find(conversations, c)) |
1957 "<B>%s</B></FONT> ", colour, mdate, str); | 2023 "<B>%s</B></FONT> ", colour, mdate, str); |
1958 | 2024 |
1959 g_free(str); | 2025 g_free(str); |
1960 | 2026 |
1961 gtk_imhtml_append_text(GTK_IMHTML(c->text), buf2, -1, 0); | 2027 gtk_imhtml_append_text(GTK_IMHTML(c->text), buf2, -1, 0); |
1962 | 2028 |
1963 logstr = gtk_imhtml_append_text(GTK_IMHTML(c->text), what, length, gtk_font_options); | 2029 withfonttag = g_strdup_printf("<font sml=\"%s\">%s</font>", c->gc->prpl->name, what); |
2030 logstr = gtk_imhtml_append_text(GTK_IMHTML(c->text), withfonttag, length, gtk_font_options); | |
1964 | 2031 |
1965 gtk_imhtml_append_text(GTK_IMHTML(c->text), "<BR>", -1, 0); | 2032 gtk_imhtml_append_text(GTK_IMHTML(c->text), "<BR>", -1, 0); |
1966 | 2033 |
1967 /* XXX this needs to be updated for the new length argument */ | 2034 /* XXX this needs to be updated for the new length argument */ |
1968 if (logging_options & OPT_LOG_STRIP_HTML) { | 2035 if (logging_options & OPT_LOG_STRIP_HTML) { |
1997 else | 2064 else |
1998 g_snprintf(nm, 256, "%s", c->name); | 2065 g_snprintf(nm, 256, "%s", c->name); |
1999 | 2066 |
2000 if (logging_options & OPT_LOG_STRIP_HTML) { | 2067 if (logging_options & OPT_LOG_STRIP_HTML) { |
2001 t1 = strip_html(buf); | 2068 t1 = strip_html(buf); |
2002 t2 = strip_html(what); | 2069 t2 = strip_html(withfonttag); |
2003 } else { | 2070 } else { |
2004 t1 = html_logize(buf); | 2071 t1 = html_logize(buf); |
2005 t2 = html_logize(what); | 2072 t2 = html_logize(withfonttag); |
2006 } | 2073 } |
2007 fd = open_log_file(nm, c->is_chat); | 2074 fd = open_log_file(nm, c->is_chat); |
2008 if (fd) { | 2075 if (fd) { |
2009 if (logging_options & OPT_LOG_STRIP_HTML) { | 2076 if (logging_options & OPT_LOG_STRIP_HTML) { |
2010 fprintf(fd, "%s%s\n", t1, t2); | 2077 fprintf(fd, "%s%s\n", t1, t2); |
2016 } | 2083 } |
2017 g_free(t1); | 2084 g_free(t1); |
2018 g_free(t2); | 2085 g_free(t2); |
2019 g_free(nm); | 2086 g_free(nm); |
2020 } | 2087 } |
2021 } | 2088 |
2089 g_free(withfonttag); | |
2090 } | |
2091 | |
2022 | 2092 |
2023 if (!(flags & WFLAG_NOLOG) && ((c->is_chat && (chat_options & OPT_CHAT_POPUP)) || | 2093 if (!(flags & WFLAG_NOLOG) && ((c->is_chat && (chat_options & OPT_CHAT_POPUP)) || |
2024 (!c->is_chat && (im_options & OPT_IM_POPUP)))) | 2094 (!c->is_chat && (im_options & OPT_IM_POPUP)))) |
2025 gdk_window_show(c->window->window); | 2095 gdk_window_show(c->window->window); |
2026 | 2096 |
3592 | 3662 |
3593 while (smilies) { | 3663 while (smilies) { |
3594 struct _prpl_smiley *smile = | 3664 struct _prpl_smiley *smile = |
3595 (struct _prpl_smiley *)smilies->data; | 3665 (struct _prpl_smiley *)smilies->data; |
3596 | 3666 |
3597 gtk_imhtml_associate_smiley(GTK_IMHTML(c->text), smile->key, smile->xpm); | 3667 //gtk_imhtml_associate_smiley(GTK_IMHTML(c->text), smile->key, smile->xpm); |
3598 smilies = g_slist_next(smilies); | 3668 smilies = g_slist_next(smilies); |
3599 } | 3669 } |
3600 } else { | 3670 } else { |
3601 gtk_imhtml_reset_smileys(GTK_IMHTML(c->text)); | 3671 gtk_imhtml_reset_smileys(GTK_IMHTML(c->text)); |
3602 } | 3672 } |