Quantcast
Download
(5 Kb)
Download
Updated: 10/02/19 04:12 PM
Compatibility:
Dragonhold (5.2.5)
Scalebreaker (5.1.5)
Elsweyr (5.0.5)
Updated:10/02/19 04:12 PM
Created:09/09/14 09:21 AM
Monthly downloads:1,526
Total downloads:12,537
Favorites:8
MD5:
5.2.5
libChat2  Popular! (More than 5000 hits)
Version: 12
by: Ayantir, Baertram
libChat2 is a rewrited copy of original libChat.

The library name for other addon's manifest txt file is:
Code:
libChat2 -non capital l
The global variable name for the access by other addons is:
Code:
LibChat2

Why this library :

libChat2 is intended to rewrite messages, sender name or some standardized system messages sent to the chat. If you need to rewrite one of those strings, it's the library you need !

Please note that libChat2 does not YET modify messages sen trought d() or CHAT_SYSTEM:AddMessage(), see you soon !



Integration :
Please note that libChat2 is not an addon, it's a library.
It must be used as a dependancy in your addon, via your addon's manifest txt file.

In your manifest file (e.g. addon.txt), please include it as dependency:
## DependsOn: libChat2
or as an optional dependency:
Code:
## OptionalDependsOn: libChat2

Then in your addon, you will need to registrer library :
Lua Code:
  1. -- Registering librairies
  2. local LC = LibChat2


And register methods you want to use (register only the one you need !) :
Lua Code:
  1. -- libChat
  2.  
  3.     -- All those events outputs to the ChatSystem
  4.    
  5.     -- First APPEND something to a message sent by EVENT_CHAT_MESSAGE_CHANNEL
  6.     LC:registerAppendDDSBeforeAll(myFuncToAppendDDSBeforeAll, addonName)
  7.     LC:registerAppendTextBeforeAll(myFuncToAppendTextBeforeAll, addonName)
  8.     LC:registerAppendDDSBeforeSender(myFuncToAppendDDSTextureBeforeSenderName, addonName)
  9.     LC:registerAppendTextBeforeSender(myFuncToAppendTextBeforeSenderName, addonName)
  10.     LC:registerAppendTextAfterSender(myFuncToAppendTextAfterSenderName, addonName)
  11.     LC:registerAppendDDSAfterSender(myFuncToAppendDDSAfterSenderName, addonName)
  12.     LC:registerAppendDDSBeforeText(myFuncToAppendDDSBeforeText, addonName)
  13.     LC:registerAppendTextBeforeText(myFuncToAppendTextBeforeText, addonName)
  14.     LC:registerAppendTextAfterText(myFuncToAppendTextAfterText, addonName)
  15.     LC:registerAppendDDSAfterText(myFuncToAppendDDSAfterText, addonName)
  16.    
  17.     -- Then CHANGE something in the message
  18.     -- registerName = from for EVENT_CHAT_MESSAGE_CHANNEL, registerText = message for EVENT_CHAT_MESSAGE_CHANNEL, registerFormat = Whole "message" (from + name + colors + infoarray, etc) for EVENT_CHAT_MESSAGE_CHANNEL
  19.     LC:registerName(myFuncToChangeFromName, addonName)
  20.     LC:registerText(myFuncToChangeText, addonName)
  21.     LC:registerFormat(myFuncToChangeTheEntireWholeMessage, addonName)
  22.    
  23.     -- Because it is output to the chat, this sysmessage can also be modified
  24.     -- registerFriendStatus = message for EVENT_FRIEND_PLAYER_STATUS_CHANGED
  25.     LC:registerFriendStatus(myFuncToChangeFriendStatusMessage, addonName)
  26.    
  27.     -- Those ESOUI events can also be modified
  28.     -- registerIgnoreAdd = message for EVENT_IGNORE_ADDED, registerIgnoreRemove = message for EVENT_IGNORE_REMOVED
  29.     -- registerGroupTypeChanged = message for EVENT_GROUP_TYPE_CHANGED
  30.     LC:registerIgnoreAdd(myFuncToChangeIgnoreAddMessage, addonName)
  31.     LC:registerIgnoreRemove(myFuncToChangeIgnoreRemoveMessage, addonName)
  32.     LC:registerGroupTypeChanged(myFuncToChangeGroupTypeChangedMessage, addonName)


About registerFormat :

Please note that :registerFormat overwrite all libChat addons. If you need to use registerFormat, please note that your addon may broke some others, so be careful !
If you want to use this method and keep rewrited text by others addons, original and rewrited strings are available when playing with registerFormat



Functions and arguments available :

Each method come with arguments for your function :
Please note that for all methods, addonName is optionnal and used to register addon with libChat for debugging.

LC:registerName(myFuncToChangeFromName [, addonName ])
  • channelID : integer, is the CHAT_CHANNEL of the message
  • from : string, is the sender name of the message (can be Charactername or DisplayName)
  • isCustomerService : boolean, true is the message come from a CustomerService Member



LC:registerText(myFuncToChangeText [, addonName ])
  • channelID : integer, is the CHAT_CHANNEL of the message
  • from : string, is the sender name of the message (can be Charactername or DisplayName)
  • text : string, message sent to the client
  • isCustomerService : boolean, true is the message come from a CustomerService Member



LC:registerFormat(myFuncToChangeMessage [, addonName ])
  • channelID : integer, is the CHAT_CHANNEL of the message
  • from : string, is the sender name of the message (can be Charactername or DisplayName) *This text can be rewrited by another addon
  • text : string, message sent to the client *This text can be rewrited by another addon
  • isCustomerService : boolean, true is the message come from a CustomerService Member
  • originalFrom : string, is the sender name of the message (can be Charactername or DisplayName) *This text can be rewrited by another addon which do not use libChat
  • originalText : string, message sent to the client *This text can be rewrited by another addon which do not use libChat
  • DDSBeforeMessage : string, DDS added by another addon if applicable
  • TextBeforeMessage : string, text added by another addon if applicable
  • DDSBeforeSender : string, DDS added by another addon if applicable
  • TextBeforeSender : string, text added by another addon if applicable
  • DDSAfterSender : string, DDS added by another addon if applicable
  • TextAfterSender : string, text added by another addon if applicable
  • DDSBeforeText : string, DDS added by another addon if applicable
  • TextBeforeText : string, text added by another addon if applicable
  • TextAfterText : string, text added by another addon if applicable
  • DDSAfterText : string, DDS added by another addon if applicable

LC:registerAppendDDSBeforeAll(myFunc [, addonName ])
LC:registerAppendTextBeforeAll(myFunc [, addonName ])
LC:registerAppendDDSBeforeSender(myFunc [, addonName ])
LC:registerAppendTextBeforeSender(myFunc [, addonName ])
LC:registerAppendTextAfterSender(myFunc [, addonName ])
LC:registerAppendDDSAfterSender(myFunc [, addonName ])
LC:registerAppendDDSBeforeText(myFunc [, addonName ])
LC:registerAppendTextBeforeText(myFunc [, addonName ])
LC:registerAppendTextAfterText(myFunc [, addonName ])
LC:registerAppendDDSAfterText(myFunc [, addonName ])
  • channelID : integer, is the CHAT_CHANNEL of the message
  • from : string, is the sender name of the message (can be Charactername or DisplayName)
  • text : string, message sent to the client
  • isCustomerService : boolean, true is the message come from a CustomerService Member


About Appending :
For now, each method can only be registered by one addon.
If 2 addons try to load the same method, one will be skipped, but the both will appear in manager with /libchat. In next future, Append methods will accept unlimited calls

Appending format :

If a message look like this :
{OptionnalESOUIFormat}{Sender}{OptionnalESOUIFormat}{Message}{OptionnalESOUIFormat}
ex : [Group][Ayantir] : Hello World

Appends can add strings using this template :
{DDSBeforeAll}{TextBeforeAll}{OptionnalESOUIFormat}{DDSBeforeSender}{TextBeforeSender}{Sender}{TextAfterSender}{DDSAfterSender}{OptionnalESOUIFormat}{DDSBeforeText}{TextBeforeText}{Message}{TextAftertext}{DDSAftertext}{OptionnalESOUIFormat}
ex : [20h12][Group][VR14][Ayantir] : Hello World

In this exemple are used : DDSBeforeAll (smiley), TextBeforeAll ([20h12]), TextBeforeSender ([VR14]) and DDSAftertext (smiley)


LC:registerFriendStatus(myFuncToChangeFriendStatusMessage [, addonName ])
  • displayName : string, DisplayName of the Account triggering the message
  • characterName : string, characterName of the Account triggering the message
  • oldStatus : integer, is the old status of the account
  • newStatus : integer, is the new status of the account



LC:registerIgnoreAdd(myFuncToChangeIgnoreAddMessage [, addonName ])
  • displayName : string, DisplayName of the Account ignored



LC:registerIgnoreRemove(myFuncToChangeIgnoreRemoveMessage [, addonName ])
  • displayName : string, DisplayName of the Account ignored



LC:registerGroupTypeChanged(myFuncToChangeGroupTypeChangedMessage [, addonName ])
  • largeGroup : boolean, true is newStatus is a large group



Then simply write your function with the parameters you want to use :

ex :

Lua Code:
  1. local LC = LibChat2
  2.  
  3. LC:registerAppendTextBeforeAll(AppendTime, Addon.Name)
  4.  
  5. -- Will append Time for party messages only before all text
  6. local function AppendTime(channelID, from, text, isCustomerService)
  7.  
  8.     if channelID == CHAT_CHANNEL_PARTY then
  9.         return GetTimeString()
  10.     else
  11.         return ""
  12.     end
  13.    
  14. end


My Add-On does nothing

If your Chat Addon does nothing, and your code is running well, it's generally because another chat addon bypass your code. libChat2 helps you to handle this problem by adding methods to add or rewrite text only where you need it, without broking other addons.
Using registerAppendDDSBeforeAll, registerAppendTextBeforeAll, registerAppendDDSBeforeSender, registerAppendTextBeforeSender
registerAppendTextAfterSender, registerAppendDDSAfterSender, registerAppendDDSBeforeText, registerAppendTextBeforeText, registerAppendTextAfterText, registerAppendDDSAfterText
helps other devs too.

Please note that this feature is only available if other addon use libchat too
If the other addon rewrite Chat without libChat, this one can bypass your code too


Debug for end-Users

libChat2 now come with an embedded debug, trought /libchat. It will dump which methods are registered with which addon and help you if your addon does "nothing"

ex :

Code:
---- libchat2 debug ----
Note : 2 addons registering same method will provoke conflicts
registerFriendStatus set with addon  #1 pChat, #2 GuildNotificator,
registerAppendTextAfterSender set with addon  #1 GuildChat,
registerGroupTypeChanged set with addon  #1 pChat,
registerAppendTextBeforeSender set with addon  #1 GuildChat,
registerFormat set with addon WARNING : method overwrite Sender name and Message ! #1 pChat,
registerIgnoreRemove set with addon  #1 pChat,
registerIgnoreAdd set with addon  #1 pChat,
---- end of libchat2 debug ----
Here you can see that addon :
- pChat registers : registerFriendStatus, registerGroupTypeChanged, registerFormat, registerIgnoreRemove, registerIgnoreAdd
- GuildNotificator registers : registerFriendStatus
- GuildChat registers : registerAppendTextBeforeSender, registerAppendTextAfterSender


Any problem or requesting a little help

- Send a Private Message or leave a comment
12
======
Fixed: With library enabled without any addon registering a special format function: Character names on German and French clients showed their gender specific info like ^Mx at the end

11
======
Changed EVENT_CHAT_MESSAGE_CHANNEL to use string.format code now like Zos changed, and not zo_strformat anymore. Should fix chat output where you only see messages like %s or similar.

10
======
-Made library standalone installation able (with or w/o LibStub)
-Added global variable LibChat2
-Added AddOnVersion: and IsLibrary: true tags
-Updated APIVersion

9
======
- 2 variables leaked fixed
- Rename of a method to match its sisters names
- Handle the modifications of EVENT_CHAT_CHANNEL

1.6
======
- Fixed the method to correctly register :registerAppendTextBeforeAll()
- Fixed few variables leaking to global

Justice
======
- Added methods to append text
- Added an integrated manager
- Doc reworked

v1.2
======
- funcXX vars were global, fixed

v1.1
======
- Added backward compatibility with original libChat
Optional Files (0)


Archived Files (8)
File Name
Version
Size
Uploader
Date
11
5kB
Baertram
10/02/19 03:00 PM
10
5kB
Baertram
10/01/19 09:50 AM
9
5kB
Ayantir
08/02/16 07:08 AM
1.6
5kB
Ayantir
08/22/15 07:45 AM
Justice
5kB
Ayantir
02/21/15 09:03 AM
1.2
4kB
Ayantir
09/16/14 09:35 AM
1.1
4kB
Ayantir
09/11/14 04:50 PM
1
3kB
09/09/14 09:21 AM


Post A Reply Comment Options
Unread 10/04/19, 02:32 PM  
Rothry

Forum posts: 0
File comments: 46
Uploads: 0
Originally Posted by Baertram
Found some of the old used zo_strformat commands in event EVENT_CHAT_MESSAGE_CHANNEL callback function of libChat2 and changed them to use the string.format functions from ZOs code now.
Update 11 will fix this.

Try if it works good now and if not please tell me how to reproduce any error!

Edit:
Standalone or not: this would have affected all the same so it can only depend on the settings within pChat you & me have enabled.

Edit2 -> libChat3:
I've updated libChat3 also with a new version 11 containing the fix for the event which shows %s in chat instead of the messages:
https://www.esoui.com/downloads/file...=2210#comments
a master second to none. thank you for your unbelievable work
Report comment to moderator  
Reply With Quote
Unread 10/02/19, 03:09 PM  
Anceane
 
Anceane's Avatar

Forum posts: 251
File comments: 796
Uploads: 0
Originally Posted by Baertram
Found some of the old used zo_strformat commands in event EVENT_CHAT_MESSAGE_CHANNEL callback function of libChat2 and changed them to use the string.format functions from ZOs code now.
Update 11 will fix this.

Try if it works good now and if not please tell me how to reproduce any error!

Edit:
Standalone or not: this would have affected all the same so it can only depend on the settings within pChat you & me have enabled.

hehe you are the boss my friend i am merely a student :P (kidding a part i learned a lot with you)
__________________
Report comment to moderator  
Reply With Quote
Unread 10/02/19, 02:59 PM  
Baertram
 
Baertram's Avatar
AddOn Author - Click to view AddOns

Forum posts: 2493
File comments: 2777
Uploads: 57
Found some of the old used zo_strformat commands in event EVENT_CHAT_MESSAGE_CHANNEL callback function of libChat2 and changed them to use the string.format functions from ZOs code now.
Update 11 will fix this.

Try if it works good now and if not please tell me how to reproduce any error!

Edit:
Standalone or not: this would have affected all the same so it can only depend on the settings within pChat you & me have enabled.

Edit2 -> libChat3:
I've updated libChat3 also with a new version 11 containing the fix for the event which shows %s in chat instead of the messages:
https://www.esoui.com/downloads/file...=2210#comments
Last edited by Baertram : 10/02/19 at 03:17 PM.
Report comment to moderator  
Reply With Quote
Unread 10/02/19, 02:59 PM  
Anceane
 
Anceane's Avatar

Forum posts: 251
File comments: 796
Uploads: 0
I had the bug one time only, and it was before i decided to replace libs outdated completely and use only the libs as standalone. Since then i do not encounter any problem.

Originally Posted by Baertram
Hm so why doesn't it break my chat then as I'm using pChat, which is the only addon using libChat2?
Any further info how to see that it is libChat2 and not only libChat2 e.g.?

I know zos changed the handling of their chat functions to use placeholders with % now instead of e.g. <<1>>.
But my pChat (my local installation. It's not my addon ) was never affected so far.

If you got any ideas what I need to enable in pChat to get the errors you should write it to the official pChat comments please.
If you have any hints where in libChat2 the problem is, please tell me so I can get the errors as well and fix them. But for now I only know there are problems, but do not know how to see, and then be able to fix them).
I'll have a look at the library code again, maybe I find something.

Originally Posted by Rothry
hey,

thanks for your great addons However libChat2 (as well as libChat3) breaks all player related chats. It just shows '%' symbols. AddOn Messages are not affected.

Greetz
__________________
Report comment to moderator  
Reply With Quote
Unread 10/02/19, 01:39 PM  
Baertram
 
Baertram's Avatar
AddOn Author - Click to view AddOns

Forum posts: 2493
File comments: 2777
Uploads: 57
Hm so why doesn't it break my chat then as I'm using pChat, which is the only addon using libChat2?
Any further info how to see that it is libChat2 and not only libChat2 e.g.?

I know zos changed the handling of their chat functions to use placeholders with % now instead of e.g. <<1>>.
But my pChat (my local installation. It's not my addon ) was never affected so far.

If you got any ideas what I need to enable in pChat to get the errors you should write it to the official pChat comments please.
If you have any hints where in libChat2 the problem is, please tell me so I can get the errors as well and fix them. But for now I only know there are problems, but do not know how to see, and then be able to fix them).
I'll have a look at the library code again, maybe I find something.

Originally Posted by Rothry
hey,

thanks for your great addons However libChat2 (as well as libChat3) breaks all player related chats. It just shows '%' symbols. AddOn Messages are not affected.

Greetz
Last edited by Baertram : 10/02/19 at 02:59 PM.
Report comment to moderator  
Reply With Quote
Unread 10/01/19, 01:56 PM  
Rothry

Forum posts: 0
File comments: 46
Uploads: 0
hey,

thanks for your great addons However libChat2 (as well as libChat3) breaks all player related chats. It just shows '%' symbols. AddOn Messages are not affected.

Greetz
Report comment to moderator  
Reply With Quote
Unread 08/22/15, 07:45 AM  
Ayantir
 
Ayantir's Avatar
AddOn Author - Click to view AddOns

Forum posts: 1022
File comments: 1560
Uploads: 31
Re: registerAppendTextBeforeAll currently not working

Originally Posted by Pyranea
You need to add this in "libChatMessageChannelReceiver":

Code:
if funcTextBeforeAll then
    TextBeforeAll = funcTextBeforeAll(channelID, from, text, isCustomerService)
end
Oh yes, thanks fixed. I've also fixed some local leaking (thank you circonian )
__________________
Obsessive Compulsive Coder

My little french Guild: Cercle de l'Eveil
Report comment to moderator  
Reply With Quote
Unread 08/22/15, 07:15 AM  
Pyranea

Forum posts: 0
File comments: 3
Uploads: 0
registerAppendTextBeforeAll currently not working

You need to add this in "libChatMessageChannelReceiver":

Code:
if funcTextBeforeAll then
    TextBeforeAll = funcTextBeforeAll(channelID, from, text, isCustomerService)
end
Report comment to moderator  
Reply With Quote
Unread 02/21/15, 09:12 AM  
Ayantir
 
Ayantir's Avatar
AddOn Author - Click to view AddOns

Forum posts: 1022
File comments: 1560
Uploads: 31
Why this $%!#? library ?!

Heya nobody here,

Please note that for the very few chat addons we get in ESO we're alsmost each other broking our addons.

So :
  • If you REWRITE or APPEND something to a message sent by EVENT_CHAT_MESSAGE_CHANNEL and don't use libchat, you will BROKE other chat addons.

Adding timestamps, smileys, info, or anything else to thoses messages ? Please use libChat.

Thank you !
__________________
Obsessive Compulsive Coder

My little french Guild: Cercle de l'Eveil
Report comment to moderator  
Reply With Quote
Post A Reply



Category Jump: