Sun, 17 Oct 2004 23:55:49 +0000
[gaim-migrate @ 11141]
Two things:
a. Added Enter as a gtk_binding to GtkIMHtml. This fixes everything.
Input methods now work. The "Enter sends" and "Ctrl-Enter sends" preferences
were removed and defaulted to yes and no respectively, BUT, in a very super-cool
turn of events, you can now add your own bindings to .gtkrc to make WHATEVER
YOU WANT send. Awesome. Someone should use g_signal_accumulator_true_handled
or something to make profiles and away messages able to insert newlines.
b. Removed "Use multi-colored screennames in chats," defaulted to yes, and
wrote a nifty algorithm to automatically adjust the colors to accomodate the
background (see http://gaim.sf.net/sean/porn-chat.png). People should play
around and tweak it a bit. The algorithm takes into consideration the
luminosity of the current background and the base hue to use for the screenname
in generating the new colors. Note that it does this while maintaining the hues.
Someone should optimize this so it skips over the floating point arithmatic when
the background color is white.
|
5872
754c63f29b77
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
1 | #include "internal.h" |
|
754c63f29b77
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
2 | |
|
754c63f29b77
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
3 | #include "blist.h" |
|
754c63f29b77
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
4 | #include "conversation.h" |
|
754c63f29b77
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
5 | #include "debug.h" |
|
6485
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6441
diff
changeset
|
6 | #include "signals.h" |
| 9943 | 7 | #include "version.h" |
|
5872
754c63f29b77
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5676
diff
changeset
|
8 | |
| 9583 | 9 | #include "plugin.h" |
| 10 | #include "pluginpref.h" | |
| 11 | #include "prefs.h" | |
| 12 | ||
| 13 | #define STATENOTIFY_PLUGIN_ID "core-statenotify" | |
| 14 | ||
| 5267 | 15 | static void |
| 6695 | 16 | write_status(GaimBuddy *buddy, const char *message) |
| 5267 | 17 | { |
|
5676
d3c2fdaf4821
[gaim-migrate @ 6094]
Christian Hammond <chipx86@chipx86.com>
parents:
5587
diff
changeset
|
18 | GaimConversation *conv; |
|
6485
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6441
diff
changeset
|
19 | const char *who; |
| 5267 | 20 | char buf[256]; |
| 21 | ||
|
6485
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6441
diff
changeset
|
22 | conv = gaim_find_conversation_with_account(buddy->name, buddy->account); |
| 5267 | 23 | |
| 24 | if (conv == NULL) | |
| 25 | return; | |
| 26 | ||
|
9620
fe99fcea5c1c
[gaim-migrate @ 10464]
Christopher O'Brien <siege@pidgin.im>
parents:
9583
diff
changeset
|
27 | who = gaim_buddy_get_alias(buddy); |
| 5267 | 28 | |
|
6489
4281626455d8
[gaim-migrate @ 7003]
Robert McQueen <robot101@debian.org>
parents:
6485
diff
changeset
|
29 | g_snprintf(buf, sizeof(buf), message, who); |
| 5267 | 30 | |
|
6982
12f08de92674
[gaim-migrate @ 7538]
Mark Doliner <markdoliner@pidgin.im>
parents:
6695
diff
changeset
|
31 | gaim_conversation_write(conv, NULL, buf, GAIM_MESSAGE_SYSTEM, time(NULL)); |
| 5267 | 32 | } |
| 33 | ||
| 34 | static void | |
| 6695 | 35 | buddy_away_cb(GaimBuddy *buddy, void *data) |
| 5267 | 36 | { |
| 9583 | 37 | if (gaim_prefs_get_bool("/plugins/core/statenotify/notify_away")) |
| 38 | write_status(buddy, _("%s has gone away.")); | |
| 5267 | 39 | } |
| 40 | ||
| 41 | static void | |
| 6695 | 42 | buddy_unaway_cb(GaimBuddy *buddy, void *data) |
| 5267 | 43 | { |
| 9583 | 44 | if (gaim_prefs_get_bool("/plugins/core/statenotify/notify_away")) |
| 45 | write_status(buddy, _("%s is no longer away.")); | |
| 5267 | 46 | } |
| 47 | ||
| 48 | static void | |
| 6695 | 49 | buddy_idle_cb(GaimBuddy *buddy, void *data) |
| 5267 | 50 | { |
| 9583 | 51 | if (gaim_prefs_get_bool("/plugins/core/statenotify/notify_idle")) |
| 52 | write_status(buddy, _("%s has become idle.")); | |
| 5267 | 53 | } |
| 54 | ||
| 55 | static void | |
| 6695 | 56 | buddy_unidle_cb(GaimBuddy *buddy, void *data) |
| 5267 | 57 | { |
| 9583 | 58 | if (gaim_prefs_get_bool("/plugins/core/statenotify/notify_idle")) |
| 59 | write_status(buddy, _("%s is no longer idle.")); | |
| 60 | } | |
| 61 | ||
| 62 | static GaimPluginPrefFrame * | |
| 63 | get_plugin_pref_frame(GaimPlugin *plugin) | |
| 64 | { | |
| 65 | GaimPluginPrefFrame *frame; | |
| 66 | GaimPluginPref *ppref; | |
| 67 | ||
| 68 | frame = gaim_plugin_pref_frame_new(); | |
| 69 | ||
|
9648
34a457599c78
[gaim-migrate @ 10496]
Mark Doliner <markdoliner@pidgin.im>
parents:
9620
diff
changeset
|
70 | ppref = gaim_plugin_pref_new_with_label(_("Notify When")); |
| 9583 | 71 | gaim_plugin_pref_frame_add(frame, ppref); |
| 72 | ||
|
9648
34a457599c78
[gaim-migrate @ 10496]
Mark Doliner <markdoliner@pidgin.im>
parents:
9620
diff
changeset
|
73 | ppref = gaim_plugin_pref_new_with_name_and_label("/plugins/core/statenotify/notify_away", _("Buddy Goes _Away")); |
| 9583 | 74 | gaim_plugin_pref_frame_add(frame, ppref); |
| 75 | ||
|
9648
34a457599c78
[gaim-migrate @ 10496]
Mark Doliner <markdoliner@pidgin.im>
parents:
9620
diff
changeset
|
76 | ppref = gaim_plugin_pref_new_with_name_and_label("/plugins/core/statenotify/notify_idle", _("Buddy Goes _Idle")); |
| 9583 | 77 | gaim_plugin_pref_frame_add(frame, ppref); |
| 78 | ||
| 79 | return frame; | |
| 5267 | 80 | } |
| 81 | ||
| 82 | static gboolean | |
| 83 | plugin_load(GaimPlugin *plugin) | |
| 84 | { | |
|
6485
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6441
diff
changeset
|
85 | void *blist_handle = gaim_blist_get_handle(); |
|
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6441
diff
changeset
|
86 | |
|
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6441
diff
changeset
|
87 | gaim_signal_connect(blist_handle, "buddy-away", |
|
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6441
diff
changeset
|
88 | plugin, GAIM_CALLBACK(buddy_away_cb), NULL); |
|
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6441
diff
changeset
|
89 | gaim_signal_connect(blist_handle, "buddy-back", |
|
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6441
diff
changeset
|
90 | plugin, GAIM_CALLBACK(buddy_unaway_cb), NULL); |
|
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6441
diff
changeset
|
91 | gaim_signal_connect(blist_handle, "buddy-idle", |
|
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6441
diff
changeset
|
92 | plugin, GAIM_CALLBACK(buddy_idle_cb), NULL); |
|
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6441
diff
changeset
|
93 | gaim_signal_connect(blist_handle, "buddy-unidle", |
|
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6441
diff
changeset
|
94 | plugin, GAIM_CALLBACK(buddy_unidle_cb), NULL); |
| 5267 | 95 | |
| 96 | return TRUE; | |
| 97 | } | |
| 98 | ||
| 9583 | 99 | static GaimPluginUiInfo prefs_info = |
| 100 | { | |
| 101 | get_plugin_pref_frame | |
| 102 | }; | |
| 103 | ||
| 5267 | 104 | static GaimPluginInfo info = |
| 105 | { | |
| 9943 | 106 | GAIM_PLUGIN_MAGIC, |
| 107 | GAIM_MAJOR_VERSION, | |
| 108 | GAIM_MINOR_VERSION, | |
| 5267 | 109 | GAIM_PLUGIN_STANDARD, /**< type */ |
| 110 | NULL, /**< ui_requirement */ | |
| 111 | 0, /**< flags */ | |
| 112 | NULL, /**< dependencies */ | |
| 113 | GAIM_PRIORITY_DEFAULT, /**< priority */ | |
| 114 | ||
| 9583 | 115 | STATENOTIFY_PLUGIN_ID, /**< id */ |
| 5267 | 116 | N_("Buddy State Notification"), /**< name */ |
| 117 | VERSION, /**< version */ | |
| 118 | /** summary */ | |
| 119 | N_("Notifies in a conversation window when a buddy goes or returns from " | |
| 120 | "away or idle."), | |
| 121 | /** description */ | |
| 122 | N_("Notifies in a conversation window when a buddy goes or returns from " | |
| 123 | "away or idle."), | |
| 124 | "Christian Hammond <chipx86@gnupdate.org>", /**< author */ | |
|
6485
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6441
diff
changeset
|
125 | GAIM_WEBSITE, /**< homepage */ |
| 5267 | 126 | |
| 127 | plugin_load, /**< load */ | |
| 128 | NULL, /**< unload */ | |
| 129 | NULL, /**< destroy */ | |
| 130 | ||
| 131 | NULL, /**< ui_info */ | |
| 8993 | 132 | NULL, /**< extra_info */ |
| 9583 | 133 | &prefs_info, /**< prefs_info */ |
| 8993 | 134 | NULL |
| 5267 | 135 | }; |
| 136 | ||
| 137 | static void | |
|
5920
963bfdefee02
[gaim-migrate @ 6360]
Christian Hammond <chipx86@chipx86.com>
parents:
5873
diff
changeset
|
138 | init_plugin(GaimPlugin *plugin) |
| 5267 | 139 | { |
| 9583 | 140 | gaim_prefs_add_none("/plugins/core/statenotify"); |
| 141 | gaim_prefs_add_bool("/plugins/core/statenotify/notify_away", TRUE); | |
| 142 | gaim_prefs_add_bool("/plugins/core/statenotify/notify_idle", TRUE); | |
| 5267 | 143 | } |
| 144 | ||
| 6063 | 145 | GAIM_INIT_PLUGIN(statenotify, init_plugin, info) |